xtd 0.2.0
Loading...
Searching...
No Matches
guid.h
Go to the documentation of this file.
1
4#pragma once
5#include "core_export.h"
6#include "icomparable.h"
7#include "iequatable.h"
8#include "object.h"
9#include "ustring.h"
10#include <vector>
11
13namespace xtd {
23 struct core_export_ guid final : public object, public icomparable<guid>, public xtd::iequatable<guid> {
24 public:
26
31 static const guid empty;
33
35
38 guid() = default;
42 explicit guid(const std::vector<xtd::byte>& data);
46 explicit guid(const std::initializer_list<xtd::byte>& data);
59 explicit guid(int32 a, int16 b, int16 c, const std::vector<xtd::byte>& d);
72 explicit guid(uint32 a, uint16 b, uint16 c, const std::vector<xtd::byte>& d);
122 explicit guid(const ustring& guid);
124
126 guid(const guid&) = default;
127 guid& operator =(const guid&) = default;
129
131
142 int32 compare_to(const guid& value) const noexcept override;
143
144 bool equals(const guid& g) const noexcept override;
145
148 const std::vector<xtd::byte>& to_byte_array() const noexcept;
149
155 xtd::ustring to_string() const noexcept override;
173 ustring to_string(ustring format) const;
175
177
183 static guid new_guid() noexcept;
185
186 private:
187 std::vector<xtd::byte> data_ = std::vector<xtd::byte>(16);
188 };
189
191 template<>
192 inline std::string to_string(const guid& value, const std::string& fmt, const std::locale& loc) {
193 return value.to_string(fmt);
194 }
196}
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition icomparable.h:17
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition iequatable.h:18
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:32
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
Contains core_export_ keyword.
#define core_export_
Define shared library export.
Definition core_export.h:13
int_least16_t int16
Represents a 16-bit signed integer.
Definition types.h:120
uint_least16_t uint16
Represents a 16-bit unsigned integer.
Definition types.h:230
int_least32_t int32
Represents a 32-bit signed integer.
Definition types.h:131
uint_least32_t uint32
Represents a 32-bit unsigned integer.
Definition types.h:241
uint_least8_t byte
Represents a 8-bit unsigned integer.
Definition types.h:41
Contains xtd::icomparable interface.
Contains xtd::iequatable interface.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
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
guid()=default
Initializes a new instance of the xtd::guid structure.
static const guid empty
Gets A read-only instance of the xtd::guid structure whose value is all zeros.
Definition guid.h:31
guid(const std::vector< xtd::byte > &data)
Initializes a new instance of the xtd::guid structure by using the specified array of bytes.
guid(int32 a, int16 b, int16 c, xtd::byte d, xtd::byte e, xtd::byte f, xtd::byte g, xtd::byte h, xtd::byte i, xtd::byte j, xtd::byte k) noexcept
Initializes a new instance of the xtd::guid structure by using the specified integers and bytes.
const std::vector< xtd::byte > & to_byte_array() const noexcept
Returns a 16-element byte array that contains the value of this instance.
bool equals(const guid &g) const noexcept override
Indicates whether the current object is equal to another object of the same type.
guid(uint32 a, uint16 b, uint16 c, const std::vector< xtd::byte > &d)
Initializes a new instance of the xtd::guid structure by using the specified unsigned integers and by...
guid(uint32 a, uint16 b, uint16 c, xtd::byte d, xtd::byte e, xtd::byte f, xtd::byte g, xtd::byte h, xtd::byte i, xtd::byte j, xtd::byte k) noexcept
Initializes a new instance of the xtd::guid structure by using the specified unsigned integers and by...
int32 compare_to(const guid &value) const noexcept override
Compares the current instance with another object of the same type.
guid(int32 a, int16 b, int16 c, const std::vector< xtd::byte > &d)
Initializes a new instance of the xtd::guid structure by using the specified integers and byte array.
guid(const ustring &guid)
Initializes a new instance of the xtd::guid structure by using the value represented by the specified...
guid(const std::initializer_list< xtd::byte > &data)
Initializes a new instance of the xtd::guid structure by using the specified array of bytes.
Contains xtd::ustring class.