message: Add class for object-path and signatures

Change-Id: I1ca54ecc5d4033c41738bd224399f80b95094430
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/Makefile.am b/Makefile.am
index 1870f06..78ab597 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,6 +7,7 @@
 	sdbusplus/exception.hpp \
 	sdbusplus/message.hpp \
 	sdbusplus/message/append.hpp \
+	sdbusplus/message/native_types.hpp \
 	sdbusplus/message/read.hpp \
 	sdbusplus/message/types.hpp \
 	sdbusplus/server.hpp \
diff --git a/sdbusplus/message.hpp b/sdbusplus/message.hpp
index 2d23ff3..958e60b 100644
--- a/sdbusplus/message.hpp
+++ b/sdbusplus/message.hpp
@@ -4,6 +4,7 @@
 #include <systemd/sd-bus.h>
 #include <sdbusplus/message/append.hpp>
 #include <sdbusplus/message/read.hpp>
+#include <sdbusplus/message/native_types.hpp>
 
 namespace sdbusplus
 {
diff --git a/sdbusplus/message/native_types.hpp b/sdbusplus/message/native_types.hpp
new file mode 100644
index 0000000..c3941ca
--- /dev/null
+++ b/sdbusplus/message/native_types.hpp
@@ -0,0 +1,49 @@
+#pragma once
+
+#include <string>
+
+namespace sdbusplus
+{
+
+namespace message
+{
+
+namespace details
+{
+
+/** Simple wrapper class for std::string to allow conversion to and from an
+ *  alternative typename. */
+template <typename T>
+struct string_wrapper
+{
+    std::string str;
+
+    string_wrapper() = default;
+    string_wrapper(const string_wrapper&) = default;
+    string_wrapper& operator=(const string_wrapper&) = default;
+    string_wrapper(string_wrapper&&) = default;
+    string_wrapper& operator=(string_wrapper&&) = default;
+    ~string_wrapper() = default;
+
+    string_wrapper(const std::string& str) : str(str) {}
+    string_wrapper(std::string&& str) : str(std::move(str)) {}
+
+    operator std::string() const { return str; }
+    operator const std::string&() const { return str; }
+    operator std::string&&() { return std::move(str); }
+};
+
+/** Typename for sdbus OBJECT_PATH types. */
+struct object_path_type {};
+/** Typename for sdbus SIGNATURE types. */
+struct signature_type {};
+
+} // namespace details
+
+/** std::string wrapper for OBJECT_PATH. */
+using object_path = details::string_wrapper<details::object_path_type>;
+/** std::string wrapper for SIGNATURE. */
+using signature = details::string_wrapper<details::signature_type>;
+
+} // namespace message
+} // namespace sdbusplus
diff --git a/test/Makefile.am b/test/Makefile.am
index e89fea1..c80b2b5 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -15,6 +15,9 @@
 message_read_LDFLAGS = $(SYSTEMD_LIBS) $(PTHREAD_LIBS)
 message_read_SOURCES = message/read.cpp
 
+check_PROGRAMS += message_native_types
+message_native_types_SOURCES = message/native_types.cpp
+
 check_PROGRAMS += message_types
 message_types_SOURCES = message/types.cpp
 
diff --git a/test/message/native_types.cpp b/test/message/native_types.cpp
new file mode 100644
index 0000000..1ee3dee
--- /dev/null
+++ b/test/message/native_types.cpp
@@ -0,0 +1,13 @@
+#include <cassert>
+#include <sdbusplus/message.hpp>
+
+int main()
+{
+    std::string s1 = sdbusplus::message::object_path("/asdf/");
+    sdbusplus::message::object_path p = std::move(s1);
+
+    std::string s2 = sdbusplus::message::signature("iii");
+    sdbusplus::message::signature sig = s2;
+
+    return 0;
+}