LibOFX
ofx_aggregate.hh
Go to the documentation of this file.
00001 /***************************************************************************
00002                           ofx_aggregate.hh
00003                              -------------------
00004     copyright            : (C) 2005 by Ace Jones
00005     email                : acejones@users.sourceforge.net
00006 ***************************************************************************/
00011 /***************************************************************************
00012  *                                                                         *
00013  *   This program is free software; you can redistribute it and/or modify  *
00014  *   it under the terms of the GNU General Public License as published by  *
00015  *   the Free Software Foundation; either version 2 of the License, or     *
00016  *   (at your option) any later version.                                   *
00017  *                                                                         *
00018  ***************************************************************************/
00019 
00020 #ifndef OFX_AGGREGATE_H
00021 #define OFX_AGGREGATE_H
00022 
00023 #include <string>
00024 
00025 using namespace std;
00026 
00042 class OfxAggregate
00043 {
00044 public:
00050   OfxAggregate( const string& tag ): m_tag( tag )
00051   {}
00052 
00059   void Add( const string& tag, const string& data )
00060   {
00061     m_contents += string("<") + tag + string(">") + data + string("\r\n");
00062   }
00063 
00069   void Add( const OfxAggregate& sub )
00070   {
00071     m_contents += sub.Output();
00072   }
00073 
00079   string Output( void ) const
00080   {
00081     return string("<") + m_tag + string(">\r\n") + m_contents + string("</") + m_tag + string(">\r\n");
00082   }
00083 
00084 private:
00085   string m_tag;
00086   string m_contents;
00087 };
00088 
00089 #endif // OFX_AGGREGATE_H