return ret.substr(0, ret.size()-!trailing);
}
+std::string DNSName::toLogString() const
+{
+ if (empty()) {
+ return "(empty)";
+ }
+
+ if(isRoot())
+ return ".";
+
+ std::string ret;
+ for(const auto& s : getRawLabels()) {
+ ret+= escapeLabel(s) + ".";
+ }
+
+ return ret;
+}
+
std::string DNSName::toDNSString() const
{
if (empty())
bool operator!=(const DNSName& other) const { return !(*this == other); }
std::string toString(const std::string& separator=".", const bool trailing=true) const; //!< Our human-friendly, escaped, representation
+ std::string toLogString() const; //!< like plain toString, but returns (empty) on empty names
std::string toStringNoDot() const { return toString(".", false); }
std::string toStringRootDot() const { if(isRoot()) return "."; else return toString(".", false); }
std::string toDNSString() const; //!< Our representation in DNS native format