summaryrefslogtreecommitdiff
path: root/shared/guid.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'shared/guid.cpp')
-rw-r--r--shared/guid.cpp54
1 files changed, 6 insertions, 48 deletions
diff --git a/shared/guid.cpp b/shared/guid.cpp
index b20a1143..dcf63e60 100644
--- a/shared/guid.cpp
+++ b/shared/guid.cpp
@@ -1,7 +1,7 @@
// **************************************************************************
// * This file is part of the FreeFileSync project. It is distributed under *
// * GNU General Public License: http://www.gnu.org/licenses/gpl.html *
-// * Copyright (C) 2008-2010 ZenJu (zhnmju123 AT gmx.de) *
+// * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) *
// **************************************************************************
//
#include "guid.h"
@@ -12,59 +12,17 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif
+
#include <boost/uuid/uuid_generators.hpp>
+
#ifdef __MINGW32__
#pragma GCC diagnostic pop
#endif
-#include <cassert>
-#include <algorithm>
-#include <vector>
-
-using namespace util;
-
-
-struct UniqueId::IntData
-{
- boost::uuids::uuid nativeRep;
-};
-
-
-UniqueId::UniqueId() : pData(new IntData)
-{
- pData->nativeRep = boost::uuids::random_generator()();
-}
-
-
-bool UniqueId::operator==(const UniqueId rhs) const
-{
- return pData->nativeRep == rhs.pData->nativeRep;
-}
-
-bool UniqueId::operator<(const UniqueId rhs) const
+std::string util::generateGUID() //creates a 16 byte GUID
{
- return pData->nativeRep < rhs.pData->nativeRep;
-}
-
-
-UniqueId::UniqueId(wxInputStream& stream) : //read
- pData(new IntData)
-{
- std::vector<char> rawData(boost::uuids::uuid::static_size());
- stream.Read(&rawData[0], rawData.size());
-
- std::copy(rawData.begin(), rawData.end(), pData->nativeRep.begin());
-}
-
-
-void UniqueId::toStream(wxOutputStream& stream) const //write
-{
- std::vector<char> rawData;
- std::copy(pData->nativeRep.begin(), pData->nativeRep.end(), std::back_inserter(rawData));
-
- assert(boost::uuids::uuid::static_size() == rawData.size());
-
- stream.Write(&rawData[0], rawData.size());
+ boost::uuids::uuid nativeRep = boost::uuids::random_generator()();
+ return std::string(nativeRep.begin(), nativeRep.end());
}
bgstack15