diff options
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/xml/xmltools.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/comphelper/source/xml/xmltools.cxx b/comphelper/source/xml/xmltools.cxx index b1fcc6a5b59a..ace7d2661e3b 100644 --- a/comphelper/source/xml/xmltools.cxx +++ b/comphelper/source/xml/xmltools.cxx @@ -9,6 +9,7 @@ #include <comphelper/xmltools.hxx> #include <rtl/random.h> +#include <rtl/uuid.h> #include <vector> using namespace com::sun::star; @@ -91,6 +92,19 @@ namespace comphelper return OString(reinterpret_cast<const sal_Char*>(&aChaff[0]), nLength); } + + OString generateGUIDString() + { + sal_uInt8 aSeq[16]; + rtl_createUuid(aSeq, nullptr, true); + + char str[39]; + sprintf(str, "{%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X}", + aSeq[0], aSeq[1], aSeq[2], aSeq[3], aSeq[4], aSeq[5], aSeq[6], aSeq[7], aSeq[8], + aSeq[9], aSeq[10], aSeq[11], aSeq[12], aSeq[13], aSeq[14], aSeq[15]); + + return OString(str, SAL_N_ELEMENTS(str)); + } } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |