| 1 |
// AbstractWriter.h |
| 2 |
// |
| 3 |
// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Matthew Flood |
| 4 |
// See file AUTHORS for contact information |
| 5 |
// |
| 6 |
// This file is part of RudeConfig. |
| 7 |
// |
| 8 |
// RudeConfig is free software; you can redistribute it and/or modify |
| 9 |
// it under the terms of the GNU General Public License as published by |
| 10 |
// the Free Software Foundation; either version 2, or (at your option) |
| 11 |
// any later version. |
| 12 |
// |
| 13 |
// RudeConfig is distributed in the hope that it will be useful, |
| 14 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
// GNU General Public License for more details. |
| 17 |
// |
| 18 |
// You should have received a copy of the GNU General Public License |
| 19 |
// along with RudeConfig; (see COPYING) if not, write to the Free Software |
| 20 |
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 21 |
// 02111-1307, USA. |
| 22 |
//------------------------------------------------------------------------ |
| 23 |
|
| 24 |
#ifndef INCLUDED_AbstractWriter_H |
| 25 |
#define INCLUDED_AbstractWriter_H |
| 26 |
|
| 27 |
#ifndef INCLUDED_STRING |
| 28 |
#include <string> |
| 29 |
#define INCLUDED_STRING |
| 30 |
#endif |
| 31 |
|
| 32 |
namespace rude{ |
| 33 |
namespace config{ |
| 34 |
|
| 35 |
class File; |
| 36 |
class Section; |
| 37 |
class KeyValue; |
| 38 |
class Comment; |
| 39 |
class WhiteSpace; |
| 40 |
|
| 41 |
class AbstractWriter{ |
| 42 |
|
| 43 |
|
| 44 |
protected: |
| 45 |
|
| 46 |
char d_commentchar; |
| 47 |
char d_delimiter; |
| 48 |
bool d_preservedeleted; |
| 49 |
bool d_preservecomments; |
| 50 |
bool d_preservewhitespace; |
| 51 |
|
| 52 |
std::ostream *d_outputstream; |
| 53 |
|
| 54 |
AbstractWriter(); |
| 55 |
|
| 56 |
public: |
| 57 |
|
| 58 |
virtual void visitFile(const File& configfile) const = 0; |
| 59 |
virtual void visitSection(const Section& configsection) const = 0; |
| 60 |
virtual void visitKeyValue(const KeyValue& dataline) const = 0; |
| 61 |
virtual void visitComment(const Comment& comment) const = 0; |
| 62 |
virtual void visitWhiteSpace(const WhiteSpace& whitespace) const = 0; |
| 63 |
|
| 64 |
void setOutputStream( std::ostream& stream); |
| 65 |
void setCommentChar(char); |
| 66 |
void setDelimiter(char); |
| 67 |
void preserveDeleted(bool doit); |
| 68 |
void preserveComments(bool doit); |
| 69 |
void preserveWhiteSpace(bool doit); |
| 70 |
|
| 71 |
virtual ~AbstractWriter(); |
| 72 |
|
| 73 |
}; |
| 74 |
|
| 75 |
|
| 76 |
}} // end namespaces |
| 77 |
|
| 78 |
#endif |
| 79 |
|