ColorXML.cxx
Go to the documentation of this file.
1 
11 // for dll interface warning
12 #ifdef _MSC_VER
13 #include "msdevstudio/MSconfig.h"
14 #endif
15 
16 #include "ColorXML.h"
17 
18 #include "XmlElement.h"
19 
20 #include "graphics/Color.h"
21 
22 using std::string;
23 
24 namespace hippodraw {
25 
27  : BaseXML ( "Color", controller ),
28  m_red ( "red" ),
29  m_green ( "green" ),
30  m_blue ( "blue" )
31 {
32 }
33 
35 {
37 
38  tag->setAttribute ( m_red, color.getRed () );
39  tag->setAttribute ( m_green, color.getGreen () );
40  tag->setAttribute ( m_blue, color.getBlue () );
41 
42  return tag;
43 }
44 
46 {
47  int red = 0;
48  bool ok = element->attribute ( m_red, red );
49 
50  int green = 0;
51  ok = element->attribute ( m_green, green );
52 
53  int blue = 0;
54  ok = element->attribute ( m_blue, blue );
55 
56  Color * color = new Color ();
57  color->setColor ( red, green, blue );
58 
59  return color;
60 }
61 
62 } // namespace hippodraw
63 

Generated for HippoDraw Class Library by doxygen