xtd 0.2.0
Loading...
Searching...
No Matches
xtd::box_char< type_t > Class Template Reference
Inheritance diagram for xtd::box_char< type_t >:
xtd::box_integer< type_t > xtd::box< type_t > xtd::object xtd::icomparable< box< type_t > > xtd::iequatable< box< type_t > > xtd::iformatable xtd::interface xtd::comparison_operators< type_t, comparable_t > xtd::interface xtd::equality_operators< type_t, equatable_t > xtd::interface

Definition

template<typename type_t>
class xtd::box_char< type_t >

Represents a boxed char object.

class box_char : public xtd::box_integer<type_t>
Represents a boxed char object.
Definition box_char.h:38
Represents a boxed integer object.
Definition box_integer.h:52
Inheritance
xtd::objectxtd::box <type_t> → xtd::box_integer <type_t> → xtd::box_char <type_t>
Header
#include <xtd/box_char>
Namespace
xtd
Library
xtd.core
Remarks
You can use xtd::box to represent a class or structure that does not inherit from xtd::object. Typically used for integral types.
Use xtd::boxing to box an object.
Use xtd::unboxing to unbox an object.
For more information about types, see Native types, boxing and unboxing.
Examples
The following example shows how to create and use xtd::box_char<char8>.
auto stringer = [](const object& value) {return value.to_string();};
char8 unboxed_object = u8'a';
box_char<char8> boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = a;
const type_t & value() const noexcept
Gets the underlying value.
Definition box.h:85
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
char8_t char8
Represents a 8-bit unicode character.
Definition char8.h:27

Public Static Methods

static bool is_ascii (type_t c) noexcept
 Returns true if c is an ASCII character ([ U+0000..U+007F ]).
 
static bool is_ascii (const string &s, size_t index)
 Indicates whether the character at the specified position in a specified string is an ASCII character ([ U+0000..U+007F ]).
 
static bool is_control (type_t c) noexcept
 Indicates whether the specified Unicode character is categorized as a control character.
 
static bool is_control (const string &s, size_t index)
 Indicates whether the character at the specified position in a specified string is categorized as a control character.
 
static bool is_digit (type_t c) noexcept
 Indicates whether the specified Unicode character is categorized as a decimal digit.
 
static bool is_digit (const string &s, size_t index)
 Indicates whether the character at the specified position in a specified string is categorized as a decimal digit.
 
static bool is_letter (type_t c) noexcept
 Indicates whether the specified Unicode character is categorized as a Unicode letter.
 
static bool is_letter (const string &s, size_t index)
 Indicates whether the character at the specified position in a specified string is categorized as a Unicode letter.
 
static bool is_letter_or_digit (type_t c) noexcept
 Indicates whether a Unicode character is categorized as a letter or a decimal digit.
 
static bool is_letter_or_digit (const string &s, size_t index)
 Indicates whether the character at the specified position in a specified string is categorized as a letter or a decimal digit.
 
static bool is_lower (type_t c) noexcept
 ndicates whether the specified Unicode character is categorized as a lowercase letter.
 
static bool is_lower (const string &s, size_t index)
 Indicates whether the character at the specified position in a specified string is categorized as a lowercase letter.
 
static bool is_number (type_t c) noexcept
 Indicates whether a Unicode character is categorized as a number.
 
static bool is_number (const string &s, size_t index)
 Indicates whether the character at the specified position in a specified string is categorized as a number.
 
static bool is_punctuation (type_t c) noexcept
 Indicates whether the specified Unicode character is categorized as a punctuation mark.
 
static bool is_punctuation (const string &s, size_t index)
 Indicates whether the character at the specified position in a specified string is categorized as a punctuation mark.
 
static bool is_separator (type_t c) noexcept
 Indicates whether the specified Unicode character is categorized as a separator character.
 
static bool is_separator (const string &s, size_t index)
 Indicates whether the character at the specified position in a specified string is categorized as a separator character.
 
static bool is_symbol (type_t c) noexcept
 Indicates whether the specified Unicode character is categorized as a symbol character.
 
static bool is_symbol (const string &s, size_t index)
 Indicates whether the character at the specified position in a specified string is categorized as a symbol character.
 
static bool is_upper (type_t c) noexcept
 Indicates whether the specified Unicode character is categorized as an uppercase letter.
 
static bool is_upper (const string &s, size_t index)
 Indicates whether the character at the specified position in a specified string is categorized as an uppercase letter.
 
static bool is_white_space (type_t c) noexcept
 Indicates whether the specified Unicode character is categorized as white space.
 
static bool is_white_space (const string &s, size_t index)
 Indicates whether the character at the specified position in a specified string is categorized as white space.
 
static char to_lower (type_t c) noexcept
 Converts the value of a Unicode character to its lowercase equivalent.
 
static char to_upper (type_t c) noexcept
 Converts the value of a Unicode character to its uppercase equivalent.
 

Additional Inherited Members

- Public Types inherited from xtd::box< type_t >
using underlying_type = type_t
 
- Static Public Attributes inherited from xtd::box_integer< type_t >
static constexpr type_t max_value
 Represents the largest possible value of type_t. This field is constant.
 
static constexpr type_t min_value
 Represents the smallest possible value of type_t. This field is constant.
 
- Public Member Functions inherited from xtd::box< type_t >
 box ()=default
 Initialize a new xtd::box object.
 
 box (const type_t &value)
 Initialize a new xtd::box object with specified value.
 
template<typename ... args_t>
 box (args_t &&...args)
 Initialize a new xtd::box object with specified value.
 
const type_t & value () const noexcept
 Gets the underlying value.
 
type_t & value () noexcept
 Gets the underlying value.
 
boxvalue (const type_t &value)
 Sets de underlying value.
 
 operator type_t () const noexcept
 
int32 compare_to (const box &value) const noexcept override
 Compares the current instance with another object of the same type.
 
bool equals (const object &obj) const noexcept override
 Determines whether the specified object is equal to the current object.
 
bool equals (const box &value) const noexcept override
 Indicates whether the current object is equal to another object of the same type.
 
xtd::string to_string () const noexcept override
 Returns a xtd::string that represents the current object.
 
xtd::string to_string (const xtd::string &format) const
 Converts the value of this instance to its equivalent string representation, using the specified format.
 
xtd::string to_string (const xtd::string &format, const std::locale &loc) const override
 Converts the value of this instance to its equivalent string representation, using the specified format, and locale.
 
- 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::icomparable< box< type_t > >
- Public Member Functions inherited from xtd::iequatable< box< type_t > >
- Public Member Functions inherited from xtd::iformatable
- Static Public Member Functions inherited from xtd::box_integer< type_t >
static type_t parse (const xtd::string &value, xtd::number_styles styles)
 Converts the string to its type_t equivalent.
 
static bool parse (const xtd::string &value, type_t &result, xtd::number_styles styles)
 Converts the string to its type_t equivalent.
 
- Static Public Member Functions inherited from xtd::box< type_t >
static type_t parse (const xtd::string &value)
 Converts the string to its type_t equivalent.
 
static bool try_parse (const xtd::string &value, type_t &result) noexcept
 Converts the string to its type_t equivalent. A return value indicates whether the conversion succeeded or failed.
 
- 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.
 

Member Function Documentation

◆ is_ascii() [1/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_ascii ( type_t  c)
inlinestaticnoexcept

Returns true if c is an ASCII character ([ U+0000..U+007F ]).

Parameters
cThe character to analyze.
Returns
true if c is an ASCII character; false otherwise.

◆ is_ascii() [2/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_ascii ( const string s,
size_t  index 
)
inlinestatic

Indicates whether the character at the specified position in a specified string is an ASCII character ([ U+0000..U+007F ]).

Parameters
sA string.
indexThe position of the character to evaluate in s.
Returns
true if the character at position index in s is n ASCII character; otherwise, false.
Exceptions
xtd::argument_out_of_range_exceptionindex is greater than the last position in s.

◆ is_control() [1/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_control ( type_t  c)
inlinestaticnoexcept

Indicates whether the specified Unicode character is categorized as a control character.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is a control character; otherwise, false.

◆ is_control() [2/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_control ( const string s,
size_t  index 
)
inlinestatic

Indicates whether the character at the specified position in a specified string is categorized as a control character.

Parameters
sA string.
indexThe position of the character to evaluate in s.
Returns
true if the character at position index in s is a control character; otherwise, false.
Exceptions
xtd::argument_out_of_range_exceptionindex is greater than the last position in s.

◆ is_digit() [1/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_digit ( type_t  c)
inlinestaticnoexcept

Indicates whether the specified Unicode character is categorized as a decimal digit.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is a decimal digit; otherwise, false.
Remarks
This method determines whether a type_tis a radix-10 digit. This contrasts with is_number, which determines whether a Char is of any numeric Unicode category. Numbers include characters such as fractions, subscripts, superscripts, Roman numerals, currency numerators, encircled numbers, and script-specific digits.

◆ is_digit() [2/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_digit ( const string s,
size_t  index 
)
inlinestatic

Indicates whether the character at the specified position in a specified string is categorized as a decimal digit.

Parameters
sA string.
indexThe position of the character to evaluate in s.
Returns
true if the character at position index in s is decimal digit; otherwise, false.
Exceptions
xtd::argument_out_of_range_exceptionindex is greater than the last position in s.

◆ is_letter() [1/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_letter ( type_t  c)
inlinestaticnoexcept

Indicates whether the specified Unicode character is categorized as a Unicode letter.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is a letter; otherwise, false.

◆ is_letter() [2/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_letter ( const string s,
size_t  index 
)
inlinestatic

Indicates whether the character at the specified position in a specified string is categorized as a Unicode letter.

Parameters
sA string.
indexThe position of the character to evaluate in s.
Returns
true if the character at position index in s is a letter; otherwise, false.
Exceptions
xtd::argument_out_of_range_exceptionindex is greater than the last position in s.

◆ is_letter_or_digit() [1/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_letter_or_digit ( type_t  c)
inlinestaticnoexcept

Indicates whether a Unicode character is categorized as a letter or a decimal digit.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is a letter or a decimal digit; otherwise, false.

◆ is_letter_or_digit() [2/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_letter_or_digit ( const string s,
size_t  index 
)
inlinestatic

Indicates whether the character at the specified position in a specified string is categorized as a letter or a decimal digit.

Parameters
sA string.
indexThe position of the character to evaluate in s.
Returns
true if the character at position index in s is a letter or a decimal digit; otherwise, false.
Exceptions
xtd::argument_out_of_range_exceptionindex is greater than the last position in s.

◆ is_lower() [1/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_lower ( type_t  c)
inlinestaticnoexcept

ndicates whether the specified Unicode character is categorized as a lowercase letter.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is a lowercase letter; otherwise, false.

◆ is_lower() [2/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_lower ( const string s,
size_t  index 
)
inlinestatic

Indicates whether the character at the specified position in a specified string is categorized as a lowercase letter.

Parameters
sA string.
indexThe position of the character to evaluate in s.
Returns
true if the character at position index in s is a lowercase letter; otherwise, false.
Exceptions
xtd::argument_out_of_range_exceptionindex is greater than the last position in s.

◆ is_number() [1/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_number ( type_t  c)
inlinestaticnoexcept

Indicates whether a Unicode character is categorized as a number.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is a number; otherwise, false.

◆ is_number() [2/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_number ( const string s,
size_t  index 
)
inlinestatic

Indicates whether the character at the specified position in a specified string is categorized as a number.

Parameters
sA string.
indexThe position of the character to evaluate in s.
Returns
true if the character at position index in s is a number; otherwise, false.
Exceptions
xtd::argument_out_of_range_exceptionindex is greater than the last position in s.

◆ is_punctuation() [1/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_punctuation ( type_t  c)
inlinestaticnoexcept

Indicates whether the specified Unicode character is categorized as a punctuation mark.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is a punctuation mark; otherwise, false.

◆ is_punctuation() [2/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_punctuation ( const string s,
size_t  index 
)
inlinestatic

Indicates whether the character at the specified position in a specified string is categorized as a punctuation mark.

Parameters
sA string.
indexThe position of the character to evaluate in s.
Returns
true if the character at position index in s is categorized as a punctuation mark.
Exceptions
xtd::argument_out_of_range_exceptionindex is greater than the last position in s.

◆ is_separator() [1/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_separator ( type_t  c)
inlinestaticnoexcept

Indicates whether the specified Unicode character is categorized as a separator character.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is a separator character; otherwise, false.

◆ is_separator() [2/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_separator ( const string s,
size_t  index 
)
inlinestatic

Indicates whether the character at the specified position in a specified string is categorized as a separator character.

Parameters
sA string.
indexThe position of the character to evaluate in s.
Returns
true if the character at position index in s is categorized as a separator character.
Exceptions
xtd::argument_out_of_range_exceptionindex is greater than the last position in s.

◆ is_symbol() [1/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_symbol ( type_t  c)
inlinestaticnoexcept

Indicates whether the specified Unicode character is categorized as a symbol character.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is a symbol character; otherwise, false.

◆ is_symbol() [2/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_symbol ( const string s,
size_t  index 
)
inlinestatic

Indicates whether the character at the specified position in a specified string is categorized as a symbol character.

Parameters
sA string.
indexThe position of the character to evaluate in s.
Returns
true if the character at position index in s is a symbol character; otherwise, false.
Exceptions
xtd::argument_out_of_range_exceptionindex is greater than the last position in s.

◆ is_upper() [1/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_upper ( type_t  c)
inlinestaticnoexcept

Indicates whether the specified Unicode character is categorized as an uppercase letter.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is an uppercase letter; otherwise, false.

◆ is_upper() [2/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_upper ( const string s,
size_t  index 
)
inlinestatic

Indicates whether the character at the specified position in a specified string is categorized as an uppercase letter.

Parameters
sA string.
indexThe position of the character to evaluate in s.
Returns
true if the character at position index in s is an uppercase letter; otherwise, false.
Exceptions
xtd::argument_out_of_range_exceptionindex is greater than the last position in s.

◆ is_white_space() [1/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_white_space ( type_t  c)
inlinestaticnoexcept

Indicates whether the specified Unicode character is categorized as white space.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is white space; otherwise, false.

◆ is_white_space() [2/2]

template<typename type_t >
static bool xtd::box_char< type_t >::is_white_space ( const string s,
size_t  index 
)
inlinestatic

Indicates whether the character at the specified position in a specified string is categorized as white space.

Parameters
sA string.
indexThe position of the character to evaluate in s.
Returns
true if the character at position index in s is white space; otherwise, false.
Exceptions
xtd::argument_out_of_range_exceptionindex is greater than the last position in s.

◆ to_lower()

template<typename type_t >
static char xtd::box_char< type_t >::to_lower ( type_t  c)
inlinestaticnoexcept

Converts the value of a Unicode character to its lowercase equivalent.

Parameters
cThe Unicode character to convert.
Returns
The lowercase equivalent of c, or the unchanged value of c, if c is already lowercase or not alphabetic.

◆ to_upper()

template<typename type_t >
static char xtd::box_char< type_t >::to_upper ( type_t  c)
inlinestaticnoexcept

Converts the value of a Unicode character to its uppercase equivalent.

Parameters
cThe Unicode character to convert.
Returns
The uppercase equivalent of c, or the unchanged value of c if c is already uppercase, has no uppercase equivalent, or is not alphabetic.

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