summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2022-08-21 10:57:26 +0200
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2022-08-21 10:57:26 +0200
commita723f702c2feb92256ff10e6a56326063d4a062e (patch)
tree59db2f303264f09a50c7ce99fb24d09b34186f1c
parent3a979255a4e8441b4498d229201e235b692d13d6 (diff)
downloadglibmm-a723f702c2feb92256ff10e6a56326063d4a062e.tar.gz
Add Glib::ustring::release()
Fixes #101
-rw-r--r--glib/glibmm/ustring.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/glib/glibmm/ustring.h b/glib/glibmm/ustring.h
index 41165f58..3d879be9 100644
--- a/glib/glibmm/ustring.h
+++ b/glib/glibmm/ustring.h
@@ -22,6 +22,7 @@
#include <glib.h>
#include <cstddef> // for std::size_t and optionally std::ptrdiff_t
+#include <utility> // For std::move()
#include <initializer_list>
#include <iosfwd>
#include <iterator>
@@ -677,6 +678,10 @@ public:
GLIBMM_API inline operator std::string() const; // e.g. std::string str = ustring();
GLIBMM_API inline const std::string& raw() const;
+ /*! Return the stored string, moved from the %ustring.
+ * @newin{2,74}
+ */
+ GLIBMM_API inline std::string release();
// Not necessarily an ASCII char*. Use g_utf8_*() where necessary.
GLIBMM_API const char* data() const;
@@ -1259,6 +1264,12 @@ ustring::raw() const
return string_;
}
+inline std::string
+ustring::release()
+{
+ return std::move(string_);
+}
+
template <class... Ts>
inline // static
ustring