Parser.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* -*- C++ -*- */
  2. /****************************************************************************
  3. ** Copyright (c) 2001-2014
  4. **
  5. ** This file is part of the QuickFIX FIX Engine
  6. **
  7. ** This file may be distributed under the terms of the quickfixengine.org
  8. ** license as defined by quickfixengine.org and appearing in the file
  9. ** LICENSE included in the packaging of this file.
  10. **
  11. ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  12. ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  13. **
  14. ** See http://www.quickfixengine.org/LICENSE for licensing information.
  15. **
  16. ** Contact ask@quickfixengine.org if any conditions of this licensing are
  17. ** not clear to you.
  18. **
  19. ****************************************************************************/
  20. #ifndef FIX_PARSER_H
  21. #define FIX_PARSER_H
  22. #ifdef _MSC_VER
  23. #pragma warning( disable : 4503 4355 4786 4290 )
  24. #endif
  25. #include "Exceptions.h"
  26. #include <iostream>
  27. #include <string>
  28. namespace FIX
  29. {
  30. /// Parses %FIX messages off an input stream.
  31. class Parser
  32. {
  33. public:
  34. Parser() {}
  35. ~Parser() {}
  36. bool extractLength( int& length, std::string::size_type& pos,
  37. const std::string& buffer )
  38. throw ( MessageParseError );
  39. bool readFixMessage( std::string& str )
  40. throw ( MessageParseError );
  41. void addToStream( const char* str, size_t len )
  42. { m_buffer.append( str, len ); }
  43. void addToStream( const std::string& str )
  44. { m_buffer.append( str ); }
  45. private:
  46. std::string m_buffer;
  47. };
  48. }
  49. #endif //FIX_PARSER_H