xref: /aoo41x/main/xml2cmp/source/inc/textfile.h (revision 514f4c20)
1*514f4c20SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*514f4c20SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*514f4c20SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*514f4c20SAndrew Rist  * distributed with this work for additional information
6*514f4c20SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*514f4c20SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*514f4c20SAndrew Rist  * "License"); you may not use this file except in compliance
9*514f4c20SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*514f4c20SAndrew Rist  *
11*514f4c20SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*514f4c20SAndrew Rist  *
13*514f4c20SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*514f4c20SAndrew Rist  * software distributed under the License is distributed on an
15*514f4c20SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*514f4c20SAndrew Rist  * KIND, either express or implied.  See the License for the
17*514f4c20SAndrew Rist  * specific language governing permissions and limitations
18*514f4c20SAndrew Rist  * under the License.
19*514f4c20SAndrew Rist  *
20*514f4c20SAndrew Rist  *************************************************************/
21*514f4c20SAndrew Rist 
22*514f4c20SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef CPV_TEXTFILE_H
25cdf0e10cSrcweir #define CPV_TEXTFILE_H
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <stdio.h>
28cdf0e10cSrcweir #include "str.h"
29cdf0e10cSrcweir 
30cdf0e10cSrcweir 
31cdf0e10cSrcweir 
32cdf0e10cSrcweir typedef struct TextFile
33cdf0e10cSrcweir {
34cdf0e10cSrcweir 	Cstring				sName;
35cdf0e10cSrcweir 	FILE *				hFile;
36cdf0e10cSrcweir     intt				nLastAction;
37cdf0e10cSrcweir } TextFile;
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #define TextFile_THIS		TextFile * pThis
40cdf0e10cSrcweir 
41cdf0e10cSrcweir 
42cdf0e10cSrcweir 
43cdf0e10cSrcweir void           		TextFile_CTOR( TextFile_THIS,
44cdf0e10cSrcweir 						char *				i_pName );
45cdf0e10cSrcweir void           		TextFile_DTOR( TextFile_THIS );
46cdf0e10cSrcweir 
47cdf0e10cSrcweir Bool			   	TF_Open( TextFile_THIS,
48cdf0e10cSrcweir 						char * 				i_sOptions );    /* options for second parameter of fopen */
49cdf0e10cSrcweir Bool			   	TF_Create( TextFile_THIS );
50cdf0e10cSrcweir void			   	TF_Close( TextFile_THIS );
51cdf0e10cSrcweir 
52cdf0e10cSrcweir void			   	TF_Goto( TextFile_THIS,
53cdf0e10cSrcweir 						intt	 			i_nPosition );
54cdf0e10cSrcweir intt			   	TF_Read( TextFile_THIS,
55cdf0e10cSrcweir 						char *				o_pBuffer,
56cdf0e10cSrcweir 						intt				i_nNrOfBytes );
57cdf0e10cSrcweir intt			   	TF_Write( TextFile_THIS,
58cdf0e10cSrcweir 						char *				i_pBuffer,
59cdf0e10cSrcweir 						intt				i_nNrOfBytes );
60cdf0e10cSrcweir intt			   	TF_WriteStr( TextFile_THIS,
61cdf0e10cSrcweir 						char *				i_pString );
62cdf0e10cSrcweir 
63cdf0e10cSrcweir intt			   	TF_Position( TextFile_THIS );
64cdf0e10cSrcweir intt			   	TF_Size( TextFile_THIS );
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 
69cdf0e10cSrcweir #endif
70cdf0e10cSrcweir 
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 
73