int ConversionProperties::getIntValue(const std::string& key) const { ConversionOption *option = getOption(key); if (option != NULL) return option->getIntValue(); return -1; }
void ConversionProperties::setIntValue(const std::string& key, int value) { ConversionOption *option = getOption(key); if (option != NULL) option->setIntValue(value); }
bool ConversionProperties::getBoolValue(const std::string& key) const { ConversionOption *option = getOption(key); if (option != NULL) return option->getBoolValue(); return false; }
float ConversionProperties::getFloatValue(const std::string& key) const { ConversionOption *option = getOption(key); if (option != NULL) return option->getFloatValue(); return std::numeric_limits<float>::quiet_NaN(); }
void ConversionProperties::setFloatValue(std::string key, float value) { ConversionOption *option = getOption(key); if (option != NULL) option->setFloatValue(value); }
double ConversionProperties::getDoubleValue(std::string key) const { ConversionOption *option = getOption(key); if (option != NULL) return option->getDoubleValue(); return std::numeric_limits<double>::quiet_NaN(); }
std::string ConversionProperties::getValue(std::string key) const { ConversionOption *option = getOption(key); if (option != NULL) return option->getValue(); return ""; }
void ConversionProperties::addOption(const ConversionOption &option) { ConversionOption *old = removeOption(option.getKey()); if (old != NULL) delete old; mOptions.insert(pair<string, ConversionOption*>(option.getKey(), option.clone())); }
ConversionOptionType_t ConversionProperties::getType(const std::string& key) const { ConversionOption *option = getOption(key); if (option != NULL) return option->getType(); return CNV_TYPE_STRING; }
const std::string& ConversionProperties::getValue(const std::string& key) const { ConversionOption *option = getOption(key); if (option != NULL) return option->getValue(); static std::string empty = ""; return empty; }
END_TEST START_TEST (test_conversion_options_clone) { ConversionOption option("key", 1.1, "some description"); fail_unless(option.getDoubleValue() == 1.1); fail_unless(option.getType() == CNV_TYPE_DOUBLE); ConversionOption *clone = option.clone(); fail_unless(option.getKey() == clone->getKey()); fail_unless(option.getType() == clone->getType()); fail_unless(option.getValue() == clone->getValue()); fail_unless(option.getDescription() == clone->getDescription()); delete clone; }
void ConversionProperties::setDoubleValue(std::string key, double value) { ConversionOption *option = getOption(key); if (option != NULL) option->setDoubleValue(value); }
void ConversionProperties::addOption(const ConversionOption &option) { if (&option == NULL) return; mOptions.insert(pair<string, ConversionOption*>( option.getKey(), option.clone())); }