src/Generic/common/LocatedString.cpp
/** Initialize the offsets for this LocatedString, based on its _text string. */
Initialize the offsets for this LocatedString, based on its _text string.
Initialize the offsets for this LocatedString based on its _text string .
void LocatedString::initialize_offsets(OffsetGroup start) {
	int byte_offset = start.byteOffset.value();
	int char_offset = start.charOffset.value();
	int edt_offset = start.edtOffset.value();
	int pos = 0;
	for ( ; pos < static_cast<int>(_text.length()); ++pos) {
		++char_offset;
		byte_offset += static_cast<int>(UnicodeUtil::countUTF8Bytes(_text[pos]));
		++edt_offset;
	}
	if (pos > 0) {
		OffsetGroup end(ByteOffset(byte_offset-1), CharOffset(char_offset-1), EDTOffset(edt_offset-1), ASRTime());
		_offsets.push_back(OffsetEntry(0, pos, start, end, false));
	}
}
void LocatedString :: initialize_offsets ( OffsetGroup start ) { int byte_offset = start . byteOffset . value ( ) ; int char_offset = start . charOffset . value ( ) ; int edt_offset = start . edtOffset . value ( ) ; int pos = 0 ; for ( ; pos < static_cast < int > ( _text . length ( ) ) ; ++ pos ) { ++ char_offset ; byte_offset += static_cast < int > ( UnicodeUtil :: countUTF8Bytes ( _text [ pos ] ) ) ; ++ edt_offset ; } if ( pos > 0 ) { OffsetGroup end ( ByteOffset ( byte_offset - 1 ) , CharOffset ( char_offset - 1 ) , EDTOffset ( edt_offset - 1 ) , ASRTime ( ) ) ; _offsets . push_back ( OffsetEntry ( 0 , pos , start , end , false ) ) ; } }
Initialize the offsets for this LocatedString, based on its _text string.
Initialize the offsets for this LocatedString based on its _text string .
// Update the offsets to consume the new character.
