LibreOffice Module idl (master) 1
basobj.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <sal/config.h>
21
22#include <rtl/character.hxx>
23
24#include <basobj.hxx>
25#include <database.hxx>
26
27void SvMetaObject::WriteTab( SvStream & rOutStm, sal_uInt16 nTab )
28{
29 while( nTab-- )
30 rOutStm.WriteOString( " " );
31}
32
34{
35 rOutStm.WriteChar( '/' );
36 for( int i = 6; i > 0; i-- )
37 rOutStm.WriteOString( "**********" );
38 rOutStm.WriteChar( '/' ) << endl;
39}
40
42{
43 // write no empty brackets
44 sal_uInt64 nPos = rOutStm.Tell();
45 rOutStm.SeekRel( -1 );
46 char c = 0;
47 rOutStm.ReadChar( c );
48
49 while( rtl::isAsciiWhiteSpace( static_cast<unsigned char>(c) )
50 && rOutStm.Tell() != 1 )
51 {
52 rOutStm.SeekRel( -2 );
53 rOutStm.ReadChar( c );
54 }
55
56 if( c == ';' || c == ',' )
57 rOutStm.SeekRel( -1 );
58 else
59 rOutStm.Seek( nPos );
60}
61
63{
64}
65
66void SvMetaObject::SetName( const OString& rName )
67{
68 aName = rName;
69}
70
72{
73 sal_uInt32 nTokPos = rInStm.Tell();
74 SvToken& rTok = rInStm.GetToken_Next();
75
76 // read module name
77 if( rTok.IsIdentifier() )
78 {
79 SetName( rTok.GetString() );
80 return true;
81 }
82
83 rInStm.Seek( nTokPos );
84 return false;
85}
86
89{
90}
91
93 SvTokenStream & rInStm )
94{
95 sal_uInt32 nBeginPos = 0; // can not happen with Tell
96 while( nBeginPos != rInStm.Tell() )
97 {
98 nBeginPos = rInStm.Tell();
99 ReadContextSvIdl( rBase, rInStm );
100 rInStm.ReadIfDelimiter();
101 }
102}
103
105{
106}
107
109{
110 sal_uInt32 nTokPos = rInStm.Tell();
111 bool bOk = true;
112 if( rInStm.ReadIf( '[' ) )
113 {
114 sal_uInt32 nBeginPos = 0; // can not happen with Tell
115 while( nBeginPos != rInStm.Tell() )
116 {
117 nBeginPos = rInStm.Tell();
118 ReadAttributesSvIdl( rBase, rInStm );
119 rInStm.ReadIfDelimiter();
120 }
121 bOk = rInStm.ReadIf( ']' );
122 }
123
124 if( bOk && rInStm.ReadIf( '{' ) )
125 {
126 DoReadContextSvIdl( rBase, rInStm );
127 bOk = rInStm.ReadIf( '}' );
128 }
129
130 if( !bOk )
131 rInStm.Seek( nTokPos );
132 return bOk;
133}
134
135
137{
138}
139
140
141/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void DoReadContextSvIdl(SvIdlDataBase &, SvTokenStream &rInStm)
Definition: basobj.cxx:92
OString aName
Definition: basobj.hxx:85
virtual void ReadContextSvIdl(SvIdlDataBase &, SvTokenStream &rInStm)
Definition: basobj.cxx:104
void SetName(const OString &rName)
Definition: basobj.cxx:66
static void WriteStars(SvStream &)
Definition: basobj.cxx:33
SvMetaObject()
Definition: basobj.cxx:62
bool ReadNameSvIdl(SvTokenStream &rInStm)
Definition: basobj.cxx:71
static void WriteTab(SvStream &rOutStm, sal_uInt16 nTab)
Definition: basobj.cxx:27
virtual void ReadAttributesSvIdl(SvIdlDataBase &rBase, SvTokenStream &rInStm)
Definition: basobj.cxx:87
virtual bool ReadSvIdl(SvIdlDataBase &, SvTokenStream &rInStm)
Definition: basobj.cxx:108
static void Back2Delimiter(SvStream &)
Definition: basobj.cxx:41
sal_uInt64 Tell() const
SvStream & WriteOString(std::string_view rStr)
SvStream & ReadChar(char &rChar)
sal_uInt64 Seek(sal_uInt64 nPos)
SvStream & WriteChar(char nChar)
sal_uInt64 SeekRel(sal_Int64 nPos)
void Seek(sal_uInt32 nPos)
Definition: lex.hxx:202
bool ReadIf(char cChar)
Definition: lex.hxx:179
SvToken & GetToken_Next()
Definition: lex.hxx:165
void ReadIfDelimiter()
Definition: lex.hxx:190
sal_uInt32 Tell() const
Definition: lex.hxx:200
Definition: lex.hxx:36
bool IsIdentifier() const
Definition: lex.hxx:68
const OString & GetString() const
Definition: lex.hxx:76
sal_uInt16 nPos
int i
TOOLS_DLLPUBLIC SvStream & endl(SvStream &rStr)