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 .
22 #include <bastype.hxx>
24 #include <globals.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();
40 throw SvParseException(rInStm
, "xxx");
41 *this = rTok
.GetBool();
42 rInStm
.GetToken_Next();
45 *this = true; //default action set to TRUE
48 rInStm
.Seek( nTokPos
);
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
) )
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();
70 bOk
= rInStm
.ReadIf( ')' );
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() )
87 if( !rBase
.FindId( rTok
.GetString(), &n
) )
88 rBase
.SetAndWriteError( rInStm
, "no value for identifier <" + getString() + "> " );
89 setString(rTok
.GetString());
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
) )
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( ')' );
119 rInStm
.Seek( nTokPos
);
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */