blob: 89a44f16792b775bc6d6986082498b382ba9ef9b (
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
36
37
38
39
40
41
42
43
44
45
46
|
#include "SONAME.h"
#include <stdexcept>
#include <string>
#include <fmt/format.h>
#include <libreichwein/stringhelper.h>
using namespace std::string_literals;
SONAME::SONAME(): _soname{".0"}, _soname_full{".0.0.0"}
{
}
SONAME(const std::string& s)
{
std::vector<std::string> parts{Reichwein::Stringhelper::split(s, ":")};
if (parts.size() > 3) {
throw std::runtime_error("Bad SONAME spec: "s + s);
}
while (parts.size() < 3) {
parts.push_back("0");
}
_soname = fmt::format(".{}");
_soname_full = fmt::format(".{}.{}.{}", parts[0], parts[1], parts[2]);
}
std::string getShortName() const // ""
{
return {};
}
std::string getName() const // ".X"
{
return _soname;
}
std::string getFullName() const // ".X.Y.Z"
{
return _soname_full;
}
|