return ret;
}
-std::string ZoneName::toStringFull(const std::string& separator, const bool trailing) const
+std::string ZoneName::toString(const std::string& separator, const bool trailing) const
{
std::string ret = d_name.toString(separator, trailing);
if (!d_variant.empty()) {
return ret;
}
+std::string ZoneName::toStringNoDot() const
+{
+ std::string ret = d_name.toStringNoDot();
+ if (!d_variant.empty()) {
+ ret += "..";
+ ret += d_variant;
+ }
+ return ret;
+}
+
+std::string ZoneName::toStringRootDot() const
+{
+ std::string ret = d_name.toStringRootDot();
+ if (!d_variant.empty()) {
+ if (!d_name.isRoot()) {
+ ret.push_back('.');
+ }
+ ret.push_back('.');
+ ret += d_variant;
+ }
+ return ret;
+}
+
size_t ZoneName::hash(size_t init) const
{
if (!d_variant.empty()) {
bool operator==(const ZoneName& rhs) const { return d_name == rhs.d_name && d_variant == rhs.d_variant; }
bool operator!=(const ZoneName& rhs) const { return !operator==(rhs); }
- // IMPORTANT! None of the "toString" routines will output the variant, but toLogString() and toStringFull().
- std::string toString(const std::string& separator=".", const bool trailing=true) const { return d_name.toString(separator, trailing); }
- void toString(std::string& output, const std::string& separator=".", const bool trailing=true) const { d_name.toString(output, separator, trailing); }
+ std::string toString(const std::string& separator=".", const bool trailing=true) const;
+ void toString(std::string& output, const std::string& separator=".", const bool trailing=true) const { output = toString(separator, trailing); }
std::string toLogString() const;
- std::string toStringNoDot() const { return d_name.toStringNoDot(); }
- std::string toStringRootDot() const { return d_name.toStringRootDot(); }
- std::string toStringFull(const std::string& separator=".", const bool trailing=true) const;
+ std::string toStringNoDot() const;
+ std::string toStringRootDot() const;
+ std::string toStringFull(const std::string& separator=".", const bool trailing=true) const { return toString(separator, trailing); }
bool chopOff() { return d_name.chopOff(); }
ZoneName makeLowerCase() const
static void jsonFillZoneNameArray(Json::array& array, std::vector<ZoneName>& zones)
{
for (const auto& zone : zones) {
- // Remember ZoneName::toString() intentionally omits the variant
- std::string name(zone.toString());
- if (zone.hasVariant()) {
- name.push_back('.');
- name += zone.getVariant();
- }
- array.emplace_back(name);
+ array.emplace_back(zone.toString());
}
}