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 INCLUDED_IDL_INC_BASTYPE_HXX
21 : #define INCLUDED_IDL_INC_BASTYPE_HXX
22 :
23 :
24 : #include <sal/types.h>
25 : #include <tools/globname.hxx>
26 : #include <tools/stream.hxx>
27 :
28 : class SvStringHashEntry;
29 : class SvIdlDataBase;
30 : class SvTokenStream;
31 :
32 : class Svint
33 : {
34 : int nVal;
35 : bool bSet;
36 : public:
37 : Svint() { nVal = 0; bSet = false; }
38 : Svint( int n ) : nVal( n ), bSet( true ) {}
39 19116 : Svint( int n, bool bSetP ) : nVal( n ), bSet( bSetP ) {}
40 0 : Svint & operator = ( int n ) { nVal = n; bSet = true; return *this; }
41 :
42 0 : operator int ()const { return nVal; }
43 0 : bool IsSet() const { return bSet; }
44 : };
45 :
46 :
47 : class SvBOOL
48 : {
49 : bool nVal:1,
50 : bSet:1;
51 : public:
52 447622 : SvBOOL() { bSet = nVal = false; }
53 : SvBOOL( bool n ) : nVal( n ), bSet( true ) {}
54 160264 : SvBOOL( bool n, bool bSetP ) : nVal( n ), bSet( bSetP ) {}
55 213908 : SvBOOL & operator = ( bool n ) { nVal = n; bSet = true; return *this; }
56 :
57 214245 : operator bool() const { return nVal; }
58 : #ifdef STC
59 : operator int() const { return nVal; }
60 : #endif
61 : bool Is() const { return nVal; }
62 351948 : bool IsSet() const { return bSet; }
63 :
64 : friend SvStream& WriteSvBOOL(SvStream &, const SvBOOL &);
65 : friend SvStream& operator >> (SvStream &, SvBOOL &);
66 :
67 : bool ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
68 : };
69 :
70 :
71 166499 : class SvIdentifier
72 : {
73 : private:
74 : OString m_aStr;
75 : public:
76 165380 : SvIdentifier()
77 165380 : {
78 165380 : }
79 37302 : void setString(const OString& rStr)
80 : {
81 37302 : m_aStr = rStr;
82 37302 : }
83 12259330 : const OString& getString() const
84 : {
85 12259330 : return m_aStr;
86 : }
87 :
88 9324173 : bool IsSet() const
89 : {
90 9324173 : return !m_aStr.isEmpty();
91 : }
92 : bool ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
93 : };
94 :
95 :
96 52415 : class SvNumberIdentifier : public SvIdentifier
97 : {
98 : sal_uInt32 nValue;
99 : // must not be used
100 : bool ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
101 : public:
102 52112 : SvNumberIdentifier() : nValue( 0 ) {};
103 9324173 : bool IsSet() const
104 : {
105 9324173 : return SvIdentifier::IsSet() || nValue != 0;
106 : }
107 943963 : sal_uInt32 GetValue() const { return nValue; }
108 5 : void SetValue( sal_uInt32 nVal ) { nValue = nVal; }
109 :
110 : bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
111 : bool ReadSvIdl( SvIdlDataBase &, SvStringHashEntry * pName,
112 : SvTokenStream & rInStm );
113 : };
114 :
115 :
116 146216 : class SvString
117 : {
118 : private:
119 : OString m_aStr;
120 : public:
121 145400 : SvString() {}
122 21174 : void setString(const OString& rStr)
123 : {
124 21174 : m_aStr = rStr;
125 21174 : }
126 6143115 : const OString& getString() const
127 : {
128 6143115 : return m_aStr;
129 : }
130 0 : bool IsSet() const
131 : {
132 0 : return !m_aStr.isEmpty();
133 : }
134 : friend SvStream& WriteSvString(SvStream &, const SvString &);
135 : friend SvStream& operator >> (SvStream &, SvString &);
136 :
137 : bool ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm );
138 : };
139 :
140 :
141 30225 : class SvHelpText : public SvString
142 : {
143 : public:
144 30089 : SvHelpText() {}
145 : bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
146 : };
147 :
148 :
149 60314 : class SvHelpContext : public SvNumberIdentifier
150 : {
151 : };
152 :
153 6380 : class SvUUId : public SvGlobalName
154 : {
155 : public:
156 6380 : SvUUId() {}
157 : bool ReadSvIdl( SvIdlDataBase &, SvTokenStream & rInStm );
158 : };
159 :
160 :
161 : class SvVersion
162 : {
163 : sal_uInt16 nMajorVersion;
164 : sal_uInt16 nMinorVersion;
165 : public:
166 6380 : SvVersion() : nMajorVersion( 1 ), nMinorVersion( 0 ) {}
167 : bool operator == ( const SvVersion & r )
168 : {
169 : return (r.nMajorVersion == nMajorVersion)
170 : && (r.nMinorVersion == nMinorVersion);
171 : }
172 : bool operator != ( const SvVersion & r )
173 : {
174 : return !(*this == r);
175 : }
176 :
177 0 : sal_uInt16 GetMajorVersion() const { return nMajorVersion; }
178 0 : sal_uInt16 GetMinorVersion() const { return nMinorVersion; }
179 :
180 : friend SvStream& WriteSvVersion(SvStream &, const SvVersion &);
181 : friend SvStream& operator >> (SvStream &, SvVersion &);
182 : bool ReadSvIdl( SvTokenStream & rInStm );
183 : };
184 :
185 :
186 : #endif // INCLUDED_IDL_INC_BASTYPE_HXX
187 :
188 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|