2 #include <samchon/API.hpp> 4 #include <samchon/HashMap.hpp> 5 #include <samchon/library/XMLList.hpp> 9 #include <samchon/WeakString.hpp> 13 template<
class T,
class _Alloc>
class list;
72 class SAMCHON_FRAMEWORK_API
XML 73 :
public HashMap<std::string, std::shared_ptr<XMLList>>
176 void push_back(
const std::shared_ptr<XML>);
187 void addAllProperty(
const std::shared_ptr<XML>);
197 void setTag(
const std::string &);
228 template <
typename T>
231 std::stringstream sstream;
234 this->value = std::move(sstream.str());
236 template<>
void setValue(
const std::string &val)
240 template<>
void setValue(
const WeakString &val)
242 this->value = val.
str();
245 template <
typename T>
246 void insertValue(
const std::string &tag,
const T &val)
248 std::shared_ptr<XML> xml(
new XML());
261 std::stringstream sstream;
264 propertyMap.
set(key, sstream.str());
266 template<>
void setProperty(
const std::string &key,
const std::string &val)
268 propertyMap.
set(key, val);
270 template<>
void setProperty(
const std::string &key,
const WeakString &val)
272 propertyMap.
set(key, val.
str());
281 void eraseProperty(
const std::string&);
286 void clearProperties();
298 auto getTag()
const->std::string;
303 template<
class T = std::
string>
auto getValue() const -> T
305 std::stringstream sstream;
306 sstream << this->value;
311 return std::move(val);
314 template<>
auto getValue()
const -> std::string
318 template<>
auto getValue()
const ->
WeakString 326 template<
class T = std::
string>
auto getProperty(
const std::string &key)
const -> T
328 std::stringstream sstream;
329 sstream << propertyMap.
get(key);
334 return std::move(val);
337 template<>
auto getProperty(
const std::string &key)
const -> std::string
339 return propertyMap.
get(key);
341 template<>
auto getProperty(
const std::string &key)
const ->
WeakString 343 return propertyMap.
get(key);
349 auto hasProperty(
const std::string &)
const -> bool;
360 auto calcMinIndex(
const std::vector<size_t>&)
const->size_t;
362 auto encodeValue(
const WeakString &)
const->std::string;
363 auto decodeValue(
const WeakString &)
const->std::string;
364 auto encodeProperty(
const WeakString &)
const->std::string;
365 auto decodeProperty(
const WeakString &)
const->std::string;
377 auto toString(
size_t level = 0)
const->std::string;
380 SAMCHON_FRAMEWORK_EXTERN
template class SAMCHON_FRAMEWORK_API std::shared_ptr<XML>;
std::string value
Value of the XML.
auto str() const -> std::string
Get the string content.
auto get(const Key &key) -> T &
Get element.
HashMap< std::string, std::string > propertyMap
Properties belongs to the XML.
void setProperty(const std::string &key, const T &val)
Set a property with its key.
auto getValue() const -> T
Get value of the XML.
XML is a class representing xml object.
auto getProperty(const std::string &key) const -> T
Get property.
void set(const Key &key, const T &val)
Set element.
void setValue(const T &val)
Set value of the XML.
Top level namespace of products built from samchon.
Customized std::unordered_map.
A string class only references characeters, reference only.