Dictionary.h
Go to the documentation of this file.
1/* -*- C++ -*- */
2
3/****************************************************************************
4** Copyright (c) 2001-2014
5**
6** This file is part of the QuickFIX FIX Engine
7**
8** This file may be distributed under the terms of the quickfixengine.org
9** license as defined by quickfixengine.org and appearing in the file
10** LICENSE included in the packaging of this file.
11**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14**
15** See http://www.quickfixengine.org/LICENSE for licensing information.
16**
17** Contact ask@quickfixengine.org if any conditions of this licensing are
18** not clear to you.
19**
20****************************************************************************/
21
22#ifndef FIX_DICTIONARY_H
23#define FIX_DICTIONARY_H
24
25#ifdef _MSC_VER
26#pragma warning( disable : 4503 4355 4786 4290 )
27#endif
28
29#include <map>
30#include <string>
31#include "Exceptions.h"
32
33namespace FIX
34{
37{
38public:
39 Dictionary( const std::string& name ) : m_name( name ) {}
41 virtual ~Dictionary() {}
42
43 typedef std::map < std::string, std::string > Data;
44 typedef Data::const_iterator iterator;
46
48 std::string getName() const { return m_name; }
50 size_t size() const { return m_data.size(); }
51
53 std::string getString( const std::string&, bool capitalize = false ) const
56 int getInt( const std::string& ) const
59 double getDouble( const std::string& ) const
62 bool getBool( const std::string& ) const
65 int getDay( const std::string& ) const
67
69 void setString( const std::string&, const std::string& );
71 void setInt( const std::string&, int );
73 void setDouble( const std::string&, double );
75 void setBool( const std::string&, bool );
77 void setDay( const std::string&, int );
78
80 bool has( const std::string& ) const;
82 void merge( const Dictionary& );
83
84 iterator begin() const { return m_data.begin(); }
85 iterator end() const { return m_data.end(); }
86
87private:
89 std::string m_name;
90};
92}
93
94#endif //FIX_DICTIONARY_H
For storage and retrieval of key/value pairs.
Definition Dictionary.h:37
void merge(const Dictionary &)
Merge two dictionaries.
Dictionary(const std::string &name)
Definition Dictionary.h:39
Data::const_iterator iterator
Definition Dictionary.h:44
iterator const_iterator
Definition Dictionary.h:45
iterator begin() const
Definition Dictionary.h:84
int getInt(const std::string &) const
Get a value as a int.
size_t size() const
Return the number of key/value pairs.
Definition Dictionary.h:50
std::string getName() const
Get the name of the dictionary.
Definition Dictionary.h:48
virtual ~Dictionary()
Definition Dictionary.h:41
int getDay(const std::string &) const
Get a value as a day of week.
bool getBool(const std::string &) const
Get a value as a bool.
bool has(const std::string &) const
Check if the dictionary contains a value for key.
void setInt(const std::string &, int)
Set a value from a int.
std::string getString(const std::string &, bool capitalize=false) const
Get a value as a string.
void setBool(const std::string &, bool)
Set a value from a bool.
void setDay(const std::string &, int)
Set a value from a day.
double getDouble(const std::string &) const
Get a value as a double.
void setString(const std::string &, const std::string &)
Set a value from a string.
void setDouble(const std::string &, double)
Set a value from a double.
iterator end() const
Definition Dictionary.h:85
std::string m_name
Definition Dictionary.h:89
std::map< std::string, std::string > Data
Definition Dictionary.h:43
Application is not configured correctly
Definition Exceptions.h:88
Unable to convert field into its native format.
Definition Exceptions.h:67

Generated on Fri Sep 27 2024 13:45:21 for QuickFIX by doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2001