/src/libreoffice/sw/inc/nodeoffset.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | */ |
9 | | #pragma once |
10 | | |
11 | | #include <sal/config.h> |
12 | | #include "swdllapi.h" |
13 | | #include <o3tl/concepts.hxx> |
14 | | #include <o3tl/strong_int.hxx> |
15 | | #include <iostream> |
16 | | |
17 | | typedef o3tl::strong_int<sal_Int32, struct Tag_SwNodeOffset> SwNodeOffset; |
18 | | |
19 | | /* Just to make it easier to write arithmetic with these types */ |
20 | | template <o3tl::signed_integral T> inline SwNodeOffset operator+(SwNodeOffset a, T n) |
21 | 22.4M | { |
22 | 22.4M | return a + SwNodeOffset(n); |
23 | 22.4M | } |
24 | | |
25 | | /* Just to make it easier to write arithmetic with these types */ |
26 | | template <o3tl::signed_integral T> inline SwNodeOffset operator-(SwNodeOffset a, T n) |
27 | 14.4M | { |
28 | 14.4M | return a - SwNodeOffset(n); |
29 | 14.4M | } |
30 | | |
31 | 0 | inline SwNodeOffset abs(const SwNodeOffset& a) { return a > SwNodeOffset(0) ? a : -a; } |
32 | 0 | inline SwNodeOffset min(const SwNodeOffset& a, const SwNodeOffset& b) { return a > b ? a : b; } |
33 | | |
34 | | inline constexpr SwNodeOffset NODE_OFFSET_MAX(SAL_MAX_INT32); |
35 | | |
36 | | SW_DLLPUBLIC std::ostream& operator<<(std::ostream& s, const SwNodeOffset& index); |
37 | | |
38 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |