xtd 0.2.0
Go to the documentation of this file.
1 #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"
13 namespace xtd {
23  struct core_export_ guid final : public object, public icomparable<guid>, public xtd::iequatable<guid> {
24  public:
31  static const guid empty;
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);
126  guid(const guid&) = default;
127  guid& operator =(const guid&) = default;
142  int32 compare_to(const guid& value) const noexcept override;
144  bool equals(const guid& g) const noexcept override;
150  static guid new_guid() noexcept;
154  const std::vector<xtd::byte>& to_byte_array() const noexcept;
161  xtd::ustring to_string() const noexcept override;
179  ustring to_string(ustring format) const;
182  private:
183  std::vector<xtd::byte> data_ = std::vector<xtd::byte>(16);
184  };
187  template<>
188  inline std::string to_string(const guid& value, const std::string& fmt, const std::locale& loc) {
189  return value.to_string(fmt);
190  }
192 }
Contains xtd::iequatable interface.
Contains xtd::icomparable interface.
Defines a generalized comparison method that a value type or class implements to create a type-specif...
Definition: icomparable.h:17
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
uint_least16_t uint16
Represents a 16-bit unsigned integer.
Definition: types.h:144
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
std::string to_string(const date_time &value, const std::string &fmt, const std::locale &loc)
Convert a specified value into a string with specified format and locale.
Definition: date_time.h:1098
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition: iequatable.h:18
Contains xtd::ustring class.
static const guid empty
Gets A read-only instance of the xtd::guid structure whose value is all zeros.
Definition: guid.h:31
int_least16_t int16
Represents a 16-bit signed integer.
Definition: types.h:66
Contains xtd::object class.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:31
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:74
Represents a globally unique identifier (GUID). A GUID is a 128-bit integer (16 bytes) that can be us...
Definition: guid.h:23
uint_least8_t byte
Represents a 8-bit unsigned integer.
Definition: types.h:26
uint_least32_t uint32
Represents a 32-bit unsigned integer.
Definition: types.h:152