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 .
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
;
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
; }
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
; }
59 operator int() const { return nVal
; }
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
);
79 void setString(const OString
& rStr
)
83 const OString
& getString() const
90 return !m_aStr
.isEmpty();
92 bool ReadSvIdl( SvStringHashEntry
* pName
, SvTokenStream
& rInStm
);
96 class SvNumberIdentifier
: public SvIdentifier
100 bool ReadSvIdl( SvStringHashEntry
* pName
, SvTokenStream
& rInStm
);
102 SvNumberIdentifier() : nValue( 0 ) {};
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
);
122 void setString(const OString
& rStr
)
126 const OString
& getString() 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
145 bool ReadSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
149 class SvHelpContext
: public SvNumberIdentifier
153 class SvUUId
: public SvGlobalName
157 bool ReadSvIdl( SvIdlDataBase
&, SvTokenStream
& rInStm
);
163 sal_uInt16 nMajorVersion
;
164 sal_uInt16 nMinorVersion
;
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: */