mirror of
https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
synced 2023-10-19 17:58:31 +02:00
fixed bug that global double vars are not working
This commit is contained in:
parent
da25976325
commit
714ee26b1b
2
HISTORY
2
HISTORY
@ -100,3 +100,5 @@ Version 0.0.6
|
|||||||
|
|
||||||
Version 0.0.7
|
Version 0.0.7
|
||||||
|
|
||||||
|
- fixed bug that global double vars are not working
|
||||||
|
|
||||||
|
@ -71,6 +71,9 @@ void cGlobals::Debug(void) {
|
|||||||
for (map <string, int>::iterator myInt = intVars.begin(); myInt != intVars.end(); myInt++) {
|
for (map <string, int>::iterator myInt = intVars.begin(); myInt != intVars.end(); myInt++) {
|
||||||
dsyslog("skindesigner: Integer Variable \"%s\": %d", (myInt->first).c_str(), myInt->second);
|
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++) {
|
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());
|
dsyslog("skindesigner: String Variable \"%s\": \"%s\"", (myStr->first).c_str(), (myStr->second).c_str());
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include "../config.h"
|
||||||
#include "parameter.h"
|
#include "parameter.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -164,7 +165,13 @@ bool cNumericParameter::CheckExpression(int &val, string &parsedVal) {
|
|||||||
if (foundToken != string::npos) {
|
if (foundToken != string::npos) {
|
||||||
stringstream st;
|
stringstream st;
|
||||||
st << globDouble->second;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -145,11 +145,6 @@ bool cXmlParser::ParseView(void) {
|
|||||||
xmlAttrPtr attr = node->properties;
|
xmlAttrPtr attr = node->properties;
|
||||||
vector<pair<string, string> > attribs;
|
vector<pair<string, string> > attribs;
|
||||||
ParseAttributes(attr, node, 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);
|
ParseViewElement(node->name, node->xmlChildrenNode, attribs);
|
||||||
} else if (view->ValidViewList((const char*)node->name)) {
|
} else if (view->ValidViewList((const char*)node->name)) {
|
||||||
ParseViewList(node);
|
ParseViewList(node);
|
||||||
@ -360,6 +355,11 @@ void cXmlParser::InsertVariable(string name, string type, string value) {
|
|||||||
int val = atoi(value.c_str());
|
int val = atoi(value.c_str());
|
||||||
globals->intVars.insert(pair<string, int>(name, val));
|
globals->intVars.insert(pair<string, int>(name, val));
|
||||||
} else if (!type.compare("double")) {
|
} 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());
|
double val = atof(value.c_str());
|
||||||
globals->doubleVars.insert(pair<string, double>(name, val));
|
globals->doubleVars.insert(pair<string, double>(name, val));
|
||||||
} else if (!type.compare("string")) {
|
} else if (!type.compare("string")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user