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 .
21 #include <bastype.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();
37 throw SvParseException(rInStm
, "xxx"_ostr
);
38 *this = rTok
.GetBool();
39 rInStm
.GetToken_Next();
42 *this = true; //default action set to TRUE
45 rInStm
.Seek( nTokPos
);
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
) )
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();
67 bOk
= rInStm
.ReadIf( ')' );
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() )
84 if( !rBase
.FindId( rTok
.GetString(), &n
) )
85 rBase
.SetAndWriteError( rInStm
, "no value for identifier <" + getString() + "> " );
86 setString(rTok
.GetString());
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
) )
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( ')' );
116 rInStm
.Seek( nTokPos
);
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */