reset name

This commit is contained in:
Lee Thomason 2012-01-20 11:27:56 -08:00
parent dadcdfad4a
commit 39ede2487d
4 changed files with 28 additions and 4 deletions

View File

@ -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;
}

View File

@ -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 );
};

Binary file not shown.

View File

@ -28,7 +28,7 @@ int main( int argc, const char* argv )
}
#endif
{
static const char* test[] = { "<element />",
static const char* test[] = { //"<element />",
"<element></element>",
0
};