summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2014-11-29 16:00:42 +0100
committerlouis <louis.braun@gmx.de>2014-11-29 16:00:42 +0100
commit714ee26b1bdcfdac2968d7dcf885803074c4aa57 (patch)
tree4bb41dc5f7f565f95c5f1a14fea4531a36ace5fe
parentda25976325f4797da06b350685ee93fed07c4f97 (diff)
downloadvdr-plugin-skindesigner-714ee26b1bdcfdac2968d7dcf885803074c4aa57.tar.gz
vdr-plugin-skindesigner-714ee26b1bdcfdac2968d7dcf885803074c4aa57.tar.bz2
fixed bug that global double vars are not working
-rw-r--r--HISTORY2
-rw-r--r--libtemplate/globals.c3
-rw-r--r--libtemplate/parameter.c9
-rw-r--r--libtemplate/xmlparser.c10
4 files changed, 18 insertions, 6 deletions
diff --git a/HISTORY b/HISTORY
index baf0617..85e296c 100644
--- a/HISTORY
+++ b/HISTORY
@@ -100,3 +100,5 @@ Version 0.0.6
Version 0.0.7
+- fixed bug that global double vars are not working
+
diff --git a/libtemplate/globals.c b/libtemplate/globals.c
index af83da2..1896e7c 100644
--- a/libtemplate/globals.c
+++ b/libtemplate/globals.c
@@ -71,6 +71,9 @@ void cGlobals::Debug(void) {
for (map <string, int>::iterator myInt = intVars.begin(); myInt != intVars.end(); myInt++) {
dsyslog("skindesigner: Integer Variable \"%s\": %d", (myInt->first).c_str(), myInt->second);
}
+ for (map <string, double>::iterator myDouble = doubleVars.begin(); myDouble != doubleVars.end(); myDouble++) {
+ dsyslog("skindesigner: Double Variable \"%s\": %f", (myDouble->first).c_str(), myDouble->second);
+ }
for (map <string, string>::iterator myStr = stringVars.begin(); myStr != stringVars.end(); myStr++) {
dsyslog("skindesigner: String Variable \"%s\": \"%s\"", (myStr->first).c_str(), (myStr->second).c_str());
}
diff --git a/libtemplate/parameter.c b/libtemplate/parameter.c
index c646f06..e3e48bd 100644
--- a/libtemplate/parameter.c
+++ b/libtemplate/parameter.c
@@ -1,3 +1,4 @@
+#include "../config.h"
#include "parameter.h"
using namespace std;
@@ -164,7 +165,13 @@ bool cNumericParameter::CheckExpression(int &val, string &parsedVal) {
if (foundToken != string::npos) {
stringstream st;
st << globDouble->second;
- parsedValue = parsedValue.replace(foundToken, token.size(), st.str());
+ string doubleVal = st.str();
+ if (config.replaceDecPoint) {
+ if (doubleVal.find_first_of('.') != string::npos) {
+ std::replace( doubleVal.begin(), doubleVal.end(), '.', config.decPoint);
+ }
+ }
+ parsedValue = parsedValue.replace(foundToken, token.size(), doubleVal);
}
}
}
diff --git a/libtemplate/xmlparser.c b/libtemplate/xmlparser.c
index bdaf0bb..8931f2f 100644
--- a/libtemplate/xmlparser.c
+++ b/libtemplate/xmlparser.c
@@ -145,11 +145,6 @@ bool cXmlParser::ParseView(void) {
xmlAttrPtr attr = node->properties;
vector<pair<string, string> > attribs;
ParseAttributes(attr, node, attribs);
- /*
- for (vector<pair<string, string> >::iterator it = attribs.begin(); it != attribs.end(); it++) {
- esyslog("skindesigner: attribute %s value %s", (it->first).c_str(), (it->second).c_str());
- }
- */
ParseViewElement(node->name, node->xmlChildrenNode, attribs);
} else if (view->ValidViewList((const char*)node->name)) {
ParseViewList(node);
@@ -360,6 +355,11 @@ void cXmlParser::InsertVariable(string name, string type, string value) {
int val = atoi(value.c_str());
globals->intVars.insert(pair<string, int>(name, val));
} else if (!type.compare("double")) {
+ if (config.replaceDecPoint) {
+ if (value.find_first_of('.') != string::npos) {
+ std::replace( value.begin(), value.end(), '.', config.decPoint);
+ }
+ }
double val = atof(value.c_str());
globals->doubleVars.insert(pair<string, double>(name, val));
} else if (!type.compare("string")) {