diff options
author | Tomek Mrugalski <tomasz@isc.org> | 2016-12-27 19:25:31 +0100 |
---|---|---|
committer | Tomek Mrugalski <tomasz@isc.org> | 2016-12-27 19:25:31 +0100 |
commit | 3cd100455bcc20698cfb314ffe41fb755d04aee1 (patch) | |
tree | f3f51046183e84d2a6a43dc40b7b5760f3b3839c /src/lib/cc/data.cc | |
parent | [master] Added Changelog entry 1200 for 3238 (diff) | |
parent | [5039] spelling (and a ~ file) (diff) | |
download | kea-3cd100455bcc20698cfb314ffe41fb755d04aee1.tar.xz kea-3cd100455bcc20698cfb314ffe41fb755d04aee1.zip |
[master] Merge branch 'trac5039' (SimpleParser)
# Conflicts:
# src/bin/dhcp4/Makefile.am
# src/bin/dhcp4/json_config_parser.cc
# src/bin/dhcp6/Makefile.am
# src/bin/dhcp6/dhcp6.dox
# src/bin/dhcp6/json_config_parser.cc
# src/bin/dhcp6/tests/Makefile.am
Diffstat (limited to 'src/lib/cc/data.cc')
-rw-r--r-- | src/lib/cc/data.cc | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/lib/cc/data.cc b/src/lib/cc/data.cc index a54f812385..417b67fbff 100644 --- a/src/lib/cc/data.cc +++ b/src/lib/cc/data.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2010-2015 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2010-2016 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -86,7 +86,7 @@ Element::getValue(std::string&) const { } bool -Element::getValue(std::vector<ConstElementPtr>&) const { +Element::getValue(std::vector<ElementPtr>&) const { return (false); } @@ -116,7 +116,7 @@ Element::setValue(const std::string&) { } bool -Element::setValue(const std::vector<ConstElementPtr>&) { +Element::setValue(const std::vector<ElementPtr>&) { return (false); } @@ -130,13 +130,18 @@ Element::get(const int) const { throwTypeError("get(int) called on a non-list Element"); } +ElementPtr +Element::getNonConst(const int) const { + throwTypeError("get(int) called on a non-list Element"); +} + void -Element::set(const size_t, ConstElementPtr) { +Element::set(const size_t, ElementPtr) { throwTypeError("set(int, element) called on a non-list Element"); } void -Element::add(ConstElementPtr) { +Element::add(ElementPtr) { throwTypeError("add() called on a non-list Element"); } @@ -507,7 +512,7 @@ fromStringstreamList(std::istream& in, const std::string& file, int& line, { int c = 0; ElementPtr list = Element::createList(Element::Position(file, line, pos)); - ConstElementPtr cur_list_element; + ElementPtr cur_list_element; skipChars(in, WHITESPACE, line, pos); while (c != EOF && c != ']') { @@ -810,8 +815,8 @@ void ListElement::toJSON(std::ostream& ss) const { ss << "[ "; - const std::vector<ConstElementPtr>& v = listValue(); - for (std::vector<ConstElementPtr>::const_iterator it = v.begin(); + const std::vector<ElementPtr>& v = listValue(); + for (std::vector<ElementPtr>::const_iterator it = v.begin(); it != v.end(); ++it) { if (it != v.begin()) { ss << ", "; @@ -1079,5 +1084,14 @@ void Element::preprocess(std::istream& in, std::stringstream& out) { } } +ElementPtr Element::getMutableMap(ConstElementPtr& const_map) { + std::map<std::string, ConstElementPtr> values; + const_map->getValue(values); + ElementPtr mutable_map(new MapElement()); + mutable_map->setValue(values); + + return (mutable_map); +} + } } |