Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

size of XMLtext? #61

Open
martell opened this issue Sep 12, 2012 · 4 comments
Open

size of XMLtext? #61

martell opened this issue Sep 12, 2012 · 4 comments

Comments

@martell
Copy link
Contributor

martell commented Sep 12, 2012

Hi lee thanks for merging the update that I done.
Im working on cocos2dx atm which uses tiny xml for its windows 8 platform.

Here is a function in the code

bool XmlSaxHander::Visit( const XMLText& text )
{

//CCLog("Visit %s",text.Value());
CCSAXParser::textHandler(m_ccsaxParserImp, (const CC_XML_CHAR *)text.Value(), text.ValueTStr().size());
return true;

}

now my issue is tinyxml2 doesnt have a .ValueTStr().size() function.

Any hints?

@sniperbat
Copy link
Contributor

If you just want to get the length of the text, you can use strlen( text.Value() ), because text.Value() just return a '\0' terminated char pointer.

@leethomason
Copy link
Owner

It would be straightforward to have method on StrPair (which in the underlying string class):

StrPair.Size() { GetStr(); return end-str; }

The GetStr() is just there to cause a flush.

The tedious part is this, in the API surface:

const char* Value()
int ValueSize();

or possibly:

const char* Value( int* size=0 );

Which is possibly a little better. Thoughts on whether that is a valuable API? (It's come up before.)

@sniperbat
Copy link
Contributor

const char* Value( int* size=0 ); +1

@martell
Copy link
Contributor Author

martell commented Jan 24, 2013

+1 from me also
Sorry for the late reply.

I got tinyxml2 working with cocos in an hour or so today in my free time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants