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 #include "core_export.h"
9 
11 namespace xtd {
13  class ustring;
15 
30  class core_export_ object {
31  public:
33 
37  object() = default;
39 
41  object(const object&) = default;
42  object& operator=(const object&) = default;
43  virtual ~object() = default;
44  //friend std::ostream& operator <<(std::ostream& os, const object& obj) noexcept {return os << obj.to_string();}
46 
48 
56  virtual bool equals(const object& obj) const noexcept;
57 
65  static bool equals(const object& object_a, const object& object_b) noexcept;
66 
69  virtual size_t get_hash_code() const noexcept;
70 
76  //virtual type get_type() const;
77 
83  template<typename object_t>
84  std::unique_ptr<object_t> memberwise_clone() const {return std::make_unique<object_t>(dynamic_cast<const object_t&>(*this));}
85 
93  static bool reference_equals(const object& object_a, const object& object_b) noexcept;
94 
100  virtual xtd::ustring to_string() const noexcept;
102  };
103 
105  std::ostream& operator <<(std::ostream& os, const object& obj) noexcept;
107 }
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:50
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:1110
std::unique_ptr< object_t > memberwise_clone() const
Gets the type of the current instance.
Definition: object.h:84
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:30