LibreOffice Module sw (master) 1
nodeoffset.hxx
Go to the documentation of this file.
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/strong_int.hxx>
14#include <iostream>
15
17
18/* Just to make it easier to write arithmetic with these types */
19template <typename T>
20inline typename std::enable_if<std::is_signed<T>::value, SwNodeOffset>::type
22{
23 return a + SwNodeOffset(n);
24}
25
26/* Just to make it easier to write arithmetic with these types */
27template <typename T>
28inline typename std::enable_if<std::is_signed<T>::value, SwNodeOffset>::type
30{
31 return a - SwNodeOffset(n);
32}
33
34inline SwNodeOffset abs(const SwNodeOffset& a) { return a > SwNodeOffset(0) ? a : -a; }
35inline SwNodeOffset min(const SwNodeOffset& a, const SwNodeOffset& b) { return a > b ? a : b; }
36
37constexpr SwNodeOffset NODE_OFFSET_MAX(SAL_MAX_INT32);
38
39SW_DLLPUBLIC std::ostream& operator<<(std::ostream& s, const SwNodeOffset& index);
40
41/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
sal_Int64 n
uno_Any a
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
std::enable_if< std::is_signed< T >::value, SwNodeOffset >::type operator-(SwNodeOffset a, T n)
Definition: nodeoffset.hxx:29
constexpr SwNodeOffset NODE_OFFSET_MAX(SAL_MAX_INT32)
std::enable_if< std::is_signed< T >::value, SwNodeOffset >::type operator+(SwNodeOffset a, T n)
Definition: nodeoffset.hxx:21
SwNodeOffset abs(const SwNodeOffset &a)
Definition: nodeoffset.hxx:34
SW_DLLPUBLIC std::ostream & operator<<(std::ostream &s, const SwNodeOffset &index)
Definition: index.cxx:387
#define SW_DLLPUBLIC
Definition: swdllapi.h:28