Debian Codegraph @

rudeconfig/src/KeyValue.cpp

raw
1 // KeyValue.cpp
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
25 #include "../config.h"
26
27 #include "KeyValue.h"
28
29 #ifndef INCLUDED_AbstractWriter_H
30 #include "AbstractWriter.h"
31 #endif
32
33 #ifndef INCLUDED_CSTDIO
34 #include <cstdio>
35 #define INCLUDED_CSTDIO
36 #endif
37
38 using namespace std;
39 namespace rude{
40 namespace config{
41
42 KeyValue::KeyValue()
43 {
44 d_name = "";
45 d_value = "";
46 d_comment = "";
47 }
48
49 KeyValue::KeyValue(const char *name, const char *value, const char *comment)
50 {
51 d_name = name ? name : "";
52 d_value = value ? value : "";
53 d_comment = comment ? comment : "";
54 }
55
56 void KeyValue::acceptWriter(AbstractWriter& writer) const
57 {
58 writer.visitKeyValue(*this);
59 }
60
61 const char *KeyValue::getName() const
62 {
63 return d_name.c_str();
64 }
65
66 const char *KeyValue::getValue() const
67 {
68 return d_value.c_str();
69 }
70
71 const char *KeyValue::getComment() const
72 {
73 return d_comment.c_str();
74 }
75
76 void KeyValue::setName(const char *name)
77 {
78 d_name = name ? name : "";
79 }
80
81 void KeyValue::setValue(const char *value)
82 {
83 d_value = value ? value : "";
84 }
85
86 void KeyValue::setComment(const char *comment)
87 {
88 d_comment = comment ? comment : "";
89 }
90
91 KeyValue::~KeyValue()
92 {
93
94 }
95 }} // end namespace rude::config
96