/* -*- 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 . */ #ifndef INCLUDED_RTL_CHARACTER_HXX #define INCLUDED_RTL_CHARACTER_HXX #include #include #include namespace rtl { /** Check for ASCII character. @param code A Unicode code point. @return True if code is an ASCII character (0x00--0x7F). @since LibreOffice 4.1 */ inline bool isAscii(sal_uInt32 code) { assert(code <= 0x10FFFF); return code <= 0x7F; } /** Check for ASCII lower case character. @param code A Unicode code point. @return True if code is an ASCII lower case alphabetic character (ASCII 'a'--'z'). @since LibreOffice 4.1 */ inline bool isAsciiLowerCase(sal_uInt32 code) { assert(code <= 0x10FFFF); return code >= 'a' && code <= 'z'; } /** Check for ASCII upper case character. @param code A Unicode code point. @return True if code is an ASCII upper case alphabetic character (ASCII 'A'--'Z'). @since LibreOffice 4.1 */ inline bool isAsciiUpperCase(sal_uInt32 code) { assert(code <= 0x10FFFF); return code >= 'A' && code <= 'Z'; } /** Check for ASCII alphabetic character. @param code A Unicode code point. @return True if code is an ASCII alphabetic character (ASCII 'A'--'Z' or 'a'--'z'). @since LibreOffice 4.1 */ inline bool isAsciiAlpha(sal_uInt32 code) { assert(code <= 0x10FFFF); return isAsciiLowerCase(code) || isAsciiUpperCase(code); } /** Check for ASCII digit character. @param code A Unicode code point. @return True if code is an ASCII (decimal) digit character (ASCII '0'--'9'). @since LibreOffice 4.1 */ inline bool isAsciiDigit(sal_uInt32 code) { assert(code <= 0x10FFFF); return code >= '0' && code <= '9'; } /** Check for ASCII alphanumeric character. @param code A Unicode code point. @return True if code is an ASCII alphanumeric character (ASCII '0'--'9', 'A'--'Z', or 'a'--'z'). @since LibreOffice 4.1 */ inline bool isAsciiAlphanumeric(sal_uInt32 code) { assert(code <= 0x10FFFF); return isAsciiDigit(code) || isAsciiAlpha(code); } /** Check for ASCII canonic hexadecimal digit character. @param code A Unicode code point. @return True if code is an ASCII canonic (i.e., upper case) hexadecimal digit character (ASCII '0'--'9' or 'A'--'F'). @since LibreOffice 4.1 */ inline bool isAsciiCanonicHexDigit(sal_uInt32 code) { assert(code <= 0x10FFFF); return isAsciiDigit(code) || (code >= 'A' && code <= 'F'); } /** Check for ASCII hexadecimal digit character. @param code A Unicode code point. @return True if code is an ASCII hexadecimal digit character (ASCII '0'--'9', 'A'--'F', or 'a'--'f'). @since LibreOffice 4.1 */ inline bool isAsciiHexDigit(sal_uInt32 code) { assert(code <= 0x10FFFF); return isAsciiCanonicHexDigit(code) || (code >= 'a' && code <= 'f'); } /** Convert a character, if ASCII, to upper case. @param code A Unicode code point. @return code converted to ASCII upper case. @since LibreOffice 4.2 */ inline sal_uInt32 toAsciiUpperCase(sal_uInt32 code) { assert(code <= 0x10FFFF); return isAsciiLowerCase(code) ? code - 32 : code; } /** Convert a character, if ASCII, to lower case. @param code A Unicode code point. @return code converted to ASCII lower case. @since LibreOffice 4.2 */ inline sal_uInt32 toAsciiLowerCase(sal_uInt32 code) { assert(code <= 0x10FFFF); return isAsciiUpperCase(code) ? code + 32 : code; } /** Compare two characters ignoring ASCII case. @param code1 A Unicode code point. @param code2 A unicode code point. @return 0 if both code points are equal, < 0 if code1 is less than code2, > 0 if code1 is greater than code2. @since LibreOffice 4.2 */ inline sal_Int32 compareIgnoreAsciiCase(sal_uInt32 code1, sal_uInt32 code2) { assert(code1 <= 0x10FFFF); assert(code2 <= 0x10FFFF); return static_cast(toAsciiLowerCase(code1)) - static_cast(toAsciiLowerCase(code2)); } } #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ n> LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-12-15Turn onlineupdate into external/onlineupdateStephan Bergmann
...and update to latest Mozilla sources. Originally, this was a non-external onlineupdate module (plus correspsonding top-level include/onlineupdate/ directory) that apparently contained sources originally copied from Mozilla and subsequently modified in-place (plus, mixed in, presumably some sources that were not copied from Mozilla but were our own inventions). To clean up this mess, this has been turned into a proper external/onlineupdate module with a tarball containing the pristine external Mozilla sources. The sources for the onlineupdate-c003be8b9727672e7d30972983b375f4c200233f.tar.xz tarball are taken, somewhat arbitrarily, from a recent <https://github.com/mozilla/gecko-dev/commit/c003be8b9727672e7d30972983b375f4c200233f> ("Bug 1867784 - Force reflow all kids in the last column balancing reflow. r=layout-reviewers,dholbert") trunk state, by running `external/onlineupdate/generate-sources.sh ~/github.com/mozilla/gecko-dev` on a Fedora 39 machine. The layout of the tarball still mostly follows the old onlineupdate/ layout, even if that deviates heavily from the actual source layout at <https://github.com/mozilla/gecko-dev/>. (And some files, which apparently are not needed, anyway, lacked sources, see the "Missing source for" in external/onlineupdate/generate-sources.sh. And win_dirent.h/.cpp has meanwhile been superseded by updateutils_win.h/.cpp.) Merely newly included source files are laid out in the tarball according to the actual source layout. Any LO-specific modifications are made via patch files (rather than modifying the sources inline, as was done in the past): external/onlineupdate/lo.patch contains whatever modifications are needed to adapt the functionality, while external/onlineupdate/gtk3deprecated.patch fixes > workdir/UnpackedTarball/onlineupdate/onlineupdate/source/update/updater/progressui_gtk.cpp:97:21: error: use of undeclared identifier 'gtk_vbox_new'; did you mean 'gtk_box_new'? > 97 | GtkWidget* vbox = gtk_vbox_new(TRUE, 6); > | ^~~~~~~~~~~~ > | gtk_box_new to not use the deprecated gtk_vbox_new, which is hidden because we include -DGTK_DISABLE_DEPRECATED in our GTK3_CFLAGS as per our configure.ac. On Windows, the definition of __BYTE_ORDER__ etc. is needed because workdir/UnpackedTarball/onlineupdate/include/mozilla/ says "Our supported compilers provide architecture-independent macros for this", but MSVC doesn't actually, so define here what would implicitly be defined by GCC. Similarly, on Windows -U_WIN32_WINNT is needed to undo -D_WIN32_WINNT=0x0601 in solenv/gbuild/platform/windows.mk, which would cause > workdir\UnpackedTarball\onlineupdate\include\mozilla/WinHeaderOnlyUtils.h(537): error C2065: 'FILE_ID_INFO': undeclared identifier etc., despite the #include <windws.h> there. Curiously, the original gb_CustomTarget_CustomTarget,onlineupdate/generated from onlineupdate/CustomTarget_generated.mk had to be renamed to gb_CustomTarget_CustomTarget,external/onlineupdate/generated when the file was moved to external/onlineupdate/CustomTarget_generated.mk, as otherwise a top-level `make CustomTarget_onlineupdate/generated` would have failed with "No rule to make target..." Also, as there is no gb_CustomTarget_use_unpacked, its effect has been poorly mimicked for now in external/onlineupdate/CustomTarget_generated.mk. Similarly, as there is no gb_WinResTarget_use_unpacked, its effect has been poorly mimicked for now in external/onlineupdate/WinResTarget_updater.mk. The original onlineupdate/workben/test_dialog.cxx, which is actually code written by us, has been moved to external/onlineupdate/workben/test_dialog.cxx. The original onlineupdate/qa/ sources (which were apparently not used during the build) have been preserved for now as external/onlineupdate/qa/, for documentation purposes. The original onlineupdate/astyle.options (which was apparently not used during the build) has been removed. Change-Id: I5ea606202e7837269e7b128e45af2f0b8c277f9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160492 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>