Orxonox  0.0.5 Codename: Arcturus
ConfigFileEntryValue.h
Go to the documentation of this file.
1 /*
2  * ORXONOX - the hottest 3D action shooter ever to exist
3  * > www.orxonox.net <
4  *
5  *
6  * License notice:
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program 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 this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  * Author:
23  * Fabian 'x3n' Landau
24  * Co-authors:
25  * ...
26  *
27  */
28 
34 #ifndef _ConfigFileEntryValue_H__
35 #define _ConfigFileEntryValue_H__
36 
37 #include "core/CorePrereqs.h"
38 
39 #include <string>
40 #include "ConfigFileEntry.h"
41 
42 namespace orxonox
43 {
45  // ConfigFileEntryValue //
47 
51  {
52  public:
61  inline ConfigFileEntryValue(const std::string& name, const std::string& value = "", bool bString = false, const std::string& additionalComment = "")
62  : name_(name)
63  , value_(value)
64  , additionalComment_(additionalComment)
65  , bString_(bString)
66  { this->update(); }
67 
69  virtual inline ~ConfigFileEntryValue() = default;
70 
71  virtual inline const std::string& getName() const override
72  { return this->name_; }
73 
74  virtual inline void setComment(const std::string& comment) override
75  { this->additionalComment_ = comment; this->update(); }
76 
77  virtual inline void setValue(const std::string& value) override
78  { this->value_ = value; this->update(); }
79  virtual inline const std::string& getValue() const override
80  { return this->value_; }
81 
82  virtual inline void setString(bool bString) override
83  { this->bString_ = bString; this->update(); }
84 
85  virtual inline const std::string& getFileEntry() const override
86  { return this->fileEntry_; }
87 
89  virtual inline const std::string& getKeyString() const
90  { return this->name_; }
91 
92  protected:
93  virtual void update();
94 
99  bool bString_;
100  };
101 }
102 
103 #endif /* _ConfigFileEntryValue_H__ */
This class represents a normal value in the config file.
Definition: ConfigFileEntryValue.h:50
virtual void setValue(const std::string &value) override
Changes the value of the entry.
Definition: ConfigFileEntryValue.h:77
ConfigFileEntryValue(const std::string &name, const std::string &value="", bool bString=false, const std::string &additionalComment="")
Constructor: Initializes the entry.
Definition: ConfigFileEntryValue.h:61
Shared library macros, enums, constants and forward declarations for the core library ...
::std::string string
Definition: gtest-port.h:756
std::string additionalComment_
The additional comment.
Definition: ConfigFileEntryValue.h:97
std::string value_
The value.
Definition: ConfigFileEntryValue.h:96
virtual const std::string & getFileEntry() const override
Returns the line as it will be stored in the config file.
Definition: ConfigFileEntryValue.h:85
bool bString_
If true, the value is treated as string which means some special treatment of special characters...
Definition: ConfigFileEntryValue.h:99
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
#define _CoreExport
Definition: CorePrereqs.h:61
std::string fileEntry_
The string as it will be stored in the config file.
Definition: ConfigFileEntryValue.h:98
virtual void setString(bool bString) override
Defines if this entry is treated as string which means some special treatment of special characters...
Definition: ConfigFileEntryValue.h:82
virtual void setComment(const std::string &comment) override
Changes the comment of the entry (will be placed after the value)
Definition: ConfigFileEntryValue.h:74
internal::String name_
Definition: gtest.cc:2289
const std::string name_
The name of the value.
Definition: ConfigFileEntryValue.h:95
virtual const std::string & getName() const override
Returns the name of the entry.
Definition: ConfigFileEntryValue.h:71
virtual const std::string & getKeyString() const
Returns the "key" of the value (in this case it&#39;s just the name of the entry, but for vectors it&#39;s di...
Definition: ConfigFileEntryValue.h:89
This class represents an entry in the config file.
Definition: ConfigFileEntry.h:49
virtual const std::string & getValue() const override
Returns the value of the entry.
Definition: ConfigFileEntryValue.h:79