/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you 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 http://www.apache.org/licenses/LICENSE-2.0 .
*/
inline constexpr sal_Int32 nCharClassAlphaTypeMask =
nCharClassAlphaType |
css::i18n::KCharacterType::LETTER | // Alpha is also always a LETTER
css::i18n::KCharacterType::PRINTABLE |
css::i18n::KCharacterType::BASE_FORM;
public: /// Preferred ctor with service manager specified
CharClass( const css::uno::Reference< css::uno::XComponentContext > & rxContext,
LanguageTag aLanguageTag );
/// Deprecated ctor, tries to get a process service manager or to load the /// library directly.
CharClass( LanguageTag aLanguageTag );
~CharClass();
/// get current Locale const LanguageTag& getLanguageTag() const;
/// isdigit() on ascii values of entire string staticbool isAsciiNumeric( std::u16string_view rStr );
/// isalpha() on ascii values of entire string staticbool isAsciiAlpha( std::u16string_view rStr );
/// whether type is pure numeric or not, e.g. return of getCharacterType() staticbool isNumericType( sal_Int32 nType )
{ return ((nType & nCharClassNumericType) != 0) &&
((nType & ~nCharClassNumericTypeMask) == 0);
}
/// whether type is pure alphanumeric or not, e.g. return of getCharacterType() staticbool isAlphaNumericType( sal_Int32 nType )
{ return ((nType & (nCharClassAlphaType |
nCharClassNumericType)) != 0) &&
((nType & ~(nCharClassAlphaTypeMask |
nCharClassNumericTypeMask)) == 0);
}
/// whether type is pure letter or not, e.g. return of getCharacterType() staticbool isLetterType( sal_Int32 nType )
{ return ((nType & nCharClassLetterType) != 0) &&
((nType & ~nCharClassLetterTypeMask) == 0);
}
/// whether type is pure letternumeric or not, e.g. return of getCharacterType() staticbool isLetterNumericType( sal_Int32 nType )
{ return ((nType & (nCharClassLetterType |
nCharClassNumericType)) != 0) &&
((nType & ~(nCharClassLetterTypeMask |
nCharClassNumericTypeMask)) == 0);
}
// Wrapper implementations of class CharacterClassification
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 ist noch experimentell.