template<class char_t>
class xtd::basic_string_comparer< char_t >
Represents a string comparison operation that uses specific case and culture-based or ordinal comparison rules.
- Definition
template<class char_t>
Represents a string comparison operation that uses specific case and culture-based or ordinal compari...
Definition basic_string_comparer.hpp:32
Exposes a method that compares two objects.
Definition icomparer.hpp:30
Defines methods to support the comparison of objects for equality.
Definition iequality_comparer.hpp:34
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:43
- Header
#include <xtd/basic_string_comparer
- Namespace
- xtd
- Library
- xtd.core
|
template<class object_t > |
int32 | compare (const object_t &x, const object_t &y) const |
| When overridden in a derived class, compares two objects and returns an indication of their relative sort order.
|
|
int32 | compare (const xtd::basic_string< char_t > &x, const xtd::basic_string< char_t > &y) const noexcept override |
| When overridden in a derived class, compares two strings and returns an indication of their relative sort order.
|
|
bool | equals (const object &obj) const noexcept override |
| Determines whether the specified object is equal to the current object.
|
|
template<class object_t > |
bool | equals (const object_t &x, const object_t &y) const |
| When overridden in a derived class, indicates whether two objects are equal.
|
|
bool | equals (const xtd::basic_string< char_t > &x, const xtd::basic_string< char_t > &y) const noexcept override |
| When overridden in a derived class, indicates whether two strings are equal.
|
|
template<class object_t > |
xtd::size | get_hash_code (const object_t &obj) const |
| When overridden in a derived class, gets the hash code for the specified object.
|
|
xtd::size | get_hash_code (const xtd::basic_string< char_t > &obj) const noexcept override |
| When overridden in a derived class, gets the hash code for the specified string.
|
|
|
| object ()=default |
| Create a new instance of the ultimate base class object.
|
|
virtual xtd::size | 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<class object_t > |
xtd::uptr< object_t > | memberwise_clone () const |
| Creates a shallow copy of the current object.
|
|
virtual xtd::string | to_string () const noexcept |
| Returns a xtd::string that represents the current object.
|
|
virtual int32 | compare (const xtd::basic_string< char_t > &x, const xtd::basic_string< char_t > &y) const=0 |
| Compares two entities and returns a value indicating whether one is less than, equal to, or greater than the other.
|
|
template<class object_a_t , class 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<class object_a_t , class 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.
|
|
◆ basic_string_comparer()
Initializes a new instance of the xtd::basic_string_comparer class.
- Todo:
- Uncomment following lines when xtd::globalization::culture_info and xtd::globalization::compare_options are developped.
- Todo:
- Uncomment following lines when xtd::globalization::culture_info and xtd::globalization::compare_options are developped.
◆ current_culture()
◆ current_culture_ignore_case()
Gets a xtd::basic_string_comparer object that performs case-insensitive string comparisons using the word comparison rules of the current culture.
- Returns
- A xtd::basic_string_comparer object.
- Note
- xtd running on Linux and macOS systems only: The collation behavior for the C and Posix cultures is always case-sensitive because these cultures do not use the expected Unicode collation order. We recommend that you use a culture other than C or Posix for performing culture-sensitive, case-insensitive sorting operations.
- Todo:
- Uncomment following lines when xtd::globalization::culture_info and xtd::globalization::compare_options are developped.
◆ invariant_culture()
- Todo:
- Uncomment following lines when xtd::globalization::culture_info and xtd::globalization::compare_options are developped.
◆ invariant_culture_ignore_case()
- Todo:
- Uncomment following lines when xtd::globalization::culture_info and xtd::globalization::compare_options are developped.
◆ ordinal()
◆ ordinal_ignore_case()
◆ compare() [1/2]
template<class char_t >
template<class object_t >
When overridden in a derived class, compares two objects and returns an indication of their relative sort order.
- Parameters
-
x | An object to compare to y . |
y | An object to compare to x . |
- Returns
- A signed integer that indicates the relative values of
x
and y
, as shown in the following table.
Value | Meaning |
Less than zero | x precedes y in the sort order. |
Zero | x is equal to y . |
Greater than zero | x follows y in the sort order. |
- Exceptions
-
◆ compare() [2/2]
template<class char_t >
|
inlineoverridevirtualnoexcept |
When overridden in a derived class, compares two strings and returns an indication of their relative sort order.
- Parameters
-
x | An object to compare to y . |
y | An object to compare to x . |
- Returns
- A signed integer that indicates the relative values of
x
and y
, as shown in the following table.
Value | Meaning |
Less than zero | x precedes y in the sort order. |
Zero | x is equal to y . |
Greater than zero | x follows y in the sort order. |
- Todo:
- Uncomment following lines when xtd::globalization::culture_info and xtd::globalization::compare_options are developped.
Implements xtd::collections::generic::icomparer< xtd::basic_string< char_t > >.
◆ equals() [1/3]
template<class char_t >
|
inlineoverridevirtualnoexcept |
Determines whether the specified object is equal to the current object.
- Parameters
-
obj | The 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>
auto main() -> int {
auto object1 = new_ptr<object>();
auto object2 = new_ptr<object>();
auto object3 = object2;
object3 = object1;
}
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Reimplemented from xtd::object.
◆ equals() [2/3]
template<class char_t >
template<class object_t >
When overridden in a derived class, indicates whether two objects are equal.
- Parameters
-
x | An object to compare to y . |
y | An object to compare to x . |
- Returns
true
if x
and y
refer to the same object, or x
and y
are both the same type of object and those objects are equal; otherwise, false
.
◆ equals() [3/3]
template<class char_t >
|
inlineoverridevirtualnoexcept |
When overridden in a derived class, indicates whether two strings are equal.
- Parameters
-
x | An object to compare to y . |
y | An object to compare to x . |
- Returns
true
if x
and y
refer to the same object, or x
and y
are both the same type of object and those objects are equal; otherwise, false
.
- Todo:
- Uncomment following lines when xtd::globalization::culture_info and xtd::globalization::compare_options are developped.
Implements xtd::collections::generic::iequality_comparer< xtd::basic_string< char_t > >.
◆ get_hash_code() [1/2]
template<class char_t >
template<class object_t >
When overridden in a derived class, gets the hash code for the specified object.
- Parameters
-
- Returns
- A xtd::size hash code calculated from the value of the obj parameter.
◆ get_hash_code() [2/2]
template<class char_t >
|
inlineoverridevirtualnoexcept |
◆ from_comparison()
◆ is_well_known_ordinal_comparer()
Determines whether the specified xtd::collections::generic::iequality_comparer <type_t> is a well-known ordinal string comparer.
- Todo:
- Uncomment following lines when xtd::globalization::culture_info and xtd::globalization::compare_options are developped.
- Parameters
-
comparer | The comparer to query. |
ignore_case | When this method returns, contains a value stating whether comparer is case-insensitive. Set to false if this method returns false . |
- Returns
true
if comparer is a well-known ordinal string comparer; otherwise, false
.
The documentation for this class was generated from the following file: