FIX::Parser Class Reference

Parses FIX messages off an input stream. More...

`#include <Parser.h>`

## Public Member Functions

| Parser ()
| ~Parser ()
bool | extractLength (int &length, std::string::size_type &pos, const std::string &buffer) throw ( MessageParseError )
bool | readFixMessage (std::string &str) throw ( MessageParseError )
void | addToStream (const char *str, size_t len)
void | addToStream (const std::string &str)

## Private Attributes

std::string | m_buffer

## Detailed Description

Parses FIX messages off an input stream.

Definition at line 53 of file Parser.h.

## Constructor & Destructor Documentation

## Parser()

FIX::Parser::Parser | ( |  | ) |

inline

Definition at line 73 of file Parser.h.

## ~Parser()

FIX::Parser::~Parser | ( |  | ) |

inline

Definition at line 74 of file Parser.h.

## Member Function Documentation

## addToStream() [1/2]

void FIX::Parser::addToStream | ( | const char * | str,
|  | size_t | len
| ) |  |

inline

Definition at line 82 of file Parser.h.

## addToStream() [2/2]

void FIX::Parser::addToStream | ( | const std::string & | str | ) |

inline

Definition at line 84 of file Parser.h.

## extractLength()

bool FIX::Parser::extractLength | ( | int & | length,
|  | std::string::size_type & | pos,
|  | const std::string & | buffer
| ) |  |
throw | ( | MessageParseError
| ) |  |

Definition at line 50 of file Parser.cpp.

{ throw MessageParseError(); }
pos = endPos + 1;
return true;
}
bool Parser::readFixMessage( std::string& str )
throw( MessageParseError )
{
std::string::size_type pos = 0;
if( m_buffer.length() < 2 ) return false;
pos = m_buffer.find( "8=" );
if( pos == std::string::npos ) return false;
m_buffer.erase( 0, pos );
int length = 0;
try
{
if( extractLength(length, pos, m_buffer) )
{

## readFixMessage()

bool FIX::Parser::readFixMessage | ( | std::string & | str | ) |
throw | ( | MessageParseError
| ) |  |

Definition at line 76 of file Parser.cpp.

{
if( length > 0 )
m_buffer.erase( 0, pos + length );
else
m_buffer.erase();
throw e;
}
return false;
}
}

Referenced by FIX::SocketConnection::isValidSession().

## Member Data Documentation

## m_buffer

std::string FIX::Parser::m_buffer

private

Definition at line 88 of file Parser.h.

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

- Parser.h
- Parser.cpp

FIX::Parser::extractLength
bool extractLength(int &length, std::string::size_type &pos, const std::string &buffer)
Definition: Parser.cpp:50
FIX::Parser::m_buffer
std::string m_buffer
Definition: Parser.h:88
FIX::Parser::readFixMessage
bool readFixMessage(std::string &str)
Definition: Parser.cpp:76