Changeset 10172

Show
Ignore:
Timestamp:
07/26/10 12:34:52 (3 years ago)
Author:
Snyder.Jason
Message:

the trueValues initialization, transform, and contains call were not working so I did everything manually. This makes sense to my Java brain, but there may be (and probably is) a more elegant c++-style solution.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/trunk/system/ossie/parser/prop_helpers.cpp

    r10161 r10172  
    3030#include <ossie/prop_helpers.h> 
    3131 
    32 static const std::vector<std::string> trueValues = {"true", "t", "on", "yes", "1"}; 
     32static std::vector<std::string> trueValues; 
    3333 
    3434CORBA::Boolean ossieSupport::strings_to_boolean(std::vector<std::string> &values) 
    3535{ 
     36    trueValues.push_back("true"); 
     37    trueValues.push_back("t"); 
     38    trueValues.push_back("on"); 
     39    trueValues.push_back("yes"); 
     40    trueValues.push_back("1"); 
     41 
    3642    std::string localValue = values[0]; 
    3743 
    38     std::transform(localValue.begin(), localValue.end(), localValue.begin(), std::tolower); 
    39  
    40     return CORBA::Boolean(trueValues.contains(localValue)); 
     44    for(int i = 0; localValue[i] != '\0'; i++) 
     45        localValue[i] = tolower(localValue[i]); 
     46 
     47    for(int i = 0; i < 5; i++) 
     48    { 
     49        if(trueValues[i] == localValue) 
     50                return CORBA::Boolean(true); 
     51    } 
     52 
     53    return CORBA::Boolean(false); 
    4154} 
    4255