summaryrefslogtreecommitdiffstats
path: root/src/tools/cephfs/type_helper.hpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/tools/cephfs/type_helper.hpp
parentInitial commit. (diff)
downloadceph-upstream/16.2.11+ds.tar.xz
ceph-upstream/16.2.11+ds.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/cephfs/type_helper.hpp')
-rw-r--r--src/tools/cephfs/type_helper.hpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/tools/cephfs/type_helper.hpp b/src/tools/cephfs/type_helper.hpp
new file mode 100644
index 000000000..06dfa0afe
--- /dev/null
+++ b/src/tools/cephfs/type_helper.hpp
@@ -0,0 +1,28 @@
+#ifndef TYPE_HELPER_HPP__
+#define TYPE_HELPER_HPP__
+
+template<typename T1, typename T2>
+T1 conv_t(T2 s){
+ T1 target;
+ std::stringstream conv;
+ conv << s;
+ conv >> target;
+ return target;
+}
+
+void string_split(std::string str, vector<string>& out, string split = ":"){
+ std::cout << str << std::endl;
+ auto pos = str.find(split);
+ while(pos != std::string::npos){
+ std::cout << str.substr(0, pos) << std::endl;
+ out.push_back(str.substr(0, pos));
+ if (str.size() > pos + split.size()){
+ str = str.substr(pos + split.size());
+ pos = str.find(split);
+ }else
+ return;
+ }
+ out.push_back(str.substr());
+ return;
+}
+#endif // TYPE_HELPER_HPP__