Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added code to generate UUIDs using built-in operating system tools.
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Mon, 30 May 2016 15:12:13 +0000 (16:12 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Mon, 30 May 2016 15:12:13 +0000 (16:12 +0100)
source/common/uuid.cpp [new file with mode: 0644]
source/common/uuid.h [new file with mode: 0644]

diff --git a/source/common/uuid.cpp b/source/common/uuid.cpp
new file mode 100644 (file)
index 0000000..2831e88
--- /dev/null
@@ -0,0 +1,59 @@
+// uuid.cpp - UUID subroutines.
+//
+// (c) 2012-2015 Xestia Software Development.
+//
+// This file is part of Xestia Calendar.
+//
+// Xestia Calendar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by the
+// Free Software Foundation, version 3 of the license.
+//
+// Xestia Calendar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
+
+#include "uuid.h"
+
+string GenerateUUID()
+{
+
+#if defined(__WIN32__)
+       
+#include <rpc.h>
+       
+       UUID UUIDData;
+       UuidCreate(&UUIDData);
+       wchar_t* UUIDStr = 0;
+       UuidToString(&UUIDData, (RPC_WSTR*)&UUIDStr);
+       wxString Result(UUIDStr);
+       
+#elif defined(__HAIKU__)
+    
+#else
+    
+#include <stdio.h>
+    
+       FILE *uuid_hdl = popen("uuidgen", "r");
+    
+       if (uuid_hdl == NULL) {
+               return "";
+       }
+    
+       char strdata[64];
+       std::string uuidout;
+    
+       while (fgets(strdata, sizeof(strdata), uuid_hdl) != NULL){
+               uuidout.append(strdata);
+       }
+    
+       pclose(uuid_hdl);
+    
+#endif
+    
+       return uuidout;
+        
+}
\ No newline at end of file
diff --git a/source/common/uuid.h b/source/common/uuid.h
new file mode 100644 (file)
index 0000000..f406a79
--- /dev/null
@@ -0,0 +1,28 @@
+// uuid.cpp - UUID subroutines header.
+//
+// (c) 2012-2015 Xestia Software Development.
+//
+// This file is part of Xestia Calendar.
+//
+// Xestia Calendar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by the
+// Free Software Foundation, version 3 of the license.
+//
+// Xestia Calendar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with Calendar. If not, see <http://www.gnu.org/licenses/>
+
+#include <string>
+
+using namespace std;
+
+#ifndef COMMON_UUID_H
+#define COMMON_UUID_H
+
+string GenerateUUID();
+
+#endif
\ No newline at end of file
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy