xref: /AOO41X/main/basic/source/inc/buffer.hxx (revision 234bd5c559aaf7abbd02d045859137b774cd8b34)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _BUFFER_HXX
25 #define _BUFFER_HXX
26 
27 #include <tools/solar.h>
28 #include <tools/string.hxx>
29 
30 class SbiParser;
31 
32 class SbiBuffer {                   // Code/Konstanten-Puffer:
33     SbiParser* pParser;             // fuer Fehlermeldungen
34     char*   pBuf;                   // Puffer-Pointer
35     char*   pCur;                   // aktueller Puffer-Pointer
36     sal_uInt32  nOff;                   // aktuelles Offset
37     sal_uInt32  nSize;                  // aktuelle Groesse
38     short   nInc;                   // Inkrement
39     sal_Bool    Check( sal_uInt16 );        // Buffergroesse testen
40 public:
41     SbiBuffer( SbiParser*, short ); // Inkrement
42    ~SbiBuffer();
43     void Patch( sal_uInt32, sal_uInt32 );   // Patchen
44     void Chain( sal_uInt32 );           // Back-Chain
45     void Align( sal_Int32 );            // Alignment
46     sal_Bool Add( const void*, sal_uInt16 );// Element anfuegen
47     sal_Bool operator += (const String&);// Basic-String speichern
48     sal_Bool operator += (sal_Int8);        // Zeichen speichern
49     sal_Bool operator += (sal_Int16);       // Integer speichern
50     sal_Bool operator += (sal_uInt8);       // Zeichen speichern
51     sal_Bool operator += (sal_uInt16);      // Integer speichern
52     sal_Bool operator += (sal_uInt32);      // Integer speichern
53     sal_Bool operator += (sal_Int32);       // Integer speichern
54     char*  GetBuffer();             // Puffer rausgeben (selbst loeschen!)
GetBufferPtr()55     char*  GetBufferPtr(){ return pBuf; }
GetSize()56     sal_uInt32 GetSize()                { return nOff; }
57 };
58 
59 #endif
60