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 : 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 2774297 : bool IsEof() const { return bEof; }
56 569 : void SetFileIndex( sal_uLong lFIndex ) { lFileIndex = lFIndex; }
57 19521 : sal_uLong GetFileIndex() { return( lFileIndex ); }
58 : sal_uLong GetSrcIndex() { return( lSrcIndex ); }
59 2587 : void SetLineNo( sal_uInt32 nLine ) { nLineNo = nLine; }
60 627 : sal_uInt32 GetLineNo() { return( nLineNo ); }
61 627 : sal_uInt32 GetScanPos() { return( nScanPos ); }
62 0 : char * GetLine() { return( pLine ); }
63 : int GetChar();
64 5681490 : int GetFastChar()
65 : {
66 5681490 : return pLine[ nScanPos ] ?
67 5681490 : pLine[ nScanPos++ ] : GetChar();
68 : }
69 : void GetNewLine();
70 : // Fehlerbehandlung
71 : void SetError( ERRTYPE aError );
72 : ERRTYPE GetError() { return aFirstError; }
73 : sal_uInt32 GetErrorLine() { return nErrorLine; }
74 : sal_uInt32 GetErrorPos() { return nErrorPos; }
75 : };
76 :
77 : /******************* F u n c t i o n *************************************/
78 : void IncludeParser( RscFileInst * pFileInst );
79 : ERRTYPE parser( RscFileInst * pFileInst );
80 :
81 : #endif // _RSCPAR_HXX
82 :
83 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|