예제 #1
0
파일: SessionFactory.cpp 프로젝트: ifzz/FDK
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);
      }
    }
  }

  
}
예제 #2
0
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;
}
예제 #3
0
bool Dictionary::has( const std::string& key ) const
{
  return m_data.find( string_toUpper(key) ) != m_data.end();
}
예제 #4
0
void Dictionary::setBool( const std::string& key, bool value )
{
  m_data[ string_strip(string_toUpper(key)) ] = BoolConvertor::convert( value );
}
예제 #5
0
void Dictionary::setDouble( const std::string& key, double value )
{
  m_data[ string_strip(string_toUpper(key)) ] = DoubleConvertor::convert( value );
}
예제 #6
0
void Dictionary::setInt( const std::string& key, int value )
{
  m_data[ string_strip(string_toUpper(key)) ] = IntConvertor::convert( value );
}
예제 #7
0
void Dictionary::setString( const std::string& key, const std::string& value )
{
  m_data[ string_strip(string_toUpper(key)) ] = string_strip(value);
}