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 :
20 : #ifndef _BASTYPE_HXX
21 : #define _BASTYPE_HXX
22 :
23 :
24 : #include <sal/types.h>
25 : #include <tools/globname.hxx>
26 : #include <tools/stream.hxx>
27 : #include <tools/string.hxx>
28 :
29 : class SvStringHashEntry;
30 : class SvIdlDataBase;
31 : class SvTokenStream;
32 :
33 : class SvUINT32
34 : {
35 : sal_uInt32 nVal;
36 : public:
37 : SvUINT32() { nVal = 0; }
38 : SvUINT32( sal_uInt32 n ) : nVal( n ) {}
39 : SvUINT32 & operator = ( sal_uInt32 n ) { nVal = n; return *this; }
40 :
41 : operator sal_uInt32 &() { return nVal; }
42 :
43 : static sal_uInt32 Read( SvStream & rStm );
44 : static void Write( SvStream & rStm, sal_uInt32 nVal );
45 :
46 : friend SvStream& operator << (SvStream & rStm, const SvUINT32 & r )
47 : { SvUINT32::Write( rStm, r.nVal ); return rStm; }
48 : friend SvStream& operator >> (SvStream & rStm, SvUINT32 & r )
49 : { r.nVal = SvUINT32::Read( rStm ); return rStm; }
50 : };
51 :
52 :
53 : class Svint
54 : {
55 : int nVal;
56 : sal_Bool bSet;
57 : public:
58 : Svint() { nVal = bSet = 0; }
59 : Svint( int n ) : nVal( n ), bSet( sal_True ) {}
60 19257 : Svint( int n, sal_Bool bSetP ) : nVal( n ), bSet( bSetP ) {}
61 0 : Svint & operator = ( int n ) { nVal = n; bSet = sal_True; return *this; }
62 :
63 82572 : operator int ()const { return nVal; }
64 19257 : sal_Bool IsSet() const { return bSet; }
65 :
66 0 : friend SvStream& operator << (SvStream & rStm, const Svint & r )
67 0 : { SvUINT32::Write( rStm, (sal_uInt32)r.nVal ); rStm << r.bSet; return rStm; }
68 0 : friend SvStream& operator >> (SvStream & rStm, Svint & r )
69 0 : { r.nVal = (int)SvUINT32::Read( rStm ); rStm >> r.bSet ; return rStm; }
70 : };
71 :
72 :
73 : class SvBOOL
74 : {
75 : sal_Bool nVal:1,
76 : bSet:1;
77 : public:
78 453340 : SvBOOL() { bSet = nVal = sal_False; }
79 : SvBOOL( sal_Bool n ) : nVal( n ), bSet( sal_True ) {}
80 161624 : SvBOOL( sal_Bool n, sal_Bool bSetP ) : nVal( n ), bSet( bSetP ) {}
81 218291 : SvBOOL & operator = ( sal_Bool n ) { nVal = n; bSet = sal_True; return *this; }
82 :
83 646458 : operator sal_Bool() const { return nVal; }
84 : #ifdef STC
85 : operator int() const { return nVal; }
86 : #endif
87 : sal_Bool Is() const { return nVal; }
88 922506 : sal_Bool IsSet() const { return bSet; }
89 :
90 : friend SvStream& operator << (SvStream &, const SvBOOL &);
91 : friend SvStream& operator >> (SvStream &, SvBOOL &);
92 :
93 : sal_Bool ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
94 : sal_Bool WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm );
95 : OString GetSvIdlString( SvStringHashEntry * pName );
96 : };
97 :
98 :
99 154549 : class SvIdentifier
100 : {
101 : private:
102 : OString m_aStr;
103 : public:
104 166801 : SvIdentifier()
105 166801 : {
106 166801 : }
107 37556 : void setString(const OString& rStr)
108 : {
109 37556 : m_aStr = rStr;
110 37556 : }
111 12844427 : const OString& getString() const
112 : {
113 12844427 : return m_aStr;
114 : }
115 : friend SvStream& operator << (SvStream &, const SvIdentifier &);
116 : friend SvStream& operator >> (SvStream &, SvIdentifier &);
117 :
118 9674490 : sal_Bool IsSet() const
119 : {
120 9674490 : return !m_aStr.isEmpty();
121 : }
122 : sal_Bool ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
123 : sal_Bool WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm,
124 : sal_uInt16 nTab );
125 : };
126 :
127 :
128 42349 : class SvNumberIdentifier : public SvIdentifier
129 : {
130 : sal_uInt32 nValue;
131 : // must not be used
132 : sal_Bool ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
133 : public:
134 52501 : SvNumberIdentifier() : nValue( 0 ) {};
135 9608598 : sal_Bool IsSet() const
136 : {
137 9608598 : return SvIdentifier::IsSet() || nValue != 0;
138 : }
139 930381 : sal_uInt32 GetValue() const { return nValue; }
140 5 : void SetValue( sal_uInt32 nVal ) { nValue = nVal; }
141 :
142 : friend SvStream& operator << (SvStream &, const SvNumberIdentifier &);
143 : friend SvStream& operator >> (SvStream &, SvNumberIdentifier &);
144 : sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
145 : sal_Bool ReadSvIdl( SvIdlDataBase &, SvStringHashEntry * pName,
146 : SvTokenStream & rInStm );
147 : };
148 :
149 :
150 124714 : class SvString
151 : {
152 : private:
153 : OString m_aStr;
154 : public:
155 146522 : SvString() {}
156 21285 : void setString(const OString& rStr)
157 : {
158 21285 : m_aStr = rStr;
159 21285 : }
160 6134067 : const OString& getString() const
161 : {
162 6134067 : return m_aStr;
163 : }
164 206852 : sal_Bool IsSet() const
165 : {
166 206852 : return !m_aStr.isEmpty();
167 : }
168 : friend SvStream& operator << (SvStream &, const SvString &);
169 : friend SvStream& operator >> (SvStream &, SvString &);
170 :
171 : sal_Bool ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
172 : sal_Bool WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm,
173 : sal_uInt16 nTab );
174 : };
175 :
176 :
177 24787 : class SvHelpText : public SvString
178 : {
179 : public:
180 30307 : SvHelpText() {}
181 : sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
182 : sal_Bool WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
183 : sal_uInt16 nTab );
184 : };
185 :
186 :
187 55094 : class SvHelpContext : public SvNumberIdentifier
188 : {
189 : };
190 :
191 5941 : class SvUUId : public SvGlobalName
192 : {
193 : public:
194 6427 : SvUUId() {}
195 : sal_Bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
196 : sal_Bool WriteSvIdl( SvStream & rOutStm );
197 : };
198 :
199 :
200 : class SvVersion
201 : {
202 : sal_uInt16 nMajorVersion;
203 : sal_uInt16 nMinorVersion;
204 : public:
205 12854 : SvVersion() : nMajorVersion( 1 ), nMinorVersion( 0 ) {}
206 6427 : sal_Bool operator == ( const SvVersion & r )
207 : {
208 6427 : return (r.nMajorVersion == nMajorVersion)
209 6427 : && (r.nMinorVersion == nMinorVersion);
210 : }
211 6427 : sal_Bool operator != ( const SvVersion & r )
212 : {
213 6427 : return !(*this == r);
214 : }
215 :
216 0 : sal_uInt16 GetMajorVersion() const { return nMajorVersion; }
217 0 : sal_uInt16 GetMinorVersion() const { return nMinorVersion; }
218 :
219 : friend SvStream& operator << (SvStream &, const SvVersion &);
220 : friend SvStream& operator >> (SvStream &, SvVersion &);
221 : sal_Bool ReadSvIdl( SvTokenStream & rInStm );
222 : sal_Bool WriteSvIdl( SvStream & rOutStm );
223 : };
224 :
225 :
226 : #endif // _BASTYPE_HXX
227 :
228 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|