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 .
20 #include <sal/config.h>
22 #include <rtl/character.hxx>
26 #include <globals.hxx>
27 #include <database.hxx>
29 void SvMetaObject::WriteTab( SvStream
& rOutStm
, sal_uInt16 nTab
)
32 rOutStm
.WriteCharPtr( " " );
35 void SvMetaObject::WriteStars( SvStream
& rOutStm
)
37 rOutStm
.WriteChar( '/' );
38 for( int i
= 6; i
> 0; i
-- )
39 rOutStm
.WriteCharPtr( "**********" );
40 rOutStm
.WriteChar( '/' ) << endl
;
43 void SvMetaObject::Back2Delimiter( SvStream
& rOutStm
)
45 // write no empty brackets
46 sal_uLong nPos
= rOutStm
.Tell();
47 rOutStm
.SeekRel( -1 );
49 rOutStm
.ReadChar( c
);
51 while( rtl::isAsciiWhiteSpace( static_cast<unsigned char>(c
) )
52 && rOutStm
.Tell() != 1 )
54 rOutStm
.SeekRel( -2 );
55 rOutStm
.ReadChar( c
);
58 if( c
== ';' || c
== ',' )
59 rOutStm
.SeekRel( -1 );
64 SvMetaObject::SvMetaObject()
68 void SvMetaObject::SetName( const OString
& rName
)
73 bool SvMetaObject::ReadNameSvIdl( SvTokenStream
& rInStm
)
75 sal_uInt32 nTokPos
= rInStm
.Tell();
76 SvToken
& rTok
= rInStm
.GetToken_Next();
79 if( rTok
.IsIdentifier() )
81 SetName( rTok
.GetString() );
85 rInStm
.Seek( nTokPos
);
89 void SvMetaObject::ReadAttributesSvIdl( SvIdlDataBase
& ,
94 void SvMetaObject::DoReadContextSvIdl( SvIdlDataBase
& rBase
,
95 SvTokenStream
& rInStm
)
97 sal_uInt32 nBeginPos
= 0; // can not happen with Tell
98 while( nBeginPos
!= rInStm
.Tell() )
100 nBeginPos
= rInStm
.Tell();
101 ReadContextSvIdl( rBase
, rInStm
);
102 rInStm
.ReadIfDelimiter();
106 void SvMetaObject::ReadContextSvIdl( SvIdlDataBase
&, SvTokenStream
& )
110 bool SvMetaObject::ReadSvIdl( SvIdlDataBase
& rBase
, SvTokenStream
& rInStm
)
112 sal_uInt32 nTokPos
= rInStm
.Tell();
114 if( rInStm
.ReadIf( '[' ) )
116 sal_uInt32 nBeginPos
= 0; // can not happen with Tell
117 while( nBeginPos
!= rInStm
.Tell() )
119 nBeginPos
= rInStm
.Tell();
120 ReadAttributesSvIdl( rBase
, rInStm
);
121 rInStm
.ReadIfDelimiter();
123 bOk
= rInStm
.ReadIf( ']' );
126 if( bOk
&& rInStm
.ReadIf( '{' ) )
128 DoReadContextSvIdl( rBase
, rInStm
);
129 bOk
= rInStm
.ReadIf( '}' );
133 rInStm
.Seek( nTokPos
);
138 SvMetaReference::SvMetaReference()
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */