00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef FIX_DICTIONARY_H
00023 #define FIX_DICTIONARY_H
00024
00025 #ifdef _MSC_VER
00026 #pragma warning( disable : 4503 4355 4786 4290 )
00027 #endif
00028
00029 #include <map>
00030 #include <string>
00031 #include "Exceptions.h"
00032
00033 namespace FIX
00034 {
00036 class Dictionary
00037 {
00038 public:
00039 Dictionary( const std::string& name ) : m_name( name ) {}
00040 Dictionary() {}
00041 virtual ~Dictionary() {}
00042
00044 std::string getName() const { return m_name; }
00046 int size() const { return m_data.size(); }
00047
00049 std::string getString( const std::string&, bool capitalize = false ) const
00050 throw( ConfigError, FieldConvertError );
00052 long getLong( const std::string& ) const
00053 throw( ConfigError, FieldConvertError );
00055 double getDouble( const std::string& ) const
00056 throw( ConfigError, FieldConvertError );
00058 bool getBool( const std::string& ) const
00059 throw( ConfigError, FieldConvertError );
00061 int getDay( const std::string& ) const
00062 throw( ConfigError, FieldConvertError );
00063
00065 void setString( const std::string&, const std::string& );
00067 void setLong( const std::string&, const long& );
00069 void setDouble( const std::string&, const double& );
00071 void setBool( const std::string&, const bool& );
00073 void setDay( const std::string&, const int& );
00074
00076 bool has( const std::string& ) const;
00078 void merge( const Dictionary& );
00079
00080 private:
00081 typedef std::map < std::string, std::string > Data;
00082 Data m_data;
00083 std::string m_name;
00084 };
00086 }
00087
00088 #endif //FIX_DICTIONARY_H