Public Types | Public Member Functions | Private Attributes | Friends | List of all members
FIX::Settings Class Reference

Internal representation of QuickFIX configuration settings. More...

#include <Settings.h>

Public Types

typedef std::vector< DictionarySections
 

Public Member Functions

 Settings (bool resolveEnvVars=false)
 
Sections get (const std::string &name) const
 

Private Attributes

Sections m_sections
 
bool m_resolveEnvVars
 

Friends

std::istream & operator>> (std::istream &, Settings &)
 

Detailed Description

Internal representation of QuickFIX configuration settings.

Definition at line 38 of file Settings.h.

Member Typedef Documentation

◆ Sections

typedef std::vector< Dictionary > FIX::Settings::Sections

Definition at line 43 of file Settings.h.

Constructor & Destructor Documentation

◆ Settings()

FIX::Settings::Settings ( bool  resolveEnvVars = false)
inline

Definition at line 41 of file Settings.h.

bool m_resolveEnvVars
Definition Settings.h:50
std::string resolveEnvVars(const std::string &str)
Definition Settings.cpp:65

Member Function Documentation

◆ get()

Settings::Sections FIX::Settings::get ( const std::string &  name) const

Definition at line 162 of file Settings.cpp.

163{
164 Sections sections;
165 for ( Sections::size_type i = 0; i < m_sections.size(); ++i )
166 if ( m_sections[ i ].getName() == name )
167 sections.push_back( m_sections[ i ] );
168 return sections;
169}
std::vector< Dictionary > Sections
Definition Settings.h:43
Sections m_sections
Definition Settings.h:49

References m_sections.

Friends And Related Symbol Documentation

◆ operator>>

std::istream & operator>> ( std::istream &  ,
Settings  
)
friend

Definition at line 134 of file Settings.cpp.

135{
136 char buffer[1024];
137 std::string line;
138 Settings::Sections::iterator section = s.m_sections.end();;
139
140 while( stream.getline(buffer, sizeof(buffer)) )
141 {
142 line = string_strip( buffer );
143 if( isComment(line) )
144 {
145 continue;
146 }
147 else if( isSection(line) )
148 {
149 section = s.m_sections.insert( s.m_sections.end(), Dictionary(splitSection(line)) );
150 }
151 else if( isKeyValue(line) )
152 {
153 std::pair<std::string, std::string> keyValue = splitKeyValue( line );
154 if( section == s.m_sections.end() )
155 continue;
156 (*section).setString( keyValue.first, s.m_resolveEnvVars ? resolveEnvVars(keyValue.second) : keyValue.second );
157 }
158 }
159 return stream;
160}
std::string string_strip(const std::string &value)
Definition Utility.cpp:67
bool isComment(const std::string &line)
Definition Settings.cpp:31
std::string splitSection(const std::string &line)
Definition Settings.cpp:47
std::pair< std::string, std::string > splitKeyValue(const std::string &line)
Definition Settings.cpp:57
bool isKeyValue(const std::string &line)
Definition Settings.cpp:52
bool isSection(const std::string &line)
Definition Settings.cpp:39

Member Data Documentation

◆ m_resolveEnvVars

bool FIX::Settings::m_resolveEnvVars
private

Definition at line 50 of file Settings.h.

◆ m_sections

Sections FIX::Settings::m_sections
private

Definition at line 49 of file Settings.h.

Referenced by get().


The documentation for this class was generated from the following files:

Generated on Mon Oct 14 2024 06:04:44 for QuickFIX by doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2001