#include #include #include #include #include "preXmlInteger.hh" #include "ExpatInterface/Element.h" namespace preXml { void Integer::readFrom(const xml::Element & elt) { // Check we are reading the right kind of entity. assert(elt.getTagName() == string("integer")); // OK, we know the unit. We can go on. I want to check that // the CDATA of this integer does indeed represent an integer. istrstream dis(elt[string("value")].c_str()); istrstream iis(elt[string("value")].c_str()); double dFaceValue; preXml::Integer::IntegerType iFaceValue; dis >> dFaceValue; iis >> iFaceValue; // Here is the check itself. assert( dFaceValue == ((double) iFaceValue) ); // It seems that we are ok! this->_value = iFaceValue; }; void Integer::printMeNicelyTo(ostream & os) const { os << this->_value; }; } // end of preXml::Integer namespace