xtd 0.2.0
Loading...
Searching...
No Matches
box_char.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "box_integer.hpp"
6
8namespace xtd {
37 template<class type_t>
38 class box_char : public xtd::box_integer<type_t> {
39 public:
41 box_char() = default;
42 box_char(const type_t& value) : box_integer<type_t>(value) {}
43 box_char(const box_char&) = default;
44 box_char(box_char&&) = default;
45 box_char& operator =(const box_char&) = default;
47
49
54 [[nodiscard]] static auto is_ascii(type_t c) noexcept -> bool {return c > 0 && c <= 0x7F;}
60 [[nodiscard]] static auto is_ascii(const string& s, size_t index) -> bool {return is_ascii(s[index]);}
61
65 [[nodiscard]] static auto is_control(type_t c) noexcept -> bool {return std::iscntrl(static_cast<int>(c)) != 0;}
71 [[nodiscard]] static auto is_control(const string& s, size_t index) -> bool {return is_control(s[index]);}
72
77 [[nodiscard]] static auto is_digit(type_t c) noexcept -> bool {return std::isdigit(static_cast<int>(c)) != 0;}
83 [[nodiscard]] static auto is_digit(const string& s, size_t index) -> bool {return is_digit(s[index]);}
84
88 [[nodiscard]] static auto is_letter(type_t c) noexcept -> bool {return std::isalpha(static_cast<int>(c)) != 0;}
94 [[nodiscard]] static auto is_letter(const string& s, size_t index) -> bool {return is_letter(s[index]);}
95
99 [[nodiscard]] static auto is_letter_or_digit(type_t c) noexcept -> bool {return std::isalnum(static_cast<int>(c)) != 0;}
105 [[nodiscard]] static auto is_letter_or_digit(const string& s, size_t index) -> bool {return is_letter_or_digit(s[index]);}
106
110 [[nodiscard]] static auto is_lower(type_t c) noexcept -> bool {return std::islower(static_cast<int>(c)) != 0;}
116 [[nodiscard]] static auto is_lower(const string& s, size_t index) -> bool {return is_lower(s[index]);}
117
121 [[nodiscard]] static auto is_number(type_t c) noexcept -> bool {return std::isdigit(static_cast<int>(c)) != 0;}
127 [[nodiscard]] static auto is_number(const string& s, size_t index) -> bool {return is_number(s[index]);}
128
132 [[nodiscard]] static auto is_punctuation(type_t c) noexcept -> bool {return std::ispunct(static_cast<int>(c)) != 0;}
138 [[nodiscard]] static auto is_punctuation(const string& s, size_t index) -> bool {return is_punctuation(s[index]);}
139
143 [[nodiscard]] static auto is_separator(type_t c) noexcept -> bool {return std::isspace(static_cast<int>(c)) != 0 || c == '\n';}
149 [[nodiscard]] static auto is_separator(const string& s, size_t index) -> bool {return is_separator(s[index]);}
150
154 [[nodiscard]] static auto is_symbol(type_t c) noexcept -> bool {return std::isgraph(static_cast<int>(c)) != 0 || c == 0x9C;}
160 [[nodiscard]] static auto is_symbol(const string& s, size_t index) -> bool {return is_symbol(s[index]);}
161
165 [[nodiscard]] static auto is_upper(type_t c) noexcept -> bool {return std::isupper(static_cast<int>(c)) != 0;}
171 [[nodiscard]] static auto is_upper(const string& s, size_t index) -> bool {return is_upper(s[index]);}
172
176 [[nodiscard]] static auto is_white_space(type_t c) noexcept -> bool {return std::isspace(static_cast<int>(c)) != 0;}
182 [[nodiscard]] static auto is_white_space(const string& s, size_t index) -> bool {return is_white_space(s[index]);}
183
187 [[nodiscard]] static auto to_lower(type_t c) noexcept -> type_t {return static_cast<type_t>(std::tolower(static_cast<int>(c)));}
188
192 [[nodiscard]] static auto to_upper(type_t c) noexcept -> type_t {return static_cast<type_t>(std::toupper(static_cast<int>(c)));}
194 };
195}
Contains xtd::box_integer class.
Represents a boxed char object.
Definition box_char.hpp:38
static auto is_letter(type_t c) noexcept -> bool
Indicates whether the specified Unicode character is categorized as a Unicode letter.
Definition box_char.hpp:88
static auto is_ascii(const string &s, size_t index) -> bool
Indicates whether the character at the specified position in a specified string is an ASCII character...
Definition box_char.hpp:60
static auto to_upper(type_t c) noexcept -> type_t
Converts the value of a Unicode character to its uppercase equivalent.
Definition box_char.hpp:192
static auto is_punctuation(type_t c) noexcept -> bool
Indicates whether the specified Unicode character is categorized as a punctuation mark.
Definition box_char.hpp:132
static auto is_number(type_t c) noexcept -> bool
Indicates whether a Unicode character is categorized as a number.
Definition box_char.hpp:121
static auto is_control(type_t c) noexcept -> bool
Indicates whether the specified Unicode character is categorized as a control character.
Definition box_char.hpp:65
static auto is_punctuation(const string &s, size_t index) -> bool
Indicates whether the character at the specified position in a specified string is categorized as a p...
Definition box_char.hpp:138
static auto is_ascii(type_t c) noexcept -> bool
Returns true if c is an ASCII character ([ U+0000..U+007F ]).
Definition box_char.hpp:54
static auto is_number(const string &s, size_t index) -> bool
Indicates whether the character at the specified position in a specified string is categorized as a n...
Definition box_char.hpp:127
static auto is_upper(type_t c) noexcept -> bool
Indicates whether the specified Unicode character is categorized as an uppercase letter.
Definition box_char.hpp:165
static auto to_lower(type_t c) noexcept -> type_t
Converts the value of a Unicode character to its lowercase equivalent.
Definition box_char.hpp:187
static auto is_separator(const string &s, size_t index) -> bool
Indicates whether the character at the specified position in a specified string is categorized as a s...
Definition box_char.hpp:149
static auto is_separator(type_t c) noexcept -> bool
Indicates whether the specified Unicode character is categorized as a separator character.
Definition box_char.hpp:143
static auto is_lower(const string &s, size_t index) -> bool
Indicates whether the character at the specified position in a specified string is categorized as a l...
Definition box_char.hpp:116
static auto is_letter_or_digit(type_t c) noexcept -> bool
Indicates whether a Unicode character is categorized as a letter or a decimal digit.
Definition box_char.hpp:99
static auto is_symbol(const string &s, size_t index) -> bool
Indicates whether the character at the specified position in a specified string is categorized as a s...
Definition box_char.hpp:160
static auto is_digit(type_t c) noexcept -> bool
Indicates whether the specified Unicode character is categorized as a decimal digit.
Definition box_char.hpp:77
static auto is_white_space(type_t c) noexcept -> bool
Indicates whether the specified Unicode character is categorized as white space.
Definition box_char.hpp:176
static auto is_letter_or_digit(const string &s, size_t index) -> bool
Indicates whether the character at the specified position in a specified string is categorized as a l...
Definition box_char.hpp:105
static auto is_upper(const string &s, size_t index) -> bool
Indicates whether the character at the specified position in a specified string is categorized as an ...
Definition box_char.hpp:171
static auto is_digit(const string &s, size_t index) -> bool
Indicates whether the character at the specified position in a specified string is categorized as a d...
Definition box_char.hpp:83
static auto is_lower(type_t c) noexcept -> bool
ndicates whether the specified Unicode character is categorized as a lowercase letter.
Definition box_char.hpp:110
static auto is_symbol(type_t c) noexcept -> bool
Indicates whether the specified Unicode character is categorized as a symbol character.
Definition box_char.hpp:154
static auto is_white_space(const string &s, size_t index) -> bool
Indicates whether the character at the specified position in a specified string is categorized as whi...
Definition box_char.hpp:182
static auto is_control(const string &s, size_t index) -> bool
Indicates whether the character at the specified position in a specified string is categorized as a c...
Definition box_char.hpp:71
static auto is_letter(const string &s, size_t index) -> bool
Indicates whether the character at the specified position in a specified string is categorized as a U...
Definition box_char.hpp:94
Represents a boxed integer object.
Definition box_integer.hpp:55
@ s
The S key.
Definition console_key.hpp:124
@ c
The C key.
Definition console_key.hpp:92
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
value_type value
Gets or sets the underlying value.
Definition box.hpp:106