34constexpr char hexdigit(
unsigned X,
bool LowerCase =
false) noexcept {
35 const char HexChar = LowerCase ?
'a' :
'A';
36 return X < 10 ?
'0' + X : HexChar + X - 10;
44 if (C >=
'0' && C <=
'9') {
47 if (C >=
'a' && C <=
'f') {
50 if (C >=
'A' && C <=
'F') {
58 return C >=
'0' && C <=
'9';
68 return (
'a' <= C && C <=
'z') || (
'A' <= C && C <=
'Z');
79 return static_cast<unsigned char>(C) <= 127;
87 unsigned char UC =
static_cast<unsigned char>(C);
88 return (0x20 <= UC) && (UC <= 0x7E);
93 if (x >=
'A' && x <=
'Z') {
101 if (x >=
'a' && x <=
'z') {
102 return x -
'a' +
'A';
108 bool lowerCase =
false) {
117 unsigned char mod =
static_cast<unsigned char>(val) & 15;
122 return std::string(bufptr,
std::end(buf));
130 auto length = lhs.size();
131 return length == rhs.size() && std::string_view::traits_type::compare(
132 lhs.data(), rhs.data(), length) == 0;
145 return lhs.size() == rhs.size() &&
compare_lower(lhs, rhs) == 0;
156 std::string_view::size_type
from = 0) noexcept;
188 std::string_view::size_type
from = std::string_view::npos)
noexcept;
206 const char* other)
noexcept {
223 std::string_view::size_type n = std::string_view::npos)
noexcept {
224 auto length = str.size();
226 return {str.data() + start, (
std::min)(n, length - start)};
234 return substr(str, 0, prefix.size()) == prefix;
241 return !str.empty() && std::string_view::traits_type::eq(str.front(), prefix);
267 const char* prefix)
noexcept {
276 return str.size() >= suffix.size() &&
277 str.compare(str.size() - suffix.size(), std::string_view::npos,
285 return !str.empty() && std::string_view::traits_type::eq(str.back(), suffix);
318 return str.find(other) != std::string_view::npos;
325 return str.find(ch) != std::string_view::npos;
332 return str.find(other) != std::string_view::npos;
340 return find_lower(str, other) != std::string_view::npos;
347 return find_lower(str, ch) != std::string_view::npos;
354 return find_lower(str, other) != std::string_view::npos;
363 str.remove_prefix(n);
372 str.remove_suffix(n);
383 auto length = str.size();
397 auto length = str.size();
418 std::string_view::size_type start,
419 std::string_view::size_type
end)
noexcept {
420 auto length = str.size();
423 return {str.data() + start,
end - start};
438constexpr std::pair<std::string_view, std::string_view>
split(
440 auto idx = str.find(separator);
441 if (idx == std::string_view::npos) {
444 return {
slice(str, 0, idx),
slice(str, idx + 1, std::string_view::npos)};
459constexpr std::pair<std::string_view, std::string_view>
split(
461 auto idx = str.find(separator);
462 if (idx == std::string_view::npos) {
465 return {
slice(str, 0, idx),
466 slice(str, idx + separator.size(), std::string_view::npos)};
481constexpr std::pair<std::string_view, std::string_view>
rsplit(
483 auto idx = str.rfind(separator);
484 if (idx == std::string_view::npos) {
487 return {
slice(str, 0, idx),
slice(str, idx + 1, std::string_view::npos)};
502constexpr std::pair<std::string_view, std::string_view>
rsplit(
504 auto idx = str.rfind(separator);
505 if (idx == std::string_view::npos) {
508 return {
slice(str, 0, idx),
509 slice(str, idx + separator.size(), std::string_view::npos)};
530 bool keepEmpty =
true) noexcept;
550 char separator,
int maxSplit = -1,
bool keepEmpty = true) noexcept;
575 str, str.size() - (
std::min)(str.size(), str.find_last_not_of(ch) + 1));
586 str.size() - (
std::min)(str.size(), str.find_last_not_of(chars) + 1));
609 unsigned long long&
result)
noexcept;
611 long long&
result)
noexcept;
615 unsigned long long&
result)
noexcept;
617 long long&
result)
noexcept;
632 unsigned radix)
noexcept {
635 static_cast<T
>(val) != val) {
644 unsigned radix)
noexcept {
645 using Int =
unsigned long long;
651 static_cast<Int
>(
static_cast<T
>(val)) != val) {
671 unsigned radix)
noexcept {
672 using Int =
long long;
675 static_cast<Int
>(
static_cast<T
>(val)) != val) {
684 unsigned radix)
noexcept {
685 using Int =
unsigned long long;
688 static_cast<Int
>(
static_cast<T
>(val)) != val) {
and restrictions which apply to each piece of software is included later in this file and or inside of the individual applicable source files The disclaimer of warranty in the WPILib license above applies to all code in and nothing in any of the other licenses gives permission to use the names of FIRST nor the names of the WPILib contributors to endorse or promote products derived from this software The following pieces of software have additional or alternate and or Google Inc All rights reserved Redistribution and use in source and binary with or without are permitted provided that the following conditions are this list of conditions and the following disclaimer *Redistributions in binary form must reproduce the above copyright this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution *Neither the name of Google Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR EVEN IF ADVISED OF THE POSSIBILITY OF SUCH January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable from
Definition: ThirdPartyNotices.txt:131
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:557
basic_string_view< char > string_view
Definition: core.h:520
T mod(T x, int y)
Definition: chrono.h:1413
constexpr common_t< T1, T2 > max(const T1 x, const T2 y) noexcept
Compile-time pairwise maximum function.
Definition: max.hpp:35
constexpr common_t< T1, T2 > min(const T1 x, const T2 y) noexcept
Compile-time pairwise minimum function.
Definition: min.hpp:35
static EIGEN_DEPRECATED const end_t end
Definition: IndexedViewHelper.h:181
result
Definition: format.h:2556
Definition: StdDeque.h:50
bool GetAsSignedInteger(std::string_view str, unsigned radix, long long &result) noexcept
bool ConsumeUnsignedInteger(std::string_view &str, unsigned radix, unsigned long long &result) noexcept
bool GetAsUnsignedInteger(std::string_view str, unsigned radix, unsigned long long &result) noexcept
bool ConsumeSignedInteger(std::string_view &str, unsigned radix, long long &result) noexcept
/file This file defines the SmallVector class.
Definition: AprilTagFieldLayout.h:18
constexpr char hexdigit(unsigned X, bool LowerCase=false) noexcept
hexdigit - Return the hexadecimal character for the given number X (which should be less than 16).
Definition: StringExtras.h:34
constexpr std::string_view slice(std::string_view str, std::string_view::size_type start, std::string_view::size_type end) noexcept
Returns a reference to the substring of str from [start, end).
Definition: StringExtras.h:417
constexpr std::pair< std::string_view, std::string_view > split(std::string_view str, char separator) noexcept
Splits str into two substrings around the first occurrence of a separator character.
Definition: StringExtras.h:438
int compare_lower(std::string_view lhs, std::string_view rhs) noexcept
compare_lower - Compare two strings, ignoring case.
constexpr std::string_view ltrim(std::string_view str, char ch) noexcept
Returns str with consecutive ch characters starting from the the left removed.
Definition: StringExtras.h:556
std::optional< double > parse_float< double >(std::string_view str) noexcept
constexpr bool isAlnum(char C) noexcept
Checks whether character C is either a decimal digit or an uppercase or lowercase letter as classifie...
Definition: StringExtras.h:73
std::optional< T > consume_integer(std::string_view *str, unsigned radix) noexcept
Parses the string str as an integer of the specified radix.
Definition: StringExtras.h:670
std::string_view::size_type find_lower(std::string_view str, char ch, std::string_view::size_type from=0) noexcept
Search for the first character ch in str, ignoring case.
constexpr bool isHexDigit(char C) noexcept
Checks if character C is a hexadecimal numeric character.
Definition: StringExtras.h:62
constexpr bool isDigit(char C) noexcept
Checks if character C is one of the 10 decimal digits.
Definition: StringExtras.h:57
std::optional< T > parse_integer(std::string_view str, unsigned radix) noexcept
Parses the string str as an integer of the specified radix.
Definition: StringExtras.h:631
constexpr unsigned hexDigitValue(char C) noexcept
Interpret the given character C as a hexadecimal digit and return its value.
Definition: StringExtras.h:43
constexpr char toLower(char x) noexcept
Returns the corresponding lowercase character if x is uppercase.
Definition: StringExtras.h:92
constexpr std::string_view trim(std::string_view str, char ch) noexcept
Returns str with consecutive ch characters starting from the left and right removed.
Definition: StringExtras.h:593
constexpr char toUpper(char x) noexcept
Returns the corresponding uppercase character if x is lowercase.
Definition: StringExtras.h:100
constexpr bool contains(std::string_view str, std::string_view other) noexcept
Checks if str contains the substring other.
Definition: StringExtras.h:317
constexpr std::span< T > drop_back(std::span< T > in, typename std::span< T >::size_type n=1)
Drop the last N elements of the array.
Definition: SpanExtras.h:22
bool ends_with_lower(std::string_view str, std::string_view suffix) noexcept
Checks if str ends with the given suffix, ignoring case.
std::string_view::size_type rfind_lower(std::string_view str, char ch, std::string_view::size_type from=std::string_view::npos) noexcept
Search for the last character ch in str, ignoring case.
bool starts_with_lower(std::string_view str, std::string_view prefix) noexcept
Checks if str starts with the given prefix, ignoring case.
constexpr bool equals_lower(std::string_view lhs, std::string_view rhs) noexcept
equals_lower - Check for string equality, ignoring case.
Definition: StringExtras.h:143
std::optional< long double > parse_float< long double >(std::string_view str) noexcept
constexpr std::pair< std::string_view, std::string_view > rsplit(std::string_view str, char separator) noexcept
Splits str into two substrings around the last occurrence of a separator character.
Definition: StringExtras.h:481
constexpr std::string_view substr(std::string_view str, std::string_view::size_type start, std::string_view::size_type n=std::string_view::npos) noexcept
Returns the substring of str from [start, start + n).
Definition: StringExtras.h:221
constexpr bool equals(std::string_view lhs, std::string_view rhs) noexcept
equals - Check for string equality, this is more efficient than compare() when the relative ordering ...
Definition: StringExtras.h:129
constexpr bool isPrint(char C) noexcept
Checks whether character C is printable.
Definition: StringExtras.h:86
constexpr std::string_view take_back(std::string_view str, std::string_view::size_type n=1) noexcept
Returns a view equal to str but with only the last n elements remaining.
Definition: StringExtras.h:395
std::pair< std::string_view, std::string_view > UnescapeCString(std::string_view str, SmallVectorImpl< char > &buf)
Unescapes a C-style string (reverse operation to raw_ostream::write_escaped).
constexpr std::span< T > drop_front(std::span< T > in, typename std::span< T >::size_type n=1)
Drop the first N elements of the array.
Definition: SpanExtras.h:14
constexpr bool isASCII(char C) noexcept
Checks whether character C is valid ASCII (high bit is zero).
Definition: StringExtras.h:78
constexpr bool isAlpha(char C) noexcept
Checks if character C is a valid letter as classified by "C" locale.
Definition: StringExtras.h:67
constexpr std::string_view rtrim(std::string_view str, char ch) noexcept
Returns str with consecutive Char characters starting from the right removed.
Definition: StringExtras.h:573
std::optional< T > parse_float(std::string_view str) noexcept
Parses the string str as a floating point value.
constexpr bool ends_with(std::string_view str, std::string_view suffix) noexcept
Checks if str ends with the given suffix.
Definition: StringExtras.h:274
std::string utohexstr(unsigned long long val, bool lowerCase=false)
Definition: StringExtras.h:107
std::optional< float > parse_float< float >(std::string_view str) noexcept
constexpr bool starts_with(std::string_view str, std::string_view prefix) noexcept
Checks if str starts with the given prefix.
Definition: StringExtras.h:232
bool contains_lower(std::string_view str, std::string_view other) noexcept
Checks if str contains the substring other, ignoring case.
Definition: StringExtras.h:338
constexpr std::string_view take_front(std::string_view str, std::string_view::size_type n=1) noexcept
Returns a view equal to str but with only the first n elements remaining.
Definition: StringExtras.h:381