Debian Codegraph @

src/Base/Uuid.h

raw
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2
3 /***************************************************************************
4 * Copyright (c) 2008 Jürgen Riegel <[email protected]> *
5 * *
6 * This file is part of the FreeCAD CAx development system. *
7 * *
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Library General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Library General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Library General Public *
19 * License along with this library; see the file COPYING.LIB. If not, *
20 * write to the Free Software Foundation, Inc., 59 Temple Place, *
21 * Suite 330, Boston, MA 02111-1307, USA *
22 * *
23 ***************************************************************************/
24
25
26 #ifndef BASE_UUID_H
27 #define BASE_UUID_H
28
29 // Std. configurations
30
31 #include <string>
32 #ifndef FC_GLOBAL_H
33 # include <FCGlobal.h>
34 #endif
35
36 namespace Base
37 {
38
39 /** Creates a Uuid
40 * \author Jürgen Riegel
41 */
42 class BaseExport Uuid
43 {
44 public:
45 /// Construction
46 Uuid();
47 Uuid(const Uuid&) = default;
48 Uuid(Uuid&&) = default;
49 Uuid& operator=(const Uuid&) = default;
50 Uuid& operator=(Uuid&&) = default;
51 /// Destruction
52 virtual ~Uuid();
53
54 void setValue(const char* sString);
55 void setValue(const std::string& sString);
56 const std::string& getValue() const;
57 static std::string createUuid();
58
59 bool operator==(const Uuid& other) const
60 {
61 return _uuid == other._uuid;
62 }
63 bool operator<(const Uuid& other) const
64 {
65 return _uuid < other._uuid;
66 }
67
68 private:
69 std::string _uuid;
70 };
71
72 } // namespace Base
73
74 #endif // BASE_UUID_H