void SessionFactory::processFixtDataDictionaries(const SessionID& sessionID, const Dictionary& settings, DataDictionaryProvider& provider) throw(ConfigError) { DataDictionary dataDictionary = createDataDictionary(sessionID, settings, TRANSPORT_DATA_DICTIONARY); provider.addTransportDataDictionary(sessionID.getBeginString(), dataDictionary); for(Dictionary::const_iterator data = settings.begin(); data != settings.end(); ++data) { const std::string& key = data->first; const std::string frontKey = key.substr(0, strlen(APP_DATA_DICTIONARY)); if( frontKey == string_toUpper(APP_DATA_DICTIONARY) ) { if( key == string_toUpper(APP_DATA_DICTIONARY) ) { DataDictionary dataDictionary = createDataDictionary(sessionID, settings, APP_DATA_DICTIONARY); provider.addApplicationDataDictionary(Message::toApplVerID(settings.getString(DEFAULT_APPLVERID)), dataDictionary); } else { std::string::size_type offset = key.find('.'); if( offset == std::string::npos ) throw ConfigError(std::string("Malformed ") + APP_DATA_DICTIONARY + ": " + key); std::string beginStringQualifier = key.substr(offset+1); DataDictionary dataDictionary = createDataDictionary(sessionID, settings, key); provider.addApplicationDataDictionary(Message::toApplVerID(beginStringQualifier), dataDictionary); } } } }
std::string Dictionary::getString( const std::string& key, bool capitalize ) const throw( ConfigError, FieldConvertError ) { Data::const_iterator i = m_data.find( string_toUpper(key) ); if ( i == m_data.end() ) throw ConfigError( key + " not defined" ); std::string result = i->second; if( capitalize ) std::transform(result.begin(), result.end(), result.begin(), toupper); return result; }
bool Dictionary::has( const std::string& key ) const { return m_data.find( string_toUpper(key) ) != m_data.end(); }
void Dictionary::setBool( const std::string& key, bool value ) { m_data[ string_strip(string_toUpper(key)) ] = BoolConvertor::convert( value ); }
void Dictionary::setDouble( const std::string& key, double value ) { m_data[ string_strip(string_toUpper(key)) ] = DoubleConvertor::convert( value ); }
void Dictionary::setInt( const std::string& key, int value ) { m_data[ string_strip(string_toUpper(key)) ] = IntConvertor::convert( value ); }
void Dictionary::setString( const std::string& key, const std::string& value ) { m_data[ string_strip(string_toUpper(key)) ] = string_strip(value); }