Simple wrapper for UUID.
More...
#include <JUUID.hh>
|
| JUUID () |
| Default constructor.
|
|
| JUUID (const uuid_t &object) |
| Copy constructor.
|
|
| JUUID (const JUUID &object) |
| Copy constructor.
|
|
const JUUID & | operator() () |
| Randomizde this UUID.
|
|
bool | is_valid () const |
| Check validity.
|
|
void | clear () |
| Clear UUID.
|
|
bool | less (const JUUID &object) const |
| Less than method.
|
|
|
static const JUUID & | rndm () |
| Generate random UUID.
|
|
static JUUID | valueOf (const std::string &buffer) |
| Extract UUID.
|
|
|
static const int | BUFFER_SIZE = 36 |
| number of characters for I/O of uuid_t without trailing '\0', see e.g. man uuid_parse
|
|
|
std::istream & | operator>> (std::istream &in, JUUID &object) |
| Read object identifier from input.
|
|
std::ostream & | operator<< (std::ostream &out, const JUUID &object) |
| Write object identifier to output.
|
|
Simple wrapper for UUID.
Definition at line 22 of file JUUID.hh.
◆ JUUID() [1/3]
Default constructor.
Definition at line 32 of file JUUID.hh.
◆ JUUID() [2/3]
JLANG::JUUID::JUUID |
( |
const uuid_t & | object | ) |
|
|
inline |
Copy constructor.
- Parameters
-
Definition at line 43 of file JUUID.hh.
44 {
45 uuid_copy(this->
uuid,
object);
46 }
◆ JUUID() [3/3]
JLANG::JUUID::JUUID |
( |
const JUUID & | object | ) |
|
|
inline |
Copy constructor.
- Parameters
-
Definition at line 54 of file JUUID.hh.
◆ operator()()
const JUUID & JLANG::JUUID::operator() |
( |
| ) |
|
|
inline |
Randomizde this UUID.
- Returns
- this UUID
Definition at line 65 of file JUUID.hh.
66 {
67 uuid_generate_random(this->
uuid);
68
69 return *this;
70 }
◆ rndm()
static const JUUID & JLANG::JUUID::rndm |
( |
| ) |
|
|
inlinestatic |
Generate random UUID.
- Returns
- UUID
Definition at line 78 of file JUUID.hh.
79 {
81
82 return id();
83 }
JUUID()
Default constructor.
◆ is_valid()
bool JLANG::JUUID::is_valid |
( |
| ) |
const |
|
inline |
Check validity.
- Returns
- true if valid; else false
Definition at line 91 of file JUUID.hh.
92 {
93 return uuid_is_null(this->
uuid) == 0;
94 }
◆ clear()
void JLANG::JUUID::clear |
( |
| ) |
|
|
inline |
Clear UUID.
Definition at line 100 of file JUUID.hh.
101 {
102 return uuid_clear(this->
uuid);
103 }
◆ less()
bool JLANG::JUUID::less |
( |
const JUUID & | object | ) |
const |
|
inline |
Less than method.
- Parameters
-
- Returns
- true if this UUID less than given UUID; else false
Definition at line 112 of file JUUID.hh.
113 {
114 return uuid_compare(this->
uuid,
object.
uuid) < 0;
115 }
◆ valueOf()
static JUUID JLANG::JUUID::valueOf |
( |
const std::string & | buffer | ) |
|
|
inlinestatic |
Extract UUID.
- Parameters
-
- Returns
- UUID
Definition at line 124 of file JUUID.hh.
125 {
127
128 uuid_parse(buffer.c_str(), object.uuid);
129
130 return object;
131 }
◆ operator>>
std::istream & operator>> |
( |
std::istream & | in, |
|
|
JUUID & | object ) |
|
friend |
Read object identifier from input.
- Parameters
-
in | input stream |
object | object identifier |
- Returns
- input stream
Definition at line 141 of file JUUID.hh.
142 {
144
146
148
149 uuid_parse(buffer,
object.
uuid);
150 }
151
152 return in;
153 }
static const int BUFFER_SIZE
number of characters for I/O of uuid_t without trailing '\0', see e.g. man uuid_parse
◆ operator<<
std::ostream & operator<< |
( |
std::ostream & | out, |
|
|
const JUUID & | object ) |
|
friend |
Write object identifier to output.
- Parameters
-
out | output stream |
object | object identifier |
- Returns
- output stream
Definition at line 163 of file JUUID.hh.
164 {
166
167 uuid_unparse_lower(
object.
uuid, buffer);
168
170 }
◆ BUFFER_SIZE
const int JLANG::JUUID::BUFFER_SIZE = 36 |
|
static |
number of characters for I/O of uuid_t without trailing '\0', see e.g. man uuid_parse
Definition at line 26 of file JUUID.hh.
◆ uuid
uuid_t JLANG::JUUID::uuid |
The documentation for this struct was generated from the following file: