You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.
I'd like to utilize the streaming operator to parse an XML file with ticpp
(tinyxml ++ ). I've not been able to find any examples on this. The ticpp
documentation says only a little bit about streaming support.
I'd like to initialize streaming in with the following:
ifstream in;
in.open( m_sConfigFile, std::ios::in );
if( in.good() )
in >> *this;
I'm not sure how to write the stream in function:
std::istream & operator >> ( std::istream & in, EffectMgr & r )
{
return in;
}
My XML file looks like this:
<? xml version="1.0" ?>
<EffectsMgr>
<Effect name="textured-phong" >
<Shader name="textured-phong.vert" type="Vertex" />
<Shader name="textured-phong.frag" type="Fragment" />
<VertexClass name="CustomVertex" />
<Attribute name="VertexPosition" size="3" offset="0" />
<Attribute name="VertexNormal" size="3" offset="3" />
<Attribute name="VertexTexCoord" size="3" offset="6" />
</Effect>
</EffectsMgr>
Are there any examples out there I should check out?
Original issue reported on code.google.com by [email protected] on 19 Feb 2012 at 12:36
The text was updated successfully, but these errors were encountered:
I've updated my question, as I've found how to stream in from disk.
I'd like to utilize the streaming operator to parse an XML file with ticpp
(tinyxml ++ ). I've not been able to find any examples on this.
I'd like to initialize streaming in with the following:
ifstream in;
in.open( m_sConfigFile, std::ios::in );
if( in.good() )
in >> *this;
Here's my solution for the stream in function:
std::istream & operator >> ( std::istream & in, EffectMgr & r )
{
ticpp::Document doc;
in >> doc;
ticpp::Iterator<ticpp::Element> EffectItr;
for( EffectItr = EffectItr.begin(doc.FirstChildElement()); EffectItr != EffectItr.end(); EffectItr ++ )
{
// Generate Effect objects
}
return in;
}
My question is how can I write the stream out function?
std::ostream & operator << ( std::ostream & out, const EffectMgr & r )
{
// ????
return out;
}
My XML file looks like this:
<? xml version="1.0" ?>
<EffectsMgr>
<Effect name="textured-phong" >
<Shader name="textured-phong.vert" type="Vertex" />
<Shader name="textured-phong.frag" type="Fragment" />
<VertexClass name="CustomVertex" />
<Attribute name="VertexPosition" size="3" offset="0" />
<Attribute name="VertexNormal" size="3" offset="3" />
<Attribute name="VertexTexCoord" size="3" offset="6" />
</Effect>
<Effect>
...
</Effect>
</EffectsMgr>
Original issue reported on code.google.com by
[email protected]
on 19 Feb 2012 at 12:36The text was updated successfully, but these errors were encountered: