1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
24 #include <sal/types.h>
25 #include <tools/globname.hxx>
26 #include <tools/stream.hxx>
27 #include <tools/string.hxx>
29 class SvStringHashEntry
;
37 SvUINT32() { nVal
= 0; }
38 SvUINT32( sal_uInt32 n
) : nVal( n
) {}
39 SvUINT32
& operator = ( sal_uInt32 n
) { nVal
= n
; return *this; }
41 operator sal_uInt32
&() { return nVal
; }
43 static sal_uInt32
Read( SvStream
& rStm
);
44 static void Write( SvStream
& rStm
, sal_uInt32 nVal
);
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
; }
58 Svint() { nVal
= bSet
= 0; }
59 Svint( int n
) : nVal( n
), bSet( sal_True
) {}
60 Svint( int n
, sal_Bool bSetP
) : nVal( n
), bSet( bSetP
) {}
61 Svint
& operator = ( int n
) { nVal
= n
; bSet
= sal_True
; return *this; }
63 operator int ()const { return nVal
; }
64 sal_Bool
IsSet() const { return bSet
; }
66 friend SvStream
& operator << (SvStream
& rStm
, const Svint
& r
)
67 { SvUINT32::Write( rStm
, (sal_uInt32
)r
.nVal
); rStm
<< r
.bSet
; return rStm
; }
68 friend SvStream
& operator >> (SvStream
& rStm
, Svint
& r
)
69 { r
.nVal
= (int)SvUINT32::Read( rStm
); rStm
>> r
.bSet
; return rStm
; }
78 SvBOOL() { bSet
= nVal
= sal_False
; }
79 SvBOOL( sal_Bool n
) : nVal( n
), bSet( sal_True
) {}
80 SvBOOL( sal_Bool n
, sal_Bool bSetP
) : nVal( n
), bSet( bSetP
) {}
81 SvBOOL
& operator = ( sal_Bool n
) { nVal
= n
; bSet
= sal_True
; return *this; }
83 operator sal_Bool() const { return nVal
; }
85 operator int() const { return nVal
; }
87 sal_Bool
Is() const { return nVal
; }
88 sal_Bool
IsSet() const { return bSet
; }
90 friend SvStream
& operator << (SvStream
&, const SvBOOL
&);
91 friend SvStream
& operator >> (SvStream
&, SvBOOL
&);
93 sal_Bool
ReadSvIdl( SvStringHashEntry
* pName
, SvTokenStream
& rInStm
);
94 sal_Bool
WriteSvIdl( SvStringHashEntry
* pName
, SvStream
& rOutStm
);
95 OString
GetSvIdlString( SvStringHashEntry
* pName
);
107 void setString(const OString
& rStr
)
111 const OString
& getString() const
115 friend SvStream
& operator << (SvStream
&, const SvIdentifier
&);
116 friend SvStream
& operator >> (SvStream
&, SvIdentifier
&);
118 sal_Bool
IsSet() const
120 return !m_aStr
.isEmpty();
122 sal_Bool
ReadSvIdl( SvStringHashEntry
* pName
, SvTokenStream
& rInStm
);
123 sal_Bool
WriteSvIdl( SvStringHashEntry
* pName
, SvStream
& rOutStm
,
128 class SvNumberIdentifier
: public SvIdentifier
132 sal_Bool
ReadSvIdl( SvStringHashEntry
* pName
, SvTokenStream
& rInStm
);
134 SvNumberIdentifier() : nValue( 0 ) {};
135 sal_Bool
IsSet() const
137 return SvIdentifier::IsSet() || nValue
!= 0;
139 sal_uInt32
GetValue() const { return nValue
; }
140 void SetValue( sal_uInt32 nVal
) { nValue
= nVal
; }
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
);
156 void setString(const OString
& rStr
)
160 const OString
& getString() const
164 sal_Bool
IsSet() const
166 return !m_aStr
.isEmpty();
168 friend SvStream
& operator << (SvStream
&, const SvString
&);
169 friend SvStream
& operator >> (SvStream
&, SvString
&);
171 sal_Bool
ReadSvIdl( SvStringHashEntry
* pName
, SvTokenStream
& rInStm
);
172 sal_Bool
WriteSvIdl( SvStringHashEntry
* pName
, SvStream
& rOutStm
,
177 class SvHelpText
: public SvString
181 sal_Bool
ReadSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
182 sal_Bool
WriteSvIdl( SvIdlDataBase
& rBase
, SvStream
& rOutStm
,
187 class SvHelpContext
: public SvNumberIdentifier
191 class SvUUId
: public SvGlobalName
195 sal_Bool
ReadSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
196 sal_Bool
WriteSvIdl( SvStream
& rOutStm
);
202 sal_uInt16 nMajorVersion
;
203 sal_uInt16 nMinorVersion
;
205 SvVersion() : nMajorVersion( 1 ), nMinorVersion( 0 ) {}
206 sal_Bool
operator == ( const SvVersion
& r
)
208 return (r
.nMajorVersion
== nMajorVersion
)
209 && (r
.nMinorVersion
== nMinorVersion
);
211 sal_Bool
operator != ( const SvVersion
& r
)
213 return !(*this == r
);
216 sal_uInt16
GetMajorVersion() const { return nMajorVersion
; }
217 sal_uInt16
GetMinorVersion() const { return nMinorVersion
; }
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
);
226 #endif // _BASTYPE_HXX
228 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */