Bump version to 24.04.3.4
[LibreOffice.git] / idl / source / objects / bastype.cxx
blob3d03c7308f747f28f4129d23a06699060a9871cf
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 <bastype.hxx>
22 #include <lex.hxx>
23 #include <hash.hxx>
24 #include <database.hxx>
26 bool SvBOOL::ReadSvIdl( SvStringHashEntry const * pName, SvTokenStream & rInStm )
28 sal_uInt32 nTokPos = rInStm.Tell();
29 SvToken& rTok = rInStm.GetToken_Next();
31 if( rTok.Is( pName ) )
33 if( rInStm.ReadIf( '=' ) )
35 rTok = rInStm.GetToken();
36 if( !rTok.IsBool() )
37 throw SvParseException(rInStm, "xxx"_ostr);
38 *this = rTok.GetBool();
39 rInStm.GetToken_Next();
41 else
42 *this = true; //default action set to TRUE
43 return true;
45 rInStm.Seek( nTokPos );
46 return false;
49 void SvIdentifier::ReadSvIdl( SvStringHashEntry const * pName, SvTokenStream & rInStm )
51 sal_uInt32 nTokPos = rInStm.Tell();
52 SvToken& rTok = rInStm.GetToken_Next();
54 if( rTok.Is( pName ) )
56 bool bOk = true;
57 bool bBracket = rInStm.ReadIf( '(' );
58 if( bBracket || rInStm.ReadIf( '=' ) )
60 rTok = rInStm.GetToken();
61 if( rTok.IsIdentifier() )
63 setString(rTok.GetString());
64 rInStm.GetToken_Next();
66 if( bOk && bBracket )
67 bOk = rInStm.ReadIf( ')' );
69 if( bOk )
70 return;
72 rInStm.Seek( nTokPos );
75 void SvIdentifier::ReadSvIdl( SvIdlDataBase & rBase,
76 SvTokenStream & rInStm )
78 sal_uInt32 nTokPos = rInStm.Tell();
79 SvToken& rTok = rInStm.GetToken_Next();
81 if( rTok.IsIdentifier() )
83 sal_uInt32 n;
84 if( !rBase.FindId( rTok.GetString(), &n ) )
85 rBase.SetAndWriteError( rInStm, "no value for identifier <" + getString() + "> " );
86 setString(rTok.GetString());
87 nValue = n;
88 return;
90 rInStm.Seek( nTokPos );
93 bool ReadStringSvIdl( SvStringHashEntry const * pName, SvTokenStream & rInStm, OString& aRetString )
95 sal_uInt32 nTokPos = rInStm.Tell();
96 SvToken& rTok = rInStm.GetToken_Next();
98 if( rTok.Is( pName ) )
100 bool bOk = true;
101 bool bBracket = rInStm.ReadIf( '(' );
102 if( bBracket || rInStm.ReadIf( '=' ) )
104 rTok = rInStm.GetToken();
105 if( rTok.IsString() )
107 aRetString = rTok.GetString();
108 rInStm.GetToken_Next();
110 if( bOk && bBracket )
111 bOk = rInStm.ReadIf( ')' );
113 if( bOk )
114 return true;
116 rInStm.Seek( nTokPos );
117 return false;
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */