bump product version to 6.4.0.3
[LibreOffice.git] / idl / source / objects / bastype.cxx
blob0dddd98d53237ce04411ce605e3c27875117d607
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 .
21 #include <limits.h>
22 #include <bastype.hxx>
23 #include <lex.hxx>
24 #include <globals.hxx>
25 #include <hash.hxx>
26 #include <database.hxx>
27 #include <tools/stream.hxx>
29 bool SvBOOL::ReadSvIdl( SvStringHashEntry const * pName, SvTokenStream & rInStm )
31 sal_uInt32 nTokPos = rInStm.Tell();
32 SvToken& rTok = rInStm.GetToken_Next();
34 if( rTok.Is( pName ) )
36 if( rInStm.ReadIf( '=' ) )
38 rTok = rInStm.GetToken();
39 if( !rTok.IsBool() )
40 throw SvParseException(rInStm, "xxx");
41 *this = rTok.GetBool();
42 rInStm.GetToken_Next();
44 else
45 *this = true; //default action set to TRUE
46 return true;
48 rInStm.Seek( nTokPos );
49 return false;
52 void SvIdentifier::ReadSvIdl( SvStringHashEntry const * pName, SvTokenStream & rInStm )
54 sal_uInt32 nTokPos = rInStm.Tell();
55 SvToken& rTok = rInStm.GetToken_Next();
57 if( rTok.Is( pName ) )
59 bool bOk = true;
60 bool bBracket = rInStm.ReadIf( '(' );
61 if( bBracket || rInStm.ReadIf( '=' ) )
63 rTok = rInStm.GetToken();
64 if( rTok.IsIdentifier() )
66 setString(rTok.GetString());
67 rInStm.GetToken_Next();
69 if( bOk && bBracket )
70 bOk = rInStm.ReadIf( ')' );
72 if( bOk )
73 return;
75 rInStm.Seek( nTokPos );
78 void SvIdentifier::ReadSvIdl( SvIdlDataBase & rBase,
79 SvTokenStream & rInStm )
81 sal_uInt32 nTokPos = rInStm.Tell();
82 SvToken& rTok = rInStm.GetToken_Next();
84 if( rTok.IsIdentifier() )
86 sal_uLong n;
87 if( !rBase.FindId( rTok.GetString(), &n ) )
88 rBase.SetAndWriteError( rInStm, "no value for identifier <" + getString() + "> " );
89 setString(rTok.GetString());
90 nValue = n;
91 return;
93 rInStm.Seek( nTokPos );
96 bool ReadStringSvIdl( SvStringHashEntry const * pName, SvTokenStream & rInStm, OString& aRetString )
98 sal_uInt32 nTokPos = rInStm.Tell();
99 SvToken& rTok = rInStm.GetToken_Next();
101 if( rTok.Is( pName ) )
103 bool bOk = true;
104 bool bBracket = rInStm.ReadIf( '(' );
105 if( bBracket || rInStm.ReadIf( '=' ) )
107 rTok = rInStm.GetToken();
108 if( rTok.IsString() )
110 aRetString = rTok.GetString();
111 rInStm.GetToken_Next();
113 if( bOk && bBracket )
114 bOk = rInStm.ReadIf( ')' );
116 if( bOk )
117 return true;
119 rInStm.Seek( nTokPos );
120 return false;
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */