From a7e016c2c633667b561a0f26ebde88cb26571d1c Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Fri, 10 May 2024 21:15:30 +0200 Subject: Build static and dynamic libs --- SONAME.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 SONAME.cpp (limited to 'SONAME.cpp') diff --git a/SONAME.cpp b/SONAME.cpp new file mode 100644 index 0000000..89a44f1 --- /dev/null +++ b/SONAME.cpp @@ -0,0 +1,46 @@ +#include "SONAME.h" + +#include +#include + +#include + +#include + +using namespace std::string_literals; + +SONAME::SONAME(): _soname{".0"}, _soname_full{".0.0.0"} +{ +} + +SONAME(const std::string& s) +{ + std::vector 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; +} + -- cgit v1.2.3