#ifndef NAME_H #define NAME_H #include #include #include #include namespace Network { namespace Dns { class NameImpl; class Name { public: Name(); template Name(const Args& ...args) : Name(toStringVector(args...)) { } Name(const std::vector& labels); std::string GetFirstLabel() const; std::string GetName() const; bool empty() const; bool endsWith(const Name& suffix) const; void append(const std::string& label); void prepend(const std::string& label); void swap(Name& x) noexcept; bool operator==(const Name& name) const; bool operator!=(const Name& name) const; bool operator<(const Name& name) const; private: Name(std::shared_ptr pNameImpl); NameImpl* PImpl() const; private: template std::string toString(T&& t) { std::stringstream s; s << std::forward(t); return s.str(); } template std::vector toStringVector(T&&... args) { std::vector res { toString(std::forward(args))... }; return res; } private: friend class Query; friend class ResourceRecord; private: std::shared_ptr m_pNameImpl; }; } // namespace Dns } // namespace Network #endif // NAME_H