A Discrete-Event Network Simulator
API
raw-text-config.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 INRIA
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Mathieu Lacage <mathieu.lacage@cutebugs.net>
18  */
19 
20 #ifndef RAW_TEXT_CONFIG_H
21 #define RAW_TEXT_CONFIG_H
22 
23 #include "file-config.h"
24 
25 #include <fstream>
26 #include <string>
27 
28 namespace ns3
29 {
30 
37 {
38  public:
40  ~RawTextConfigSave() override;
41  // Inherited
42  void SetFilename(std::string filename) override;
43  void Default() override;
44  void Global() override;
45  void Attributes() override;
46 
47  private:
49  std::ofstream* m_os;
50 };
51 
58 {
59  public:
61  ~RawTextConfigLoad() override;
62  // Inherited
63  void SetFilename(std::string filename) override;
64  void Default() override;
65  void Global() override;
66  void Attributes() override;
67 
68  private:
81  virtual bool ParseLine(const std::string& line,
82  std::string& type,
83  std::string& name,
84  std::string& value);
85 
91  std::string Strip(std::string value);
93  std::ifstream* m_is;
94 };
95 
96 } // namespace ns3
97 
98 #endif /* RAW_TEXT_CONFIG_H */
base class for ConfigStore classes using files
Definition: file-config.h:34
A class to enable loading of configuration store from a raw text file.
void SetFilename(std::string filename) override
Set the file name.
void Attributes() override
Load or save the attributes values.
RawTextConfigLoad()
default constructor
virtual bool ParseLine(const std::string &line, std::string &type, std::string &name, std::string &value)
Parse (potentially multi-) line configs into type, name, and values.
void Global() override
Load or save the global values.
std::ifstream * m_is
Config store input stream.
std::string Strip(std::string value)
Strip out attribute value.
void Default() override
Load or save the default values.
~RawTextConfigLoad() override
destructor
A class to enable saving of configuration store in a raw text file.
std::ofstream * m_os
Config store output stream.
void Attributes() override
Load or save the attributes values.
void Global() override
Load or save the global values.
RawTextConfigSave()
default constructor
~RawTextConfigSave() override
destructor
void SetFilename(std::string filename) override
Set the file name.
void Default() override
Load or save the default values.
Every class exported by the ns3 library is enclosed in the ns3 namespace.