summaryrefslogtreecommitdiff
path: root/xml/type.h
diff options
context:
space:
mode:
Diffstat (limited to 'xml/type.h')
-rw-r--r--xml/type.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/xml/type.h b/xml/type.h
new file mode 100644
index 0000000..1b1113c
--- /dev/null
+++ b/xml/type.h
@@ -0,0 +1,42 @@
+/*
+ * $Id: type.h,v 1.3 2004/12/08 17:13:26 lordjaxom Exp $
+ */
+
+#ifndef VDR_TEXT2SKIN_XML_TYPE_H
+#define VDR_TEXT2SKIN_XML_TYPE_H
+
+#include <string>
+
+class cxType {
+public:
+ enum eType {
+ string,
+ number,
+ boolean
+ };
+
+private:
+ eType mType;
+ std::string mString;
+ int mNumber;
+
+public:
+ cxType(const char *String): mType(string), mString(String ?: "") {}
+ cxType(std::string String): mType(string), mString(String) {}
+ cxType(int Number): mType(number), mNumber(Number) {}
+ cxType(time_t Number): mType(number), mNumber(Number) {}
+ cxType(bool Value): mType(boolean), mNumber(Value ? 1 : 0) {}
+
+ const std::string &String(void);
+ int Number(void) const;
+
+ operator std::string () { return String(); }
+ operator int () { return Number(); }
+ operator bool () { return Number(); }
+};
+
+inline int cxType::Number(void) const {
+ return mType == number ? mNumber : 0;
+}
+
+#endif // VDR_TEXT2SKIN_XML_TYPE_H