/[svn]/linuxsampler/trunk/src/drivers/DeviceParameter.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/drivers/DeviceParameter.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1494 by schoenebeck, Sun Oct 14 22:00:17 2007 UTC revision 1495 by schoenebeck, Mon Nov 19 22:10:18 2007 UTC
# Line 41  namespace LinuxSampler { Line 41  namespace LinuxSampler {
41          }          }
42      }      }
43    
44        // like __eliminate_quotation(), but this one really kills all of 'em
45        static void __eliminate_all_quotations(String& s) {
46            for (int i = 0; i < s.size(); i++) {
47                if (s.c_str()[i] == '\'' || s.c_str()[i] == '\"') {
48                    s.replace(i, 1, "");
49                    i--;
50                }
51            }
52        }
53    
54      static bool __parse_bool(String val) throw (Exception) {      static bool __parse_bool(String val) throw (Exception) {
55          __eliminate_quotation(val);          __eliminate_all_quotations(val);
56          int b;          int b;
57          if      (val == "1" || !strcasecmp(val.c_str(),"true"))  b = true;          if      (val == "1" || !strcasecmp(val.c_str(),"true"))  b = true;
58          else if (val == "0" || !strcasecmp(val.c_str(),"false")) b = false;          else if (val == "0" || !strcasecmp(val.c_str(),"false")) b = false;
# Line 51  namespace LinuxSampler { Line 61  namespace LinuxSampler {
61      }      }
62    
63      static int __parse_int(String val) throw (Exception) {      static int __parse_int(String val) throw (Exception) {
64          __eliminate_quotation(val);          __eliminate_all_quotations(val);
65          return atoi(val.c_str()); // TODO: format check is missing          return atoi(val.c_str()); // TODO: format check is missing
66      }      }
67    
68      static float __parse_float(String val) throw (Exception) {      static float __parse_float(String val) throw (Exception) {
69          __eliminate_quotation(val);          __eliminate_all_quotations(val);
70          float x;          float x;
71          std::stringstream ss(val);          std::stringstream ss(val);
72          ss.imbue(std::locale::classic());          ss.imbue(std::locale::classic());

Legend:
Removed from v.1494  
changed lines
  Added in v.1495

  ViewVC Help
Powered by ViewVC