fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / idl / inc / bastype.hxx
blob2252f9ad6d1ff135a645ec5fffab7c54ec128801
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_IDL_INC_BASTYPE_HXX
21 #define INCLUDED_IDL_INC_BASTYPE_HXX
24 #include <sal/types.h>
25 #include <tools/globname.hxx>
26 #include <tools/stream.hxx>
28 class SvStringHashEntry;
29 class SvIdlDataBase;
30 class SvTokenStream;
32 class Svint
34 int nVal;
35 bool bSet;
36 public:
37 Svint() { nVal = 0; bSet = false; }
38 Svint( int n ) : nVal( n ), bSet( true ) {}
39 Svint( int n, bool bSetP ) : nVal( n ), bSet( bSetP ) {}
40 Svint & operator = ( int n ) { nVal = n; bSet = true; return *this; }
42 operator int ()const { return nVal; }
43 bool IsSet() const { return bSet; }
47 class SvBOOL
49 bool nVal:1,
50 bSet:1;
51 public:
52 SvBOOL() { bSet = nVal = false; }
53 SvBOOL( bool n ) : nVal( n ), bSet( true ) {}
54 SvBOOL( bool n, bool bSetP ) : nVal( n ), bSet( bSetP ) {}
55 SvBOOL & operator = ( bool n ) { nVal = n; bSet = true; return *this; }
57 operator bool() const { return nVal; }
58 #ifdef STC
59 operator int() const { return nVal; }
60 #endif
61 bool Is() const { return nVal; }
62 bool IsSet() const { return bSet; }
64 friend SvStream& WriteSvBOOL(SvStream &, const SvBOOL &);
65 friend SvStream& operator >> (SvStream &, SvBOOL &);
67 bool ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
71 class SvIdentifier
73 private:
74 OString m_aStr;
75 public:
76 SvIdentifier()
79 void setString(const OString& rStr)
81 m_aStr = rStr;
83 const OString& getString() const
85 return m_aStr;
88 bool IsSet() const
90 return !m_aStr.isEmpty();
92 bool ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
96 class SvNumberIdentifier : public SvIdentifier
98 sal_uInt32 nValue;
99 // must not be used
100 bool ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
101 public:
102 SvNumberIdentifier() : nValue( 0 ) {};
103 bool IsSet() const
105 return SvIdentifier::IsSet() || nValue != 0;
107 sal_uInt32 GetValue() const { return nValue; }
108 void SetValue( sal_uInt32 nVal ) { nValue = nVal; }
110 bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
111 bool ReadSvIdl( SvIdlDataBase &, SvStringHashEntry * pName,
112 SvTokenStream & rInStm );
116 class SvString
118 private:
119 OString m_aStr;
120 public:
121 SvString() {}
122 void setString(const OString& rStr)
124 m_aStr = rStr;
126 const OString& getString() const
128 return m_aStr;
130 bool IsSet() const
132 return !m_aStr.isEmpty();
134 friend SvStream& WriteSvString(SvStream &, const SvString &);
135 friend SvStream& operator >> (SvStream &, SvString &);
137 bool ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
141 class SvHelpText : public SvString
143 public:
144 SvHelpText() {}
145 bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
149 class SvHelpContext : public SvNumberIdentifier
153 class SvUUId : public SvGlobalName
155 public:
156 SvUUId() {}
157 bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
161 class SvVersion
163 sal_uInt16 nMajorVersion;
164 sal_uInt16 nMinorVersion;
165 public:
166 SvVersion() : nMajorVersion( 1 ), nMinorVersion( 0 ) {}
167 bool operator == ( const SvVersion & r )
169 return (r.nMajorVersion == nMajorVersion)
170 && (r.nMinorVersion == nMinorVersion);
172 bool operator != ( const SvVersion & r )
174 return !(*this == r);
177 sal_uInt16 GetMajorVersion() const { return nMajorVersion; }
178 sal_uInt16 GetMinorVersion() const { return nMinorVersion; }
180 friend SvStream& WriteSvVersion(SvStream &, const SvVersion &);
181 friend SvStream& operator >> (SvStream &, SvVersion &);
182 bool ReadSvIdl( SvTokenStream & rInStm );
186 #endif // INCLUDED_IDL_INC_BASTYPE_HXX
188 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */