// Copyright 2022 The Abseil Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // ----------------------------------------------------------------------------- // File: charset.h // ----------------------------------------------------------------------------- // // This file contains absl::CharSet, a fast, bit-vector set of 8-bit unsigned // characters. // // Instances can be initialized as constexpr constants. For example: // // constexpr absl::CharSet kJustX = absl::CharSet::Char('x'); // constexpr absl::CharSet kMySymbols = absl::CharSet("$@!"); // constexpr absl::CharSet kLetters = absl::CharSet::Range('a', 'z'); // // Multiple instances can be combined that still forms a constexpr expression. // For example: // // constexpr absl::CharSet kLettersAndNumbers = // absl::CharSet::Range('a', 'z') | absl::CharSet::Range('0', '9'); // // Several pre-defined character classes are available that mirror the methods // from <cctype>. For example: // // constexpr absl::CharSet kLettersAndWhitespace = // absl::CharSet::AsciiAlphabet() | absl::CharSet::AsciiWhitespace(); // // To check membership, use the .contains method, e.g. // // absl::CharSet hex_letters("abcdef"); // hex_letters.contains('a'); // true // hex_letters.contains('g'); // false
class CharSet { public:
constexpr CharSet() : m_() {}
// Initializes with a given string_view.
constexpr explicit CharSet(absl::string_view str) : m_() { for (char c : str) {
SetChar(static_cast<unsignedchar>(c));
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.