13#include <boost/algorithm/string/classification.hpp>
14#include <boost/algorithm/string/constants.hpp>
15#include <boost/algorithm/string/split.hpp>
27 std::vector<std::string> split_text;
28 boost::split(split_text, class_names, boost::is_any_of(
","),
29 boost::algorithm::token_compress_off);
30 for (
size_t i = 0; i < split_text.size(); ++i) {
33 if (!trimmed.empty()) {
40 for (
auto const& cclass : other) {
48 auto it = idx.find(class_name);
49 if (it != idx.end()) {
50 static_cast<void>(idx.erase(it));
57 return (idx.count(x) != 0);
62 if (cclasses.size() >
size()) {
63 for (
const auto& cclass : *
this) {
64 if (cclasses.contains(cclass)) {
69 for (
const auto& cclass : cclasses) {
83 for (
auto const& class_it : *
this) {
97 for (
auto const& c : container_) {
111 for (
auto i = 0; i < cc_list->size(); ++i) {
112 auto cclass = cc_list->get(i);
117 static_cast<void>(
insert(cclass->stringValue()));
124 return ((
size() == other.size()) && std::equal(
cbegin(),
cend(), other.cbegin()));
130 for (
auto const& cclass : other) {
Defines elements for storing the names of client classes.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
static ElementPtr create(const Position &pos=ZERO_POSITION())
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
Container for storing client class names.
bool equals(const ClientClasses &other) const
Compares two ClientClasses container for equality.
void clear()
Clears containers.
bool contains(const ClientClass &x) const
returns if class x belongs to the defined classes
void insert(const ClientClass &class_name)
Insert an element.
void erase(const ClientClass &class_name)
Erase element by name.
ClientClasses & operator=(const ClientClasses &other)
Assigns the contents of on container to another.
virtual isc::data::ElementPtr toElement() const
Returns all class names as an ElementPtr of type ListElement.
void fromElement(isc::data::ConstElementPtr list)
Sets contents from a ListElement.
bool intersects(const ClientClasses &cclasses) const
returns whether this container has at least one class in common with a given container.
ClientClasses()
Default constructor.
std::string toText(const std::string &separator=", ") const
Returns all class names as text.
const_iterator cbegin() const
Iterators to the first element.
const_iterator cend() const
Iterators to the past the end element.
size_t size() const
Returns the number of classes.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
std::string ClientClass
Defines a single class name.
string trim(const string &input)
Trim leading and trailing spaces.
Defines the logger used by the top-level component of kea-lfc.