Index Source Files Annotated Class List Alphabetical Class List Class Hierarchy Graphical Class Hierarchy

# Dictionary.h

Go to the documentation of this file.

    00001 /* -*- C++ -*- */
    00002
    00003 /****************************************************************************
    00004 ** Copyright (c) quickfixengine.org  All rights reserved.
    00005 **
    00006 ** This file is part of the QuickFIX FIX Engine
    00007 **
    00008 ** This file may be distributed under the terms of the quickfixengine.org
    00009 ** license as defined by quickfixengine.org and appearing in the file
    00010 ** LICENSE included in the packaging of this file.
    00011 **
    00012 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
    00013 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
    00014 **
    00015 ** See http://www.quickfixengine.org/LICENSE for licensing information.
    00016 **
    00017 ** Contact ask@quickfixengine.org if any conditions of this licensing are
    00018 ** not clear to you.
    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