diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2010-11-09 18:38:49 -0800 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2010-11-09 18:38:49 -0800 |
commit | 1e615a4e3f3681f8bd02d49d688001d61aa8b815 (patch) | |
tree | ed5ce2367d540d5414a283e1e2b9c2e20d0239cd /src/cnode/cnode.hpp | |
parent | b8f85d2744a42eb18ac78451c29dc6de7bab5fea (diff) | |
download | vyatta-cfg-1e615a4e3f3681f8bd02d49d688001d61aa8b815.tar.gz vyatta-cfg-1e615a4e3f3681f8bd02d49d688001d61aa8b815.zip |
initial rework of config output framework
* separate data from algorithm.
* prepare for unified input/output framework.
Diffstat (limited to 'src/cnode/cnode.hpp')
-rw-r--r-- | src/cnode/cnode.hpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/cnode/cnode.hpp b/src/cnode/cnode.hpp new file mode 100644 index 0000000..3143370 --- /dev/null +++ b/src/cnode/cnode.hpp @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2010 Vyatta, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _CNODE_HPP_ +#define _CNODE_HPP_ +#include <vector> +#include <string> + +#include <cstore/cstore.hpp> + +namespace cnode { + +class CfgNode { +public: + CfgNode(Cstore& cstore, std::vector<string>& path_comps, + bool active = false, bool recursive = true); + ~CfgNode() {}; + + bool isTag() const { return _is_tag; } + bool isLeaf() const { return _is_leaf; } + bool isMulti() const { return _is_multi; } + bool isValue() const { return _is_value; } + bool isDefault() const { return _is_default; } + bool isDeactivated() const { return _is_deactivated; } + bool isLeafTypeless() const { return _is_leaf_typeless; } + bool isInvalid() const { return _is_invalid; } + bool isEmpty() const { return _is_empty; } + + const std::string& getName() const { return _name; } + const std::string& getValue() const { return _value; } + const std::vector<std::string>& getValues() const { return _values; } + const std::string& getComment() const { return _comment; } + const std::vector<CfgNode *>& getTagValues() const { return _tag_values; } + const std::vector<CfgNode *>& getChildNodes() const { return _child_nodes; } + +private: + bool _is_tag; + bool _is_leaf; + bool _is_multi; + bool _is_value; + bool _is_default; + bool _is_deactivated; + bool _is_leaf_typeless; + bool _is_invalid; + bool _is_empty; + std::string _name; + std::string _value; + std::vector<std::string> _values; + std::string _comment; + std::vector<CfgNode *> _tag_values; + std::vector<CfgNode *> _child_nodes; +}; + +} // namespace cnode + +#endif /* _CNODE_HPP_ */ + |