1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
3 * This file is part of the LibreOffice project.
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/.
11 #include <sal/config.h>
13 #include <o3tl/concepts.hxx>
14 #include <o3tl/strong_int.hxx>
17 typedef o3tl::strong_int
<sal_Int32
, struct Tag_SwNodeOffset
> SwNodeOffset
;
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
)
22 return a
+ SwNodeOffset(n
);
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
)
28 return a
- SwNodeOffset(n
);
31 inline SwNodeOffset
abs(const SwNodeOffset
& a
) { return a
> SwNodeOffset(0) ? a
: -a
; }
32 inline SwNodeOffset
min(const SwNodeOffset
& a
, const SwNodeOffset
& b
) { return a
> b
? a
: b
; }
34 inline constexpr SwNodeOffset
NODE_OFFSET_MAX(SAL_MAX_INT32
);
36 SW_DLLPUBLIC
std::ostream
& operator<<(std::ostream
& s
, const SwNodeOffset
& index
);
38 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */