Dictionary.h
Go to the documentation of this file.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
00043 typedef std::map < std::string, std::string > Data;
00044 typedef Data::const_iterator iterator;
00045 typedef iterator const_iterator;
00046
00048 std::string getName() const { return m_name; }
00050 int size() const { return m_data.size(); }
00051
00053 std::string getString( const std::string&, bool capitalize = false ) const
00054 throw( ConfigError, FieldConvertError );
00056 long getLong( const std::string& ) const
00057 throw( ConfigError, FieldConvertError );
00059 double getDouble( const std::string& ) const
00060 throw( ConfigError, FieldConvertError );
00062 bool getBool( const std::string& ) const
00063 throw( ConfigError, FieldConvertError );
00065 int getDay( const std::string& ) const
00066 throw( ConfigError, FieldConvertError );
00067
00069 void setString( const std::string&, const std::string& );
00071 void setLong( const std::string&, long );
00073 void setDouble( const std::string&, double );
00075 void setBool( const std::string&, bool );
00077 void setDay( const std::string&, int );
00078
00080 bool has( const std::string& ) const;
00082 void merge( const Dictionary& );
00083
00084 iterator begin() const { return m_data.begin(); }
00085 iterator end() const { return m_data.end(); }
00086
00087 private:
00088 Data m_data;
00089 std::string m_name;
00090 };
00092 }
00093
00094 #endif //FIX_DICTIONARY_H