Line data Source code
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 : #ifndef _RSCPAR_HXX
20 : #define _RSCPAR_HXX
21 :
22 : #include <rsctools.hxx>
23 : #include <rscerror.h>
24 :
25 : /****************** C L A S S E S ****************************************/
26 : class RscTypCont;
27 : /*********** R s c F i l e I n s t ***************************************/
28 :
29 : #define READBUFFER_MAX 256
30 : class RscFileInst
31 : {
32 : ERRTYPE aFirstError;// Erster Fehler
33 : sal_uInt32 nErrorLine; // Zeile des ersten Fehlers
34 : sal_uInt32 nErrorPos; // Position des ersten Fehlers
35 : sal_uInt32 nLineNo; // Zeile in der Eingabedatei
36 : sal_uLong lFileIndex; // Index auf Eingabedatei
37 : sal_uLong lSrcIndex; // Index auf Basisdatei
38 : FILE * fInputFile; // Eingabedatei
39 : char * pInput; // Lesepuffer
40 : sal_uInt32 nInputBufLen; // Laenge des Lesepuffers
41 : sal_uInt32 nInputPos; // Position im Lesepuffer
42 : sal_uInt32 nInputEndPos;// Ende im Lesepuffer
43 : char * pLine; // Zeile
44 : sal_uInt32 nLineBufLen;//Lange des Zeilenpuffres
45 : sal_uInt32 nScanPos; // Position in der Zeile
46 : int cLastChar;
47 : sal_Bool bEof;
48 :
49 : public:
50 : RscTypCont * pTypCont;
51 : void Init(); // ctor initialisieren
52 : RscFileInst( RscTypCont * pTC, sal_uLong lIndexSrc,
53 : sal_uLong lFileIndex, FILE * fFile );
54 : ~RscFileInst();
55 3120915 : sal_Bool IsEof() const { return bEof; }
56 632 : void SetFileIndex( sal_uLong lFIndex ) { lFileIndex = lFIndex; }
57 19550 : sal_uLong GetFileIndex() { return( lFileIndex ); }
58 : sal_uLong GetSrcIndex() { return( lSrcIndex ); }
59 2844 : void SetLineNo( sal_uInt32 nLine ) { nLineNo = nLine; }
60 692 : sal_uInt32 GetLineNo() { return( nLineNo ); }
61 692 : sal_uInt32 GetScanPos() { return( nScanPos ); }
62 0 : char * GetLine() { return( pLine ); }
63 : int GetChar();
64 6511271 : int GetFastChar() { return pLine[ nScanPos ] ?
65 6511271 : pLine[ nScanPos++ ] : GetChar();
66 : }
67 : void GetNewLine();
68 : // Fehlerbehandlung
69 : void SetError( ERRTYPE aError );
70 : ERRTYPE GetError() { return aFirstError; }
71 : sal_uInt32 GetErrorLine() { return nErrorLine; }
72 : sal_uInt32 GetErrorPos() { return nErrorPos; }
73 : };
74 :
75 : /******************* F u n c t i o n *************************************/
76 : void IncludeParser( RscFileInst * pFileInst );
77 : ERRTYPE parser( RscFileInst * pFileInst );
78 :
79 : #endif // _RSCPAR_HXX
80 :
81 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|