nis-util
1.0.D108
|
00001 // 00002 // nis-util - NIS Administration Utilities 00003 // Copyright (C) 2012 Peter Miller 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 2 of the License, or (at 00008 // your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License along 00016 // with this program. If not, see <http://www.gnu.org/licenses/>. 00017 // 00018 00019 #ifndef LIB_CONFIGURATION_SECTION_H 00020 #define LIB_CONFIGURATION_SECTION_H 00021 00022 #include <map> 00023 #include <lib/configuration/item.h> 00024 00025 #define SECTION_GLOBAL "" 00026 #define SECTION_PASSWD "passwd" 00027 #define SECTION_GROUP "group" 00028 00033 class configuration_section 00034 { 00035 public: 00036 typedef boost::shared_ptr<configuration_section> pointer; 00037 00038 typedef configuration_item::level_t level_t; 00039 00043 virtual ~configuration_section(); 00044 00052 static pointer create(const rcstring &name); 00053 00063 rcstring get_string_value(const rcstring &item_name) const; 00064 00074 bool get_bool_value(const rcstring &item_name) const; 00075 00085 long get_long_value(const rcstring &item_name) const; 00086 00092 void set(const configuration_item::pointer &item); 00093 00101 bool is_set(const rcstring &item_name) const; 00102 00107 void print(void) const; 00108 00109 private: 00117 configuration_section(const rcstring &name); 00118 00123 rcstring name; 00124 00125 typedef std::map<rcstring, configuration_item::pointer> items_t; 00126 00131 items_t items; 00132 00137 configuration_section(); 00138 00146 configuration_section(const configuration_section &rhs); 00147 00155 configuration_section &operator=(const configuration_section &rhs); 00156 }; 00157 00158 // vim: set ts=8 sw=4 et : 00159 #endif // LIB_CONFIGURATION_SECTION_H