xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
object.h
Go to the documentation of this file.
1 #pragma once
5 #include <cstdint>
6 #include <string>
7 #include <memory>
8 
10 namespace xtd {
12  class ustring;
14 
26  class object {
27  public:
30  object() = default;
31 
33  object(const object&) = default;
34  object& operator=(const object&) = default;
35  virtual ~object() = default;
36  //friend std::ostream& operator <<(std::ostream& os, const object& obj) noexcept {return os << obj.to_string();}
38 
45  virtual bool equals(const object& obj) const noexcept;
46 
54  static bool equals(const object& object_a, const object& object_b) noexcept;
55 
58  virtual size_t get_hash_code() const noexcept;
59 
65  //virtual type get_type() const;
66 
72  template<typename object_t>
73  std::unique_ptr<object_t> memberwise_clone() const {return std::make_unique<object_t>(dynamic_cast<const object_t&>(*this));}
74 
82  static bool reference_equals(const object& object_a, const object& object_b) noexcept;
83 
89  virtual xtd::ustring to_string() const noexcept;
90  };
91 
93  std::ostream& operator <<(std::ostream& os, const object& obj) noexcept;
95 }
virtual xtd::ustring to_string() const noexcept
Returns a std::string that represents the current object.
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
object()=default
Create a new instance of the ultimate base class object.
virtual size_t get_hash_code() const noexcept
Serves as a hash function for a particular type.
std::unique_ptr< object_t > memberwise_clone() const
Gets the type of the current instance.
Definition: object.h:73
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:26
virtual bool equals(const object &obj) const noexcept
Determines whether the specified object is equal to the current object.
static bool reference_equals(const object &object_a, const object &object_b) noexcept
Determines whether the specified object instances are the same instance.