summaryrefslogtreecommitdiff
path: root/xml
diff options
context:
space:
mode:
authorlordjaxom <lordjaxom>2005-01-07 21:49:23 +0000
committerlordjaxom <lordjaxom>2005-01-07 21:49:23 +0000
commit62ad3100d861a1227fe4c1130dcf2a7ec096ed61 (patch)
tree5200a17f7bd70b15b683f1dcf1c725a290124541 /xml
parent7c3fd29204b8882011186b6337b002893fe2d1f6 (diff)
downloadvdr-plugin-text2skin-62ad3100d861a1227fe4c1130dcf2a7ec096ed61.tar.gz
vdr-plugin-text2skin-62ad3100d861a1227fe4c1130dcf2a7ec096ed61.tar.bz2
- consequent use of cxType for strings and numbers
Diffstat (limited to 'xml')
-rw-r--r--xml/type.c28
-rw-r--r--xml/type.h17
2 files changed, 12 insertions, 33 deletions
diff --git a/xml/type.c b/xml/type.c
index 5fa950c..0fff7d6 100644
--- a/xml/type.c
+++ b/xml/type.c
@@ -1,31 +1,5 @@
/*
- * $Id: type.c,v 1.2 2005/01/05 19:32:43 lordjaxom Exp $
+ * $Id: type.c,v 1.3 2005/01/07 21:50:53 lordjaxom Exp $
*/
#include "xml/type.h"
-#include "xml/function.h"
-#include <vdr/tools.h>
-#include <stdio.h>
-
-cxType cxType::False(false);
-cxType cxType::True(true);
-
-std::string cxType::String(void) const {
- if (mType == number)
- return (const char*)itoa(mNumber);
- return mString;
-
-#if 0
- if (mType == number) {
- char *buffer;
- asprintf(&buffer, "%d", mNumber);
- mString = buffer;
- mType = string;
- free(buffer);
- } else if (mType == boolean) {
- mString = mNumber ? cxFunction::True : cxFunction::False;
- mType = string;
- }
- return mString;
-#endif
-}
diff --git a/xml/type.h b/xml/type.h
index f4fb33a..d94a38c 100644
--- a/xml/type.h
+++ b/xml/type.h
@@ -1,12 +1,13 @@
/*
- * $Id: type.h,v 1.4 2005/01/05 19:32:43 lordjaxom Exp $
+ * $Id: type.h,v 1.5 2005/01/07 21:50:54 lordjaxom Exp $
*/
#ifndef VDR_TEXT2SKIN_XML_TYPE_H
#define VDR_TEXT2SKIN_XML_TYPE_H
-#include <stdio.h>
#include <string>
+#include <vdr/tools.h>
+#include <stdio.h>
class cxType {
public:
@@ -26,9 +27,6 @@ private:
uint mUpdateIn;
public:
- static cxType True;
- static cxType False;
-
cxType(void): mType(boolean), mNumber(0), mUpdateIn(0) {}
cxType(const char *String): mType(string), mString(String ?: ""), mUpdateIn(0) {}
cxType(std::string String): mType(string), mString(String), mUpdateIn(0) {}
@@ -37,7 +35,8 @@ public:
cxType(bool Value): mType(boolean), mNumber(Value ? 1 : 0), mUpdateIn(0) {}
std::string String(void) const;
- int Number(void) const { return mType == number ? mNumber : 0; }
+ //std::string String(void);
+ int Number(void) const { return mType == number ? mNumber : atoi(mString.c_str()); }
void SetUpdate(uint UpdateIn) { mUpdateIn = UpdateIn; }
uint UpdateIn(void) const { return mUpdateIn; }
@@ -54,6 +53,12 @@ public:
friend bool operator>= (const cxType &a, const cxType &b);
};
+inline std::string cxType::String(void) const {
+ if (mType != string)
+ return (const char*)itoa(mNumber);
+ return mString;
+}
+
inline cxType::operator bool () const
{
switch (mType) {