Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : : #ifdef MACOSX
20 : : // We need an empty block in here. Otherwise, if the #ifndef _SFXNRANGES_HXX
21 : : // line is the first line, the Mac OS X version of the gcc preprocessor will
22 : : // incorrectly optimize the inclusion process and will never include this file
23 : : // a second time
24 : : #endif
25 : :
26 : : #ifndef _SFXNRANGES_HXX
27 : :
28 : : #ifndef NUMTYPE
29 : :
30 : : #define NUMTYPE sal_uInt16
31 : : #define SfxNumRanges SfxUShortRanges
32 : : #include <svl/nranges.hxx>
33 : :
34 : : #undef NUMTYPE
35 : :
36 : : #define _SFXNRANGES_HXX
37 : :
38 : : #else
39 : : #include <tools/solar.h>
40 : :
41 : : //========================================================================
42 : :
43 : : #define NUMTYPE_ARG int
44 : :
45 : : class SfxNumRanges
46 : : {
47 : : NUMTYPE* _pRanges; // 0-terminated array of NUMTYPE-pairs
48 : :
49 : : public:
50 : : SfxNumRanges() : _pRanges( 0 ) {}
51 : : SfxNumRanges( const SfxNumRanges &rOrig );
52 : : SfxNumRanges( NUMTYPE nWhich1, NUMTYPE nWhich2 );
53 : : SfxNumRanges( const NUMTYPE* nNumTable );
54 : 80136 : ~SfxNumRanges()
55 [ + - ]: 80136 : { delete [] _pRanges; }
56 : :
57 : : sal_Bool operator == ( const SfxNumRanges & ) const;
58 : : sal_Bool operator != ( const SfxNumRanges & rRanges ) const
59 : : { return !( *this == rRanges ); }
60 : :
61 : : SfxNumRanges& operator = ( const SfxNumRanges & );
62 : :
63 : : SfxNumRanges& operator += ( const SfxNumRanges & );
64 : : SfxNumRanges& operator -= ( const SfxNumRanges & );
65 : : SfxNumRanges& operator /= ( const SfxNumRanges & );
66 : :
67 : : NUMTYPE Count() const;
68 : 80136 : sal_Bool IsEmpty() const
69 [ + - ][ - + ]: 80136 : { return !_pRanges || 0 == *_pRanges; }
70 : :
71 : 40068 : operator const NUMTYPE* () const
72 : 40068 : { return _pRanges; }
73 : : };
74 : :
75 : : #undef NUMTYPE
76 : : #undef SfxNumRanges
77 : :
78 : : #endif
79 : :
80 : : #endif
81 : :
82 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|