summaryrefslogtreecommitdiff
path: root/include/rtl
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-11-05 12:07:44 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-11-05 14:45:31 +0100
commit801cb231f2e2b43f4befd9575e23da58d764c600 (patch)
tree92fe3b44a9ec99b3d872da930b6252a77f2f8ff5 /include/rtl
parent2bd1896e207f7fda2861d019702b931f07c9c4e1 (diff)
Add rtl::OUString::fromUtf8()
Note that this should be used only at places legitimately assuming that the OString contains valid UTF-8. Change-Id: I9e8ecef9928975fe0737553f5b2a19ff2dd40861
Diffstat (limited to 'include/rtl')
-rw-r--r--include/rtl/ustring.hxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx
index f59d646dc41d..45508695a4b4 100644
--- a/include/rtl/ustring.hxx
+++ b/include/rtl/ustring.hxx
@@ -2075,6 +2075,26 @@ public:
}
/**
+ * Convert an OString to an OUString, assuming that the OString is
+ * UTF-8-encoded.
+ *
+ * @param rStr
+ * an OString to convert
+ *
+ * @param convertFlags
+ * flags which control the conversion.
+ *
+ * @see rtl::OStringToOUString for more info on convertFlags.
+ *
+ * @since LibreOffice 4.4
+ */
+ static inline OUString fromUtf8(const OString& rStr,
+ sal_uInt32 convertFlags = OSTRING_TO_OUSTRING_CVTFLAGS)
+ {
+ return OUString(rStr.getStr(), rStr.getLength(), RTL_TEXTENCODING_UTF8, convertFlags);
+ }
+
+ /**
Returns the string representation of the integer argument.
This function can't be used for language specific conversion.