blob: 5501ac106dbbc76c1236f33d9141a7458516ea7d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include "DaemonKey.h"
std::pair<DaemonKey, bool> DaemonKey::parse(const std::string& s)
{
auto p = s.find('.');
if (p == s.npos) {
return {{}, false};
} else {
return {DaemonKey{s.substr(0, p), s.substr(p + 1)}, true};
}
}
bool operator<(const DaemonKey& lhs, const DaemonKey& rhs)
{
if (int cmp = lhs.type.compare(rhs.type); cmp < 0) {
return true;
} else if (cmp > 0) {
return false;
} else {
return lhs.name < rhs.name;
}
}
std::ostream& operator<<(std::ostream& os, const DaemonKey& key)
{
return os << key.type << '.' << key.name;
}
namespace ceph {
std::string to_string(const DaemonKey& key)
{
return key.type + '.' + key.name;
}
}
|