From 39ede2487dc43e49ea10654a4f2ff035e73c3a33 Mon Sep 17 00:00:00 2001 From: Lee Thomason Date: Fri, 20 Jan 2012 11:27:56 -0800 Subject: [PATCH] reset name --- tinyxml2.cpp | 6 ++++-- tinyxml2.h | 24 +++++++++++++++++++++++- tinyxml2.suo | Bin 28160 -> 29184 bytes xmltest.cpp | 2 +- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/tinyxml2.cpp b/tinyxml2.cpp index 5e1b1d8..4a3152a 100644 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -88,6 +88,8 @@ const char* XMLBase::ParseText( char* p, const char* endTag, char** next ) } +char* XMLBase::ParseName( char* in, StrPair* pair ); + const char* XMLBase::ParseName( char* p, char** next ) { char* start = p; @@ -115,10 +117,10 @@ const char* XMLBase::ParseName( char* p, char** next ) *p = 0; if ( p > start ) { - *next = p; + *next = p+1; return start; } - return p+1; + return 0; } diff --git a/tinyxml2.h b/tinyxml2.h index b087349..f081758 100644 --- a/tinyxml2.h +++ b/tinyxml2.h @@ -45,6 +45,28 @@ struct CharBuffer static void Free( CharBuffer* ); }; +// FIXME: refactor to be the basis for all string handling. +class StrPair +{ + enum { + NEEDS_FLUSH = 0x01, + NEEDS_ENTITY_PROCESSING = 0x02, + NEEDS_NEWLINE_NORMALIZATION = 0x04 + }; + + StrPair() : flags( 0 ), start( 0 ), end( 0 ) {} + void Init( const char* start, char* end, int flags; ) { + this->start = start; this->end = end; this->flags = flags | NEEDS_FLUSH; + } + const char* GetStr(); + +private: + // After parsing, if *end != 0, it can be set to zero. + int flags; + const char* start; + char* end; +}; + class XMLBase { @@ -71,7 +93,7 @@ protected: inline static int IsAlpha( unsigned char anyByte ) { return ( anyByte <= 127 ) ? isalpha( anyByte ) : 1; } const char* ParseText( char* in, const char* endTag, char** next ); - const char* ParseName( char* in, char** next ); + char* ParseName( char* in, StrPair* pair ); char* Identify( XMLDocument* document, char* p, XMLNode** node ); }; diff --git a/tinyxml2.suo b/tinyxml2.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bh{!ODB`a{LNx;}%32Bdv z{w9fZ+i;=TNvBBic|7cW8tS-!yAcmrgpt=o7R!KUV_xUGMOZW|q11+xQ3tN2!ce15 ziYtm6ExHY%N14h6O_d6#=kp+D-9gNEo1wMX@r9P4m=(ya5q9>usEd4PIMpgr4s?`1 zZ*$O&3Sx0P!)z=0I74wALu`*gG(L-p_vnNAIt zyEXjMX=hu87)etxg~2q}=_ixf_02?60dFTdl@vbxPVup)lBygW>duyxR^F0{YW)|IL7RvE-T(hmJ}@ zHm}8eKqk47wt?3k)S8W7YmJzG5(M>eb%gI+fmPq01Y*3(ujx!8K12PVdn2_9L zW0|=fa*)f@_?Q?M?X_ZIlbKxWc`sIQ1*>44DXGol%)_KhLf00#q{Y~QyPGZ8z2&1) zP$C_sACui(tb&TQ?qD^1ZeK=mP;C#vpr+1Rb@1(<>BfMLYdQ{{m zSQaPy6g@lT2_obEk|e_L)A96o6m!>r)0tj|=KhS2GNeK{;9aKReg=zvw2NsMqinuT zKsak>iMhw^xRdQK zJ4Ly#^&W+N$cEz^yD&Ln#;qaJ2`LyD(&R2K&PBN)?hqFa23oozY9JJfG_^D~#v3~u z8;`z3SI#KD-sa;^(r5r5Y!6}cwiUd76^&BU_v7}qUH8r28noMw@Pth1d7Z}k?UPt` z1YPBwrFHtwmd1&t9jww6)#MYL%x$7ucY;QT?o-Fv!L?XtT!o(PVNCbe>i$;Vx6akk zgh%;~R)cyJ4f|RV+i?}6J~t+Y#bpLMhh_e7slwCLZNAht;L~A(KhQ?}_OLXhn+f88 zP@;~&;8zp&6-)g>zvM2)?RTETKEm`URBeF}N7Zyi4 zjr{-6zRU959!v|vg{%8wJO)e&B%b+dW;_RZT>g&@y&AvPdvJBgiRXzki34|$K5*q< Dn1Swd diff --git a/xmltest.cpp b/xmltest.cpp index 2bc5de6..3152ebd 100644 --- a/xmltest.cpp +++ b/xmltest.cpp @@ -28,7 +28,7 @@ int main( int argc, const char* argv ) } #endif { - static const char* test[] = { "", + static const char* test[] = { //"", "", 0 };