CPPSERV


Home Projects Jobs Clientele Contact
CPPSERV Documentation Download TODO Mailing lists Bug tracker News RSS Feed Browse source

Generator.h

Go to the documentation of this file.
00001 /*
00002  *  Copyright (C) 2008-2009, 2011 Ilya A. Volynets-Evenbach <ilya@total-knowledge.com>
00003  *  Copyright (C) 2005 Krzysztof Rzymkowski <rzymek@users.sourceforge.net>
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; version 2 of the License.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00017  */
00018 
00019 #ifndef TAG_GENERATOR_H
00020 #define TAG_GENERATOR_H
00021 
00022 #include <iostream>
00023 #include <map>
00024 #include <string>
00025 #include "Taglib.h"
00026 
00027 namespace servlet
00028 {
00029 namespace taglib
00030 {
00031 
00043 class Generator {
00044 protected:
00045     std::iostream *body, *header, *member;
00046     std::iostream *m_child_body, *m_child_header, *m_child_member;
00047     Generator* parent;
00048     std::string m_name;
00049 public:
00050     typedef servlet::taglib::attribs_t attribs_t;
00051 
00052     Generator(const std::string& name)
00053             : parent(0)
00054             , m_name(name)
00055         {}
00056     virtual ~Generator()
00057         {}
00060     void setBuffers(std::iostream& body, std::iostream& header, std::iostream& member)
00061         { this->body = &body; this->header = &header; this->member = &member; }
00068     virtual void initChildBuffers()
00069         { m_child_body = body; m_child_header =  header; m_child_member = member; }
00075     virtual void doStartTag(const attribs_t& attribs) = 0;
00078     virtual void doEndTag() = 0;
00081     virtual void setParent(Generator* gen)
00082         { parent = gen; }
00085     std::string getName()
00086         { return m_name; }
00087 
00090     std::iostream* child_body() { return m_child_body; }
00091 
00094     std::iostream* child_member() { return m_child_member; }
00095 
00098     std::iostream* child_header() { return m_child_header; }
00099 
00100 };
00101 
00102 } // namespace taglib
00103 } // namespace servlet
00104 
00105 #endif//GENERATOR_H
00106 

SourceForge.net Logo