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>
25 #include <database.hxx>
27 void SvMetaObject::WriteTab( SvStream
& rOutStm
, sal_uInt16 nTab
)
30 rOutStm
.WriteOString( " " );
33 void SvMetaObject::WriteStars( SvStream
& rOutStm
)
35 rOutStm
.WriteChar( '/' );
36 for( int i
= 6; i
> 0; i
-- )
37 rOutStm
.WriteOString( "**********" );
38 rOutStm
.WriteChar( '/' ) << endl
;
41 void SvMetaObject::Back2Delimiter( SvStream
& rOutStm
)
43 // write no empty brackets
44 sal_uInt64 nPos
= rOutStm
.Tell();
45 rOutStm
.SeekRel( -1 );
47 rOutStm
.ReadChar( c
);
49 while( rtl::isAsciiWhiteSpace( static_cast<unsigned char>(c
) )
50 && rOutStm
.Tell() != 1 )
52 rOutStm
.SeekRel( -2 );
53 rOutStm
.ReadChar( c
);
56 if( c
== ';' || c
== ',' )
57 rOutStm
.SeekRel( -1 );
62 SvMetaObject::SvMetaObject()
66 void SvMetaObject::SetName( const OString
& rName
)
71 bool SvMetaObject::ReadNameSvIdl( SvTokenStream
& rInStm
)
73 sal_uInt32 nTokPos
= rInStm
.Tell();
74 SvToken
& rTok
= rInStm
.GetToken_Next();
77 if( rTok
.IsIdentifier() )
79 SetName( rTok
.GetString() );
83 rInStm
.Seek( nTokPos
);
87 void SvMetaObject::ReadAttributesSvIdl( SvIdlDataBase
& ,
92 void SvMetaObject::DoReadContextSvIdl( SvIdlDataBase
& rBase
,
93 SvTokenStream
& rInStm
)
95 sal_uInt32 nBeginPos
= 0; // can not happen with Tell
96 while( nBeginPos
!= rInStm
.Tell() )
98 nBeginPos
= rInStm
.Tell();
99 ReadContextSvIdl( rBase
, rInStm
);
100 rInStm
.ReadIfDelimiter();
104 void SvMetaObject::ReadContextSvIdl( SvIdlDataBase
&, SvTokenStream
& )
108 bool SvMetaObject::ReadSvIdl( SvIdlDataBase
& rBase
, SvTokenStream
& rInStm
)
110 sal_uInt32 nTokPos
= rInStm
.Tell();
112 if( rInStm
.ReadIf( '[' ) )
114 sal_uInt32 nBeginPos
= 0; // can not happen with Tell
115 while( nBeginPos
!= rInStm
.Tell() )
117 nBeginPos
= rInStm
.Tell();
118 ReadAttributesSvIdl( rBase
, rInStm
);
119 rInStm
.ReadIfDelimiter();
121 bOk
= rInStm
.ReadIf( ']' );
124 if( bOk
&& rInStm
.ReadIf( '{' ) )
126 DoReadContextSvIdl( rBase
, rInStm
);
127 bOk
= rInStm
.ReadIf( '}' );
131 rInStm
.Seek( nTokPos
);
136 SvMetaReference::SvMetaReference()
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */