xtd 0.2.0
Loading...
Searching...
No Matches
xtd::drawing::point Class Reference
Inheritance diagram for xtd::drawing::point:
xtd::object xtd::iequatable< point > xtd::interface xtd::equality_operators< type_t, equatable_t >

Definition

Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional plane.

Represents an ordered pair of integer x- and y-coordinates that defines a point in a two-dimensional ...
Definition point.h:54
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:42
#define drawing_export_
Define shared library export.
Definition drawing_export.h:13
Inheritance
xtd::objectxtd::drawing::point
Namespace
xtd::drawing
Library
xtd.drawing
Remarks
To convert a point to a point_f, use Implicit cast operator.
Examples
void create_points_and_sizes(paint_event_args& e) {
// Create the starting point.
point start_point = subtract_button.size();
// Use the addition operator to get the end point.
point end_point = start_point + size(140, 150);
// Draw a line between the points.
e.graphics().draw_line(system_pens::highlight, start_point, end_point);
// Convert the starting point to a size and compare it to the subtractButton size.
size button_size(start_point);
if (button_size == subtract_button.size()) {
// If the sizes are equal, tell the user.
e.graphics().draw_string("The sizes are equal.", font(font, font_style.italic), brushes::indigo, 10.0F, 65.0F);
}
}
static xtd::drawing::solid_brush indigo()
A system-defined brush object.
Defines a particular format for text, including font face, size, and style attributes....
Definition font.h:45
bool italic() const noexcept
Gets a value that indicates whether this xtd::drawing::font is italic.
Stores an ordered pair of integers, which specify a height and width.
Definition size.h:31
static xtd::drawing::pen highlight()
Gets a pen that is the color of the highlight.
font_style
Specifies style information applied to text. This enumeration has a flags attribute that allows a bit...
Definition font_style.h:17
@ e
The E key.
Examples
animation.cpp, application_settings_without_cmake_setting_commands.cpp, buttons.cpp, circular_form.cpp, colored_forms.cpp, docked_panels.cpp, draw_point.cpp, emplace.cpp, fill_ellipse.cpp, fill_rectangle.cpp, fill_rounded_rectangle.cpp, form_paint.cpp, graph_control.cpp, graphics.cpp, labels_and_unicode_text.cpp, lcd_label3.cpp, minesweeper.cpp, point.cpp, screenshot.cpp, tutorial_button.cpp, user_control.cpp, and wiggly.cpp.

Public Fields

static const point empty
 Represents a xtd::drawing::point that has xtd::drawing::point::x and xtd::drawing::point::y values set to zero.
 

Public Constructors

 point () noexcept=default
 Initializes a new instance of the xtd::drawing::point class.
 
 point (int32 dw) noexcept
 Initializes a new instance of the xtd::drawing::point class using coordinates specified by an integer value.
 
 point (int32 x, int32 y) noexcept
 Initializes a new instance of the xtd::drawing::point class with the specified coordinates.
 
 point (const size &sz) noexcept
 Initializes a new instance of the xtd::drawing::point class from a xtd::drawing::size.
 

Public Properties

bool is_empty () const noexcept
 Gets a value indicating whether this xtd::drawing::point is empty.
 
int32 x () const noexcept
 Gets the x-coordinate of this xtd::drawing::point.
 
void x (int32 x) noexcept
 Sets the x-coordinate of this xtd::drawing::point.
 
int32 y () const noexcept
 Gets the y-coordinate of this xtd::drawing::point.
 
void y (int32 y) noexcept
 Sets the y-coordinate of this xtd::drawing::point.
 

Public Methods

bool equals (const point &value) const noexcept override
 
void offset (int32 dx, int32 dy) noexcept
 Translates this xtd::drawing::point by the specified amount.
 
void offset (const point &p) noexcept
 Translates this xtd::drawing::point by the specified xtd::drawing::point.
 
xtd::string to_string () const noexcept override
 Converts this point to a human-readable string.
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
static point truncate (const point_f &value) noexcept
 Converts the specified xtd::drawing::point_f to a point by truncating the values of the xtd::drawing::point_f.
 
static point add (const point &pt, const size &sz) noexcept
 Adds the specified xtd::drawing::size to the specified xtd::drawing::point.
 
static point add (const point &pt1, const point &pt2) noexcept
 Adds the specified xtd::drawing::point to the specified xtd::drawing::point.
 
static point ceiling (const point_f &value) noexcept
 Converts the specified xtd::drawing::point_f to a point by rounding the values of the xtd::drawing::point_f to the next higher integer values.
 
static point round (const point_f &value) noexcept
 Converts the specified xtd::drawing::point_f to a point object by rounding the xtd::drawing::point_f values to the nearest integer.
 
static point subtract (const point &pt, const size &sz) noexcept
 Returns the result of subtracting specified xtd::drawing::size from the specified xtd::drawing::point.
 
static point subtract (const point &pt1, const point &pt2) noexcept
 Returns the result of subtracting specified xtd::drawing::point from the specified xtd::drawing::point.
 
template<typename object_a_t , typename object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 

Operators

point operator+ (const size &sz) const noexcept
 Translates a xtd::drawing::point by a given xtd::drawing::size.
 
point operator+ (const point &pt) const noexcept
 Translates a xtd::drawing::point by a given xtd::drawing::point.
 
pointoperator+= (const size &sz) noexcept
 Translates a xtd::drawing::point by a given xtd::drawing::size.
 
pointoperator+= (const point &pt) noexcept
 Translates a xtd::drawing::point by a given xtd::drawing::point.
 
point operator- (const size &sz) const noexcept
 Translates a xtd::drawing::point by the negative of a given xtd::drawing::size.
 
point operator- (const point &pt) const noexcept
 Translates a xtd::drawing::point by the negative of a given xtd::drawing::point.
 
pointoperator-= (const size &sz) noexcept
 Translates a xtd::drawing::point by the negative of a given xtd::drawing::size.
 
pointoperator-= (const point &pt) noexcept
 Translates a xtd::drawing::point by the negative of a given xtd::drawing::point.
 

Additional Inherited Members

- Public Member Functions inherited from xtd::object
 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.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<typename object_t >
xtd::uptr< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
- Public Member Functions inherited from xtd::iequatable< point >
virtual bool equals (const point &) const noexcept=0
 Indicates whether the current object is equal to another object of the same type.
 
- Static Public Member Functions inherited from xtd::object
template<typename object_a_t , typename object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
template<typename object_a_t , typename object_b_t >
static bool reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 

Constructor & Destructor Documentation

◆ point() [1/4]

xtd::drawing::point::point ( )
defaultnoexcept

Initializes a new instance of the xtd::drawing::point class.

Remarks
xtd::drawing::point::x and xtd::drawing::point::y values are set to zero.

◆ point() [2/4]

xtd::drawing::point::point ( int32  dw)
explicitnoexcept

Initializes a new instance of the xtd::drawing::point class using coordinates specified by an integer value.

Parameters
dxA 32-bit integer that specifies the coordinates for the new xtd::drawing::point.
Remarks
The low-order 16 bits of the dw parameter specify the horizontal x-coordinate and the higher 16 bits specify the vertical y-coordinate for the new point.
Examples
The following code example demonstrates how to use the point and size. size constructors and the xtd::drawing::content_alignment enumeration. To run this example, paste this code into a Windows Form (xtd::forms) that contains a label named label1, and call the initialize_label1 method in the form's constructor.
void initialize_label1() {
// Set a border.
label1.border_style = border_style::fixed_single;
// Set the size, constructing a size from two integers.
label1.size(drawing::size(100, 50));
// Set the location, constructing a point from a 32-bit integer
// (using hexadecimal).
label1.location(point(0x280028));
// Set and align the text on the lower-right side of the label.
label1.text_align = content_alignment::bottom_right;
label1.text = "Bottom Right Alignment";
}
point() noexcept=default
Initializes a new instance of the xtd::drawing::point class.

◆ point() [3/4]

xtd::drawing::point::point ( int32  x,
int32  y 
)
noexcept

Initializes a new instance of the xtd::drawing::point class with the specified coordinates.

Parameters
xThe horizontal position of the point.
yThe vertical position of the point.
Examples
The following code example demonstrates how to use the Equality operator and how to construct a point from a size or two integers. It also demonstrates how to use the x and y properties. This example is designed to be used with Windows Forms (xtd.forms). Paste the code into a form that contains a button named button1, and associate the button1_click method with the button's click event.
void button1_click(object& sender, const event_args& e) {
// Construct a new point with integers.
point point1(100, 100);
// Create a Graphics object.
graphics form_graphics = create_graphics();
// Construct another point, this time using a xtd::drawing::size.
point point2(size(100, 100));
// Call the equality operator to see if the points are equal, and if so print out their x and y values.
if (point1 == point2) {
form_graphics.draw_string(string::format("point1.x: {}, point2.x: {}, point1.y: {}, point2.y {}", point1.x(), point2.x(), point1.y(), point2.y()), font(), brushes::black, point_f(10, 70));
}
}
static xtd::drawing::solid_brush black()
A system-defined brush object.
Defines an object used to draw lines and curves. This class cannot be inherited.
Definition graphics.h:70
void draw_string(const xtd::string &s, const xtd::drawing::font &font, const xtd::drawing::brush &brush, const xtd::drawing::rectangle_f &layout_rectangle)
Draws the specified text string at the specified rectangle with the specified xtd::drawing::brush and...
Represents an ordered pair of floating-point x- and y-coordinates that defines a point in a two-dimen...
Definition point_f.h:35
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.h:18
static basic_string format(const basic_string< char > &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...

◆ point() [4/4]

xtd::drawing::point::point ( const size sz)
explicitnoexcept

Initializes a new instance of the xtd::drawing::point class from a xtd::drawing::size.

Parameters
szA size that specifies the coordinates for the new point.
Examples
The following code example demonstrates how to use the Equality operator and how to construct a point from a size or two integers. It also demonstrates how to use the x and y properties. This example is designed to be used with Windows Forms (xtd.forms). Paste the code into a form that contains a button named button1, and associate the button1_click method with the button's click event.
void button1_click(object& sender, const event_args& e) {
// Construct a new point with integers.
point point1(100, 100);
// Create a Graphics object.
graphics form_graphics = create_graphics();
// Construct another point, this time using a xtd::drawing::size.
point point2(size(100, 100));
// Call the equality operator to see if the points are equal, and if so print out their x and y values.
if (point1 == point2) {
form_graphics.draw_string(string::format("point1.x: {}, point2.x: {}, point1.y: {}, point2.y {}", point1.x(), point2.x(), point1.y(), point2.y()), font(), brushes::black, point_f(10, 70));
}
}

Member Function Documentation

◆ is_empty()

bool xtd::drawing::point::is_empty ( ) const
noexcept

Gets a value indicating whether this xtd::drawing::point is empty.

Returns
true if both xtd::drawing::point::x and xtd::drawing::point::y are 0; otherwise, false.

◆ x() [1/2]

int32 xtd::drawing::point::x ( ) const
noexcept

Gets the x-coordinate of this xtd::drawing::point.

Returns
The x-coordinate of this xtd::drawing::point.
Examples
The following code example demonstrates how to use the Equality operator and how to construct a point from a size or two integers. It also demonstrates how to use the x and y properties. This example is designed to be used with Windows Forms (xtd.forms). Paste the code into a form that contains a button named button1, and associate the button1_click method with the button's click event.
void button1_click(object& sender, const event_args& e) {
// Construct a new point with integers.
point point1(100, 100);
// Create a Graphics object.
graphics form_graphics = create_graphics();
// Construct another point, this time using a xtd::drawing::size.
point point2(size(100, 100));
// Call the equality operator to see if the points are equal, and if so print out their x and y values.
if (point1 == point2) {
form_graphics.draw_string(string::format("point1.x: {}, point2.x: {}, point1.y: {}, point2.y {}", point1.x(), point2.x(), point1.y(), point2.y()), font(), brushes::black, point_f(10, 70));
}
}
Examples
animation.cpp, and minesweeper.cpp.

◆ x() [2/2]

void xtd::drawing::point::x ( int32  x)
noexcept

Sets the x-coordinate of this xtd::drawing::point.

Parameters
xThe x-coordinate of this xtd::drawing::point.
Examples
The following code example demonstrates how to use the Equality operator and how to construct a point from a size or two integers. It also demonstrates how to use the x and y properties. This example is designed to be used with Windows Forms (xtd.forms). Paste the code into a form that contains a button named button1, and associate the button1_click method with the button's click event.
void button1_click(object& sender, const event_args& e) {
// Construct a new point with integers.
point point1(100, 100);
// Create a Graphics object.
graphics form_graphics = create_graphics();
// Construct another point, this time using a xtd::drawing::size.
point point2(size(100, 100));
// Call the equality operator to see if the points are equal, and if so print out their x and y values.
if (point1 == point2) {
form_graphics.draw_string(string::format("point1.x: {}, point2.x: {}, point1.y: {}, point2.y {}", point1.x(), point2.x(), point1.y(), point2.y()), font(), brushes::black, point_f(10, 70));
}
}

◆ y() [1/2]

int32 xtd::drawing::point::y ( ) const
noexcept

Gets the y-coordinate of this xtd::drawing::point.

Returns
The y-coordinate of this xtd::drawing::point.
Examples
The following code example demonstrates how to use the Equality operator and how to construct a point from a size or two integers. It also demonstrates how to use the x and y properties. This example is designed to be used with Windows Forms (xtd.forms). Paste the code into a form that contains a button named button1, and associate the button1_click method with the button's click event.
void button1_Click(object& sender, const event_args& e) {
// Construct a new point with integers.
point point1(100, 100);
// Create a Graphics object.
graphics form_graphics = create_graphics();
// Construct another point, this time using a xtd::drawing::size.
point point2(size(100, 100));
// Call the equality operator to see if the points are equal, and if so print out their x and y values.
if (point1 == point2) {
form_graphics.draw_string(string::format("point1.x: {}, point2.x: {}, point1.y: {}, point2.y {}", point1.x(), point2.x(), point1.y(), point2.y()), font(), brushes::black, point_f(10, 70));
}
}
Examples
animation.cpp, minesweeper.cpp, and screen.cpp.

◆ y() [2/2]

void xtd::drawing::point::y ( int32  y)
noexcept

Sets the y-coordinate of this xtd::drawing::point.

Parameters
yThe x-coordinate of this xtd::drawing::point.
Examples
The following code example demonstrates how to use the Equality operator and how to construct a point from a size or two integers. It also demonstrates how to use the x and y properties. This example is designed to be used with Windows Forms (xtd.forms). Paste the code into a form that contains a button named button1, and associate the button1_click method with the button's click event.
void button1_Click(object& sender, const event_args& e) {
// Construct a new point with integers.
point point1(100, 100);
// Create a Graphics object.
graphics form_graphics = create_graphics();
// Construct another point, this time using a xtd::drawing::size.
point point2(size(100, 100));
// Call the equality operator to see if the points are equal, and if so print out their x and y values.
if (point1 == point2) {
form_graphics.draw_string(string::format("point1.x: {}, point2.x: {}, point1.y: {}, point2.y {}", point1.x(), point2.x(), point1.y(), point2.y()), font(), brushes::black, point_f(10, 70));
}
}

◆ offset() [1/2]

void xtd::drawing::point::offset ( int32  dx,
int32  dy 
)
noexcept

Translates this xtd::drawing::point by the specified amount.

Parameters
dxThe amount to offset the x-coordinate.
dyThe amount to offset the y-coordinate.

◆ offset() [2/2]

void xtd::drawing::point::offset ( const point p)
noexcept

Translates this xtd::drawing::point by the specified xtd::drawing::point.

Parameters
pThe xtd::drawing::point used offset this xtd::drawing::point.
Remarks
This method adjusts the xtd::drawing::point::x and xtd::drawing::point::y values of this xtd::drawing::point to the sum of the xtd::drawing::point::x and xtd::drawing::point::y values of this xtd::drawing::point and p.
Examples
The following example shows how to use the Offset method. To run this example, paste it into a Windows Form. Handle the form's xtd::forms::control::paint event and call the Offsetpoint method from the xtd::forms::control::paint event-handling method, passing e as xtd::forms::paint_event_args.
void offset_point(paint_event_args& e) {
point point1(10, 10);
point1.offset(50, 0);
point point2(250, 10);
e.graphics().draw_line(pens::red, point1, point2);
}
static xtd::drawing::pen red()
A system-defined pen object with a width of 1.

◆ to_string()

xtd::string xtd::drawing::point::to_string ( ) const
overridevirtualnoexcept

Converts this point to a human-readable string.

Returns
An xtd::string that represents this xtd::drawing::point.

Reimplemented from xtd::object.

◆ truncate()

static point xtd::drawing::point::truncate ( const point_f value)
staticnoexcept

Converts the specified xtd::drawing::point_f to a point by truncating the values of the xtd::drawing::point_f.

Parameters
valueThe xtd::drawing::point_f to convert.
Returns
The xtd::drawing::point this method converts to.

◆ add() [1/2]

static point xtd::drawing::point::add ( const point pt,
const size sz 
)
staticnoexcept

Adds the specified xtd::drawing::size to the specified xtd::drawing::point.

Parameters
ptThe xtd::drawing::point to add.
szThe xtd::drawing::size to add.
Returns
The xtd::drawing::point that is the result of the addition operation.
Remarks
The xtd::drawing::point::add adds the xtd::drawing::size::width and xtd::drawing::size::height of the specified size to the xtd::drawing::point::x and xtd::drawing::point::y values of the specified xtd::drawing::point.
Examples
The following example shows how to use the add method. To run this example, paste it into a Windows Form (xtd::forms. Handle the form's xtd::forms::control::paint event and call the add_point method from the paint event-handling method, passing e as paint_event_args.
void add_point(paint_event_args& e) {
point point1(10, 10);
point point2 = point::add(point1, drawing::size(250,0));
e.graphics().draw_line(pens::red, point1, point2);
}
static point add(const point &pt, const size &sz) noexcept
Adds the specified xtd::drawing::size to the specified xtd::drawing::point.

◆ add() [2/2]

static point xtd::drawing::point::add ( const point pt1,
const point pt2 
)
staticnoexcept

Adds the specified xtd::drawing::point to the specified xtd::drawing::point.

Parameters
pt1The xtd::drawing::point to add.
pt2The xtd::drawing::point to add.
Returns
The xtd::drawing::point that is the result of the addition operation.

◆ ceiling()

static point xtd::drawing::point::ceiling ( const point_f value)
staticnoexcept

Converts the specified xtd::drawing::point_f to a point by rounding the values of the xtd::drawing::point_f to the next higher integer values.

Parameters
valueThe xtd::drawing::point_f to convert.
Returns
The xtd::drawing::point this method converts to.

◆ round()

static point xtd::drawing::point::round ( const point_f value)
staticnoexcept

Converts the specified xtd::drawing::point_f to a point object by rounding the xtd::drawing::point_f values to the nearest integer.

Parameters
valueThe xtd::drawing::point_f to convert.
Returns
The xtd::drawing::point this method converts to.

◆ subtract() [1/2]

static point xtd::drawing::point::subtract ( const point pt,
const size sz 
)
staticnoexcept

Returns the result of subtracting specified xtd::drawing::size from the specified xtd::drawing::point.

Parameters
ptThe xtd::drawing::point to be subtracted from.
szThe xtd::drawing::size to subtract from the xtd::drawing::point.
Returns
The xtd::drawing::point that is the result of the subtraction operation.
Remarks
The xtd::drawing::point::subtract subtracts the xtd::drawing::size::width and xtd::drawing::size::height of the specified xtd::drawing::size from the xtd::drawing::point::x and xtd::drawing::point::y values of the specified xtd::drawing::point.

◆ subtract() [2/2]

static point xtd::drawing::point::subtract ( const point pt1,
const point pt2 
)
staticnoexcept

Returns the result of subtracting specified xtd::drawing::point from the specified xtd::drawing::point.

Parameters
pt1The xtd::drawing::point to be subtracted from.
pt2The xtd::drawing::point to subtract from the xtd::drawing::point.
Returns
The xtd::drawing::point that is the result of the subtraction operation.

◆ operator+() [1/2]

point xtd::drawing::point::operator+ ( const size sz) const
noexcept

Translates a xtd::drawing::point by a given xtd::drawing::size.

Parameters
szA xtd::drawing::size that specifies the pair of numbers to add to the coordinates of this xtd::drawing::point.
Returns
The translated xtd::drawing::point.

◆ operator+() [2/2]

point xtd::drawing::point::operator+ ( const point pt) const
noexcept

Translates a xtd::drawing::point by a given xtd::drawing::point.

Parameters
ptA xtd::drawing::point that specifies the pair of numbers to add to the coordinates of this xtd::drawing::point.
Returns
The translated xtd::drawing::point.

◆ operator+=() [1/2]

point & xtd::drawing::point::operator+= ( const size sz)
noexcept

Translates a xtd::drawing::point by a given xtd::drawing::size.

Parameters
szA xtd::drawing::size that specifies the pair of numbers to add to the coordinates of this xtd::drawing::point.
Returns
The translated xtd::drawing::point.

◆ operator+=() [2/2]

point & xtd::drawing::point::operator+= ( const point pt)
noexcept

Translates a xtd::drawing::point by a given xtd::drawing::point.

Parameters
ptA xtd::drawing::point that specifies the pair of numbers to add to the coordinates of this xtd::drawing::point.
Returns
The translated xtd::drawing::point.

◆ operator-() [1/2]

point xtd::drawing::point::operator- ( const size sz) const
noexcept

Translates a xtd::drawing::point by the negative of a given xtd::drawing::size.

Parameters
szA xtd::drawing::size that specifies the pair of numbers to subtract from the coordinates of this xtd::drawing::point.
Returns
A xtd::drawing::point structure that is translated by the negative of a given xtd::drawing::size structure.

◆ operator-() [2/2]

point xtd::drawing::point::operator- ( const point pt) const
noexcept

Translates a xtd::drawing::point by the negative of a given xtd::drawing::point.

Parameters
ptA xtd::drawing::point that specifies the pair of numbers to subtract from the coordinates of this xtd::drawing::point.
Returns
A xtd::drawing::point structure that is translated by the negative of a given xtd::drawing::size structure.

◆ operator-=() [1/2]

point & xtd::drawing::point::operator-= ( const size sz)
noexcept

Translates a xtd::drawing::point by the negative of a given xtd::drawing::size.

Parameters
szA xtd::drawing::size that specifies the pair of numbers to subtract from the coordinates of this xtd::drawing::point.
Returns
The translated xtd::drawing::point.

◆ operator-=() [2/2]

point & xtd::drawing::point::operator-= ( const point pt)
noexcept

Translates a xtd::drawing::point by the negative of a given xtd::drawing::point.

Parameters
ptA xtd::drawing::point that specifies the pair of numbers to subtract from the coordinates of this xtd::drawing::point.
Returns
The translated xtd::drawing::point.

◆ equals() [1/2]

virtual bool xtd::object::equals ( const object obj) const
virtualnoexcept

Determines whether the specified object is equal to the current object.

Parameters
objThe object to compare with the current object.
Returns
true if the specified object is equal to the current object. otherwise, false.
Examples
The following code example compares the current instance with another object.
#include <xtd/console>
using namespace xtd;
auto main() -> int {
auto object1 = new_ptr<object>();
auto object2 = new_ptr<object>();
auto object3 = object2;
console::write_line(object1->equals(*object3));
console::write_line(*object1 == *object3);
object3 = object1;
console::write_line(object1->equals(*object3));
console::write_line(*object1 == *object3);
}
// This code produces the following output :
//
// false
// false
// true
// true
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10

Reimplemented from xtd::object.

◆ equals() [2/2]

template<typename object_a_t , typename object_b_t >
static bool xtd::object::equals ( const object_a_t &  object_a,
const object_b_t &  object_b 
)
inlinestaticnoexcept

Determines whether the specified object instances are considered equal.

Parameters
object_aThe first object to compare.
object_bThe second object to compare.
Returns
true if object_a is the same instance as object_b or if both are null references or if object_a(object_b) returns true. otherwise, false.
Examples
The following code example compares different objects.
#include <xtd/console>
using namespace xtd;
auto main() -> int {
string s1 = "Tom";
string s2 = "Carol";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "Tom";
s2 = "Tom";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "";
s2 = "Tom";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "Carol";
s2 = "";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
s1 = "";
s2 = "";
console::write_line("object::equals(\"{0}\", \"{1}\") => {2}", s1, s2, object::equals(s1, s2));
}
// This code produces the following output :
//
// object::equals("Tom", "Carol") => false
// object::equals("Tom", "Tom") => true
// object::equals("", "Tom") => false
// object::equals("Carol", "") => false
// object::equals("", "") => true
virtual bool equals(const object &obj) const noexcept
Determines whether the specified object is equal to the current object.

Member Data Documentation

◆ empty

const point xtd::drawing::point::empty
static

Represents a xtd::drawing::point that has xtd::drawing::point::x and xtd::drawing::point::y values set to zero.


The documentation for this class was generated from the following file: