32 Path::Path() : rootIdentifier(DEFAULT_ROOT_IDENTIFIER), delimeter(DEFAULT_DELIMETER)
37 rootIdentifier(DEFAULT_ROOT_IDENTIFIER), delimeter(DEFAULT_DELIMETER), path(p)
42 rootIdentifier(p.getRootIdentifier()), delimeter(p.getDelimeter()), path(p.getPath())
48 for (
const std::string&
s : p)
63 return rootIdentifier;
79 Path::append(
const std::string&
str)
84 std::vector<std::string>
96 "Try to access last element of empty vector.");
107 "Try to access last element of empty vector.");
115 return path.size() > 0;
127 std::stringstream ss;
128 ss << rootIdentifier;
129 for (
const std::string&
s : path)
131 ss << delimeter <<
s;
138 const std::string& rootIdentifier,
139 const std::string& delimeter)
144 elements[0] = simox::alg::remove_prefix(elements[0], rootIdentifier);
146 return Path(elements);
155 el =
"\"" + el +
"\"";
157 return Path(*
this, {el});
166 el =
"\"" + el +
"\"";
168 return Path(*
this, {el});
174 std::string el =
"::accepted_type";
177 el =
"\"" + el +
"\"";
179 return Path(*
this, {el});
188 el =
"\"" + el +
"\"";
190 return Path(*
this, {el});
196 std::vector<std::string> p = path;
199 ret.setRootIdentifier(rootIdentifier);
200 ret.setDelimeter(delimeter);
207 std::vector<std::string> p = path;
210 ret.setRootIdentifier(rootIdentifier);
211 ret.setDelimeter(delimeter);
218 unsigned int firstWithoutMatch = 0;
219 for (
const std::string& el : pref.
getPath())
221 if (path.size() <= firstWithoutMatch || el != path[firstWithoutMatch])
230 std::vector<std::string> elementsWithoutPrefix(path.begin() + firstWithoutMatch,
233 auto ret =
Path(elementsWithoutPrefix);
234 ret.setRootIdentifier(rootIdentifier);
235 ret.setDelimeter(delimeter);
244 if (path.size() < p.size())
251 for (
const auto& el : path)
266 if (p.size() + 1 != path.size())