1 // RealOrganiser.cc
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 #include "RealOrganiser.h"
25 
26 #ifndef INCLUDED_File_H
27 #include "File.h"
28 #endif
29 
30 #ifndef INCLUDED_Section_H
31 #include "Section.h"
32 #endif
33 
34 using namespace std;
35 
36 namespace rude{
37 namespace config{
38 
RealOrganiser(File * file)39 RealOrganiser::RealOrganiser(File *file)
40 {
41 	d_file = file;
42 	d_section = d_file->getSection("");
43 }
44 
foundSection(const char * sectionName,const char * comment)45 void RealOrganiser::foundSection(const char *sectionName, const char *comment)
46 {
47 	d_section = d_file->getSection(sectionName);
48 	d_section->setSectionComment(comment);
49 }
50 
foundComment(const char * comment)51 void RealOrganiser::foundComment(const char *comment)
52 {
53 	d_section->addComment(comment);
54 }
55 
foundWhiteSpace(const char * whitespace)56 void RealOrganiser::foundWhiteSpace(const char *whitespace)
57 {
58 	d_section->addWhiteSpace(whitespace);
59 }
60 
foundData(const char * key,const char * value,const char * comment)61 void RealOrganiser::foundData(const char *key, const char *value, const char *comment)
62 {
63 	d_section->setValue(key, value, comment);
64 }
65 
66 }} // end namespaces
67 
68