LibOFX
ofx_aggregate.hh
Go to the documentation of this file.
1 /***************************************************************************
2  ofx_aggregate.hh
3  -------------------
4  copyright : (C) 2005 by Ace Jones
5  email : acejones@users.sourceforge.net
6 ***************************************************************************/
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  ***************************************************************************/
19 
20 #ifndef OFX_AGGREGATE_H
21 #define OFX_AGGREGATE_H
22 
23 #include <string>
24 
41 {
42 public:
48  OfxAggregate( const std::string& tag ): m_tag( tag )
49  {}
50 
57  void Add( const std::string& tag, const std::string& data )
58  {
59  m_contents += std::string("<") + tag + std::string(">") + data + std::string("\r\n");
60  }
61 
68  void AddXml( const std::string& tag, const std::string& data )
69  {
70  m_contents += std::string("<") + tag + std::string(">") + data + std::string("</") + tag + std::string(">") + std::string("\r\n");
71  }
72 
78  void Add( const OfxAggregate& sub )
79  {
80  m_contents += sub.Output();
81  }
82 
88  std::string Output( void ) const
89  {
90  return std::string("<") + m_tag + std::string(">\r\n") + m_contents + std::string("</") + m_tag + std::string(">\r\n");
91  }
92 
93 private:
94  std::string m_tag;
95  std::string m_contents;
96 };
97 
98 #endif // OFX_AGGREGATE_H
OfxAggregate::Add
void Add(const std::string &tag, const std::string &data)
Definition: ofx_aggregate.hh:64
OfxAggregate
A single aggregate as described in the OFX 1.02 specification.
Definition: ofx_aggregate.hh:40
OfxAggregate::AddXml
void AddXml(const std::string &tag, const std::string &data)
Definition: ofx_aggregate.hh:75
OfxAggregate::OfxAggregate
OfxAggregate(const std::string &tag)
Definition: ofx_aggregate.hh:55
OfxAggregate::Output
std::string Output(void) const
Definition: ofx_aggregate.hh:95