MCPcopy Create free account
hub / github.com/9miao/CrossApp / GetStr

Method GetStr

CrossApp/support/tinyxml2/tinyxml2.cpp:183–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181
182
183const char* StrPair::GetStr()
184{
185 if ( _flags & NEEDS_FLUSH ) {
186 *_end = 0;
187 _flags ^= NEEDS_FLUSH;
188
189 if ( _flags ) {
190 char* p = _start; // the read pointer
191 char* q = _start; // the write pointer
192
193 while( p < _end ) {
194 if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == CR ) {
195 // CR-LF pair becomes LF
196 // CR alone becomes LF
197 // LF-CR becomes LF
198 if ( *(p+1) == LF ) {
199 p += 2;
200 }
201 else {
202 ++p;
203 }
204 *q++ = LF;
205 }
206 else if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == LF ) {
207 if ( *(p+1) == CR ) {
208 p += 2;
209 }
210 else {
211 ++p;
212 }
213 *q++ = LF;
214 }
215 else if ( (_flags & NEEDS_ENTITY_PROCESSING) && *p == '&' ) {
216 // Entities handled by tinyXML2:
217 // - special entities in the entity table [in/out]
218 // - numeric character reference [in]
219 // &#20013; or &#x4e2d;
220
221 if ( *(p+1) == '#' ) {
222 char buf[10] = { 0 };
223 int len;
224 p = const_cast<char*>( XMLUtil::GetCharacterRef( p, buf, &len ) );
225 for( int i=0; i<len; ++i ) {
226 *q++ = buf[i];
227 }
228 TIXMLASSERT( q <= p );
229 }
230 else {
231 int i=0;
232 for(; i<NUM_ENTITIES; ++i ) {
233 if ( strncmp( p+1, entities[i].pattern, entities[i].length ) == 0
234 && *(p+entities[i].length+1) == ';' ) {
235 // Found an entity convert;
236 *q = entities[i].value;
237 ++q;
238 p += entities[i].length + 2;
239 break;
240 }

Callers 3

ValueFunction · 0.80
tinyxml2.hFile · 0.80
ParseDeepMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected