summaryrefslogtreecommitdiffhomepage
path: root/SONAME.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2024-05-10 21:15:30 +0200
committerRoland Reichwein <mail@reichwein.it>2024-05-10 21:15:30 +0200
commita7e016c2c633667b561a0f26ebde88cb26571d1c (patch)
tree7c66727de7022d5d962448be365dd059bb0ecac1 /SONAME.cpp
parentbfdb4e9d2cfc7890c5f194e670039fa76c391330 (diff)
Build static and dynamic libs
Diffstat (limited to 'SONAME.cpp')
-rw-r--r--SONAME.cpp46
1 files changed, 46 insertions, 0 deletions
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 <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;
+}
+