DOMDocument.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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_DOMDOCUMENT_H
  21. #define FIX_DOMDOCUMENT_H
  22. #include <string>
  23. #include <map>
  24. #include <iostream>
  25. #include <memory>
  26. namespace FIX
  27. {
  28. /// Interface that represents attribute from underlying XML parser.
  29. class DOMAttributes
  30. {
  31. public:
  32. typedef std::map<std::string, std::string> map;
  33. virtual ~DOMAttributes() {}
  34. virtual bool get( const std::string&, std::string& ) = 0;
  35. virtual map toMap() = 0;
  36. };
  37. typedef std::auto_ptr<DOMAttributes> DOMAttributesPtr;
  38. /// Interface that represents node from underlying XML parser.
  39. class DOMNode
  40. {
  41. public:
  42. virtual ~DOMNode() {}
  43. virtual std::auto_ptr<DOMNode> getFirstChildNode() = 0;
  44. virtual std::auto_ptr<DOMNode> getNextSiblingNode() = 0;
  45. virtual std::auto_ptr<DOMAttributes> getAttributes() = 0;
  46. virtual std::string getName() = 0;
  47. virtual std::string getText() = 0;
  48. };
  49. typedef std::auto_ptr<DOMNode> DOMNodePtr;
  50. /// Interface that represents document of underlying XML parser.
  51. class DOMDocument
  52. {
  53. public:
  54. virtual ~DOMDocument() {}
  55. virtual bool load( std::istream& ) = 0;
  56. virtual bool load( const std::string& ) = 0;
  57. virtual bool xml( std::ostream& ) = 0;
  58. virtual std::auto_ptr<DOMNode> getNode( const std::string& ) = 0;
  59. };
  60. typedef std::auto_ptr<DOMDocument> DOMDocumentPtr;
  61. }
  62. #endif