xtd - Reference Guide  0.1.2
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
guid.h
Go to the documentation of this file.
1
4#pragma once
5#include <vector>
6#include "core_export.h"
7#include "icomparable.h"
8#include "iequatable.h"
9#include "object.h"
10#include "ustring.h"
11
13namespace xtd {
23 struct core_export_ guid final : public object, public icomparable<guid>, public iequatable<guid> {
24 public:
28 static const guid empty;
29
31 guid() = default;
35 explicit guid(const std::vector<byte_t>& data);
39 explicit guid(const std::initializer_list<byte_t>& data);
46 explicit guid(int32_t a, int32_t b, int32_t c, const std::vector<byte_t>& d);
59 guid(int32_t a, int16_t b, int16_t c, byte_t d, byte_t e, byte_t f, byte_t g, byte_t h, byte_t i, byte_t j, byte_t k) noexcept;
72 guid(uint32_t a, uint16_t b, uint16_t c, byte_t d, byte_t e, byte_t f, byte_t g, byte_t h, byte_t i, byte_t j, byte_t k) noexcept;
96 guid(const ustring& guid);
97
99 guid(const guid&) = default;
100 guid& operator=(const guid&) = default;
101 friend std::ostream& operator <<(std::ostream& os, const guid& guid) noexcept {return os << guid.to_string();}
103
113 int32_t compare_to(const object& obj) const noexcept override;
123 int32_t compare_to(const guid& value) const noexcept override;
124
125 bool equals(const object& g) const noexcept override;
126 bool equals(const guid& g) const noexcept override;
127
132 static guid new_guid() noexcept;
133
136 const std::vector<byte_t>& to_byte_array() const noexcept;
137
143 xtd::ustring to_string() const noexcept override;
161 ustring to_string(ustring format) const;
162
163 private:
164 std::vector<byte_t> data_ = std::vector<byte_t>(16);
165 };
166
168 template<>
169 inline std::string to_string(const guid& value, const std::string& fmt, const std::locale& loc) {
170 return value.to_string(fmt);
171 }
173}
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition icomparable.h:18
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.h:19
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:26
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:48
ustring to_string() const noexcept override
Returns a std::string that represents the current object.
Contains core_export_ keyword.
#define core_export_
Define shared library export.
Definition core_export.h:13
Contains xtd::icomparable interface.
Contains xtd::iequatable interface.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17
Contains xtd::object class.
Represents a globally unique identifier (GUID). A GUID is a 128-bit integer (16 bytes) that can be us...
Definition guid.h:23
static guid new_guid() noexcept
Initializes a new instance of the xtd::guid structure.
guid()=default
Initializes a new instance of the xtd::guid structure.
static const guid empty
Get A read-only instance of the xtd::guid structure whose value is all zeros.
Definition guid.h:28
guid(const std::vector< byte_t > &data)
Initializes a new instance of the xtd::guid structure by using the specified array of bytes.
guid(const std::initializer_list< byte_t > &data)
Initializes a new instance of the xtd::guid structure by using the specified array of bytes.
guid(int32_t a, int16_t b, int16_t c, byte_t d, byte_t e, byte_t f, byte_t g, byte_t h, byte_t i, byte_t j, byte_t k) noexcept
Initializes a new instance of the xtd::guid structure by using the specified integers and bytes.
bool equals(const object &g) const noexcept override
Determines whether the specified object is equal to the current object.
bool equals(const guid &g) const noexcept override
Indicates whether the current object is equal to another object of the same type.
guid(uint32_t a, uint16_t b, uint16_t c, byte_t d, byte_t e, byte_t f, byte_t g, byte_t h, byte_t i, byte_t j, byte_t k) noexcept
Initializes a new instance of the xtd::guid structure by using the specified uint32_integers and byte...
xtd::ustring to_string() const noexcept override
Returns a string representation of the value of this instance in registry format.
int32_t compare_to(const guid &value) const noexcept override
Compares the current instance with another object of the same type.
int32_t compare_to(const object &obj) const noexcept override
Compares the current instance with another object of the same type.
guid(const ustring &guid)
Initializes a new instance of the xtd::guid structure by using the value represented by the specified...
guid(int32_t a, int32_t b, int32_t c, const std::vector< byte_t > &d)
Initializes a new instance of the xtd::guid structure by using the specified integers and byte array.
Contains xtd::ustring class.