diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2017-12-11 14:38:54 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2017-12-12 08:46:34 +0100 |
commit | c85d8064cb67552e3ddcc73099769af09d7d0edd (patch) | |
tree | 6e745da3721d3a1ba3fb63280335d9b274cc0728 /comphelper | |
parent | ac3d194db5bf32de9b92a0accf7492145e5d6cdd (diff) |
Move generateGUIDString to comphelper
and remove duplicate method
Change-Id: Ic513a780f3b9b526c3abd0f273ad9c230ffbb373
Reviewed-on: https://gerrit.libreoffice.org/46233
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
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: */ |