[Libreoffice-commits] core.git: include/o3tl sw/inc
include/o3tl/concepts.hxx | 45 + sw/inc/nodeoffset.hxx |9 +++-- 2 files changed, 48 insertions(+), 6 deletions(-) New commits: commit dcaa2c4870e0b2662c597f53c46b1df347183e7c Author: Stephan Bergmann AuthorDate: Tue Oct 24 22:07:26 2023 +0200 Commit: Stephan Bergmann CommitDate: Wed Oct 25 10:27:26 2023 +0200 Use std::signed_integral concept ...which, unlike std::is_signed, also requires that T is an integer type, not just any arithmetic type, but which appears to fit well here anyway. But LLVM 12 libc++, which is apparently used by Android builds, only provides a bare-bones that lacks std::signed_integral (among others), so for now introduce o3tl/concepts.hxx providing what's missing (incl. std::integral and std::unsigned_integral, for some kind of consistency). Change-Id: I1c37d37fa1b57b5e3bf24c9e44f3973003905cb2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158406 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/include/o3tl/concepts.hxx b/include/o3tl/concepts.hxx new file mode 100644 index ..261d063ebca2 --- /dev/null +++ b/include/o3tl/concepts.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ + +#pragma once + +#include + +#include + +// LLVM 12 libc++ only provides a bare-bones that lacks most of its C++20 content, so +// replicate here fore now what we need: + +#if defined __cpp_lib_concepts + +namespace o3tl +{ +using std::integral; +using std::signed_integral; +using std::unsigned_integral; +} + +#else + +#include + +namespace o3tl +{ +// Taken from the C++20 spec: + +template concept integral = std::is_integral_v; + +template concept signed_integral = integral&& std::is_signed_v; + +template concept unsigned_integral = integral && !signed_integral; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sw/inc/nodeoffset.hxx b/sw/inc/nodeoffset.hxx index 035925855b31..f6deac6609b0 100644 --- a/sw/inc/nodeoffset.hxx +++ b/sw/inc/nodeoffset.hxx @@ -10,23 +10,20 @@ #include #include "swdllapi.h" +#include #include #include typedef o3tl::strong_int SwNodeOffset; /* Just to make it easier to write arithmetic with these types */ -template -inline typename std::enable_if::value, SwNodeOffset>::type -operator+(SwNodeOffset a, T n) +template inline SwNodeOffset operator+(SwNodeOffset a, T n) { return a + SwNodeOffset(n); } /* Just to make it easier to write arithmetic with these types */ -template -inline typename std::enable_if::value, SwNodeOffset>::type -operator-(SwNodeOffset a, T n) +template inline SwNodeOffset operator-(SwNodeOffset a, T n) { return a - SwNodeOffset(n); }
[Libreoffice-commits] core.git: include/o3tl sw/inc sw/source
include/o3tl/sorted_vector.hxx|1 sw/inc/IDocumentOutlineNodes.hxx |9 +- sw/inc/crsrsh.hxx |6 - sw/inc/doc.hxx|2 sw/inc/editsh.hxx |6 - sw/inc/ndarr.hxx |7 +- sw/source/core/crsr/crstrvl.cxx | 19 ++--- sw/source/core/doc/DocumentLinksAdministrationManager.cxx |2 sw/source/core/doc/DocumentOutlineNodesManager.cxx| 12 +-- sw/source/core/doc/docglbl.cxx| 12 +-- sw/source/core/doc/docnum.cxx | 12 +-- sw/source/core/docnode/ndnum.cxx |4 - sw/source/core/docnode/node.cxx |4 - sw/source/core/docnode/nodes.cxx |4 - sw/source/core/edit/ednumber.cxx | 10 +- sw/source/core/inc/DocumentOutlineNodesManager.hxx|8 +- sw/source/core/text/EnhancedPDFExportHelper.cxx |6 - sw/source/core/txtnode/ndtxt.cxx |2 sw/source/ui/misc/outline.cxx |4 - sw/source/uibase/inc/content.hxx |4 - sw/source/uibase/inc/navipi.hxx |3 sw/source/uibase/inc/wrtsh.hxx|2 sw/source/uibase/shells/listsh.cxx| 12 +-- sw/source/uibase/utlui/content.cxx| 48 +++--- sw/source/uibase/utlui/navipi.cxx |8 +- sw/source/uibase/wrtsh/move.cxx |2 26 files changed, 108 insertions(+), 101 deletions(-) New commits: commit a6ded3b0137f378a9e7a83903193d6e3fd9b0126 Author: Stephan Bergmann Date: Thu Mar 16 09:30:20 2017 +0100 Clean up integers representing positions in SwOutlineNodes vectors Change-Id: If1a6a9cb61ffd355a85835127e7c893969833587 diff --git a/include/o3tl/sorted_vector.hxx b/include/o3tl/sorted_vector.hxx index a2267c0..f18ff04 100644 --- a/include/o3tl/sorted_vector.hxx +++ b/include/o3tl/sorted_vector.hxx @@ -37,6 +37,7 @@ private: typedef typename std::vector::iterator iterator; public: typedef typename std::vector::const_iterator const_iterator; +typedef typename std::vector::difference_type difference_type; typedef typename std::vector::size_type size_type; // MODIFIERS diff --git a/sw/inc/IDocumentOutlineNodes.hxx b/sw/inc/IDocumentOutlineNodes.hxx index f4aa9b2..6b69da6 100644 --- a/sw/inc/IDocumentOutlineNodes.hxx +++ b/sw/inc/IDocumentOutlineNodes.hxx @@ -23,6 +23,7 @@ #include #include #include + class SwTextNode; /** Provides outline nodes of a document. @@ -32,14 +33,14 @@ class IDocumentOutlineNodes public: typedef std::vector< const SwTextNode* > tSortedOutlineNodeList; -virtual sal_Int32 getOutlineNodesCount() const = 0; +virtual tSortedOutlineNodeList::size_type getOutlineNodesCount() const = 0; -virtual int getOutlineLevel( const sal_Int32 nIdx ) const = 0; -virtual OUString getOutlineText( const sal_Int32 nIdx, +virtual int getOutlineLevel( const tSortedOutlineNodeList::size_type nIdx ) const = 0; +virtual OUString getOutlineText( const tSortedOutlineNodeList::size_type nIdx, const bool bWithNumber = true, const bool bWithSpacesForLevel = false, const bool bWithFootnote = true ) const = 0; -virtual SwTextNode* getOutlineNode( const sal_Int32 nIdx ) const = 0; +virtual SwTextNode* getOutlineNode( const tSortedOutlineNodeList::size_type nIdx ) const = 0; virtual void getOutlineNodes( IDocumentOutlineNodes::tSortedOutlineNodeList& orOutlineNodeList ) const = 0; diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 37a14b7..feafb1a 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -600,12 +600,12 @@ public: bool GotoOutline( const OUString& rName ); // to the next/previous or the given OutlineNode -void GotoOutline( sal_uInt16 nIdx ); +void GotoOutline( SwOutlineNodes::size_type nIdx ); // find the "outline position" in the nodes array of the current chapter -sal_uInt16 GetOutlinePos( sal_uInt8 nLevel = UCHAR_MAX ); +SwOutlineNodes::size_type GetOutlinePos( sal_uInt8 nLevel = UCHAR_MAX ); // select the given range of OutlineNodes. Optionally including the children // the sal_uInt16s are the positions in OutlineNodes-Array (EditShell) -bool MakeOutlineSel( sal_uInt16 nSttPos, sal_uInt16 nEndPos, +bool MakeOutlineSel( SwOutlineNodes::size_type nSttPos, SwOutlineNodes::size_type nEndPos, bool bWithChildren ); bool GotoNextOutline(); diff --git a/sw/inc/doc.hxx b