00001 #ifndef SDXATTRIBUTE_H
00002 #define SDXATTRIBUTE_H
00003
00004 #include <string>
00005 #include <sstream>
00006
00007 namespace SDX {
00008 class ContentHandler;
00009
00012 class Attribute {
00013 public:
00017 Attribute(){}
00018
00023 Attribute(Attribute& other);
00024
00029 Attribute(Attribute* other);
00030
00035 Attribute(std::string value);
00036
00042 Attribute(std::string name, std::string value);
00043
00047 bool isNamedAttribute();
00048
00053 std::string getName();
00054
00060 bool getValue(std::string* value);
00061
00067 template <class T> bool getValue(T* value){
00068 if(!value)
00069 return false;
00070
00071 std::istringstream iStringStream(m_value);
00072 return !((iStringStream >> *value).fail());
00073 }
00074
00079 void sendToContentHandler(ContentHandler* contentHandler);
00080 private:
00081 bool m_isNamedAttribute;
00082
00083 std::string m_name;
00084 std::string m_value;
00085 };
00086 }
00087
00088 #endif