Open GoogleCodeExporter opened 9 years ago
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 comment by johnny.m...@gmail.com
on 20 Feb 2012 at 12:06
Original issue reported on code.google.com by
johnny.m...@gmail.com
on 19 Feb 2012 at 12:36