xtd - Reference Guide  0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
object.h
Go to the documentation of this file.
1
4#pragma once
5#include <cstdint>
6#include <string>
7#include <memory>
8
10namespace 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}
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition: object.h:26
static bool reference_equals(const object &object_a, const object &object_b) noexcept
Determines whether the specified object instances are the same instance.
virtual size_t get_hash_code() const noexcept
Serves as a hash function for a particular type.
virtual bool equals(const object &obj) const noexcept
Determines whether the specified object is equal to the current object.
virtual xtd::ustring to_string() const noexcept
Returns a std::string that represents the current object.
static bool equals(const object &object_a, const object &object_b) noexcept
Determines whether the specified object instances are considered equal.
std::unique_ptr< object_t > memberwise_clone() const
Gets the type of the current instance.
Definition: object.h:73
object()=default
Create a new instance of the ultimate base class object.
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17