MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / Next

Method Next

src/string.cpp:771–798  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

769 }
770
771 size_t Next(IterType what) override
772 {
773 const auto end = this->string.end();
774 /* Already at the end? */
775 if (this->cur_pos >= end) return END;
776
777 switch (what) {
778 case ITER_CHARACTER:
779 ++this->cur_pos;
780 return this->cur_pos.GetByteOffset();
781
782 case ITER_WORD:
783 /* Consume current word. */
784 while (this->cur_pos != end && !IsWhitespace(*this->cur_pos)) {
785 ++this->cur_pos;
786 }
787 /* Consume whitespace to the next word. */
788 while (this->cur_pos != end && IsWhitespace(*this->cur_pos)) {
789 ++this->cur_pos;
790 }
791 return this->cur_pos.GetByteOffset();
792
793 default:
794 NOT_REACHED();
795 }
796
797 return END;
798 }
799
800 size_t Prev(IterType what) override
801 {

Callers

nothing calls this directly

Calls 4

IsWhitespaceFunction · 0.85
NOT_REACHEDFunction · 0.85
GetByteOffsetMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected