| 1 |
// File.h |
| 2 |
// |
| 3 |
// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2008 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 |
#ifndef INCLUDED_File_H |
| 26 |
#define INCLUDED_File_H |
| 27 |
|
| 28 |
#ifndef INCLUDED_AbstractData_H |
| 29 |
#include "AbstractData.h" |
| 30 |
#endif |
| 31 |
|
| 32 |
#ifndef INCLUDED_VECTOR |
| 33 |
#include <vector> |
| 34 |
#define INCLUDED_VECTOR |
| 35 |
#endif |
| 36 |
|
| 37 |
#ifndef INCLUDED_MAP |
| 38 |
#include <map> |
| 39 |
#define INCLUDED_MAP |
| 40 |
#endif |
| 41 |
|
| 42 |
#include <string> |
| 43 |
|
| 44 |
using namespace rude::config; |
| 45 |
|
| 46 |
namespace rude{ |
| 47 |
namespace config{ |
| 48 |
|
| 49 |
class Section; |
| 50 |
|
| 51 |
class File: public AbstractData{ |
| 52 |
|
| 53 |
private: |
| 54 |
Section *d_currentSection; |
| 55 |
mutable std::vector<Section*> d_sections; |
| 56 |
mutable std::map<std::string, Section*> d_sectionmap; |
| 57 |
|
| 58 |
public: |
| 59 |
|
| 60 |
File(); |
| 61 |
~File(); |
| 62 |
void acceptWriter(AbstractWriter& writer) const; |
| 63 |
void clear(); |
| 64 |
const char * getStringValue(const char *name) const; |
| 65 |
bool deleteData(const char *name); |
| 66 |
void setStringValue(const char *name, const char *value); |
| 67 |
int getNumDataMembers() const; |
| 68 |
|
| 69 |
int getNumSourceDestMembers() const; |
| 70 |
const char *getSrcObjAt(int index) const; |
| 71 |
const char *getDestObjAt(int index) const; |
| 72 |
const char *getSrcAppAt(int index) const; |
| 73 |
const char *getDestAppAt(int index) const; |
| 74 |
const char *getWidthAt(int index) const; |
| 75 |
/* remedius |
| 76 |
*/ |
| 77 |
const char *getCommTypeAt(int index) const; |
| 78 |
/* remedius |
| 79 |
*/ |
| 80 |
const char *getProcMethodAt(int index) const; |
| 81 |
|
| 82 |
const char *getDataNameAt(int index) const; |
| 83 |
const char *getDataValueAt(int index) const; |
| 84 |
bool exists(const char *name) const; |
| 85 |
int getNumSections() const; |
| 86 |
const char *getSectionNameAt(int index) const; |
| 87 |
bool setSection(const char *sectionname, bool shouldCreate); |
| 88 |
bool deleteSection(const char *sectionname); |
| 89 |
|
| 90 |
Section *getSection(const char *sectionname); |
| 91 |
|
| 92 |
}; |
| 93 |
|
| 94 |
}} // end namespace rude::config |
| 95 |
|
| 96 |
#endif |
| 97 |
|