xref: /trunk/main/xml2cmp/source/inc/textbuff.h (revision 514f4c20)
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 CTLS_TEXTBUFF_H
25 #define CTLS_TEXTBUFF_H
26 
27 #include "textfile.h"
28 
29 
30 typedef struct TextBuffer
31 {
32 	char *				dpText;
33 	intt				nSize;
34 
35 	intt				nPosition;
36 
37 } TextBuffer;
38 
39 #define TextBuffer_THIS		TextBuffer * pThis
40 
41 
42 #define ENDS	'\0'
43 #define ENDL	'\n'
44 
45 typedef enum E_TB_Relation
46 {
47 	tb_begin,
48 	tb_cur,
49 	tb_end
50 } E_TB_Relation;
51 
52 
53 void			   	TextBuffer_CTOR( TextBuffer_THIS,
54 						intt				i_nSize );
55 void				TextBuffer_DTOR( TextBuffer_THIS );
56 void				TB_Resize( TextBuffer_THIS,
57                     	intt				i_nNewSize );
58 
59 Bool				TB_oin( TextBuffer_THIS,				/** operator>>(char *) */
60 						char * 				i_pText );
61 Bool				TB_oinChar( TextBuffer_THIS,			/** operator>>(char) */
62 						char  				i_cChar );
63 Bool				TB_oinFile( TextBuffer_THIS,			/** operator>>(TextFile*)  */
64 						TextFile *			i_pFile );
65 void				TB_opp( TextBuffer_THIS );				/** operator++ */
66 
67 intt				TB_Goto( TextBuffer_THIS,
68 						intt				i_nPosition,
69 						E_TB_Relation		i_nRelation );		/**	tb_begin, tb_cur, tb_end */
70 
71 
72 char *				TB_Text( TextBuffer_THIS );
73 char				TB_CurChar( TextBuffer_THIS );
74 char *				TB_CurCharPtr( TextBuffer_THIS );
75 intt				TB_Size( TextBuffer_THIS );
76 intt				TB_Position( TextBuffer_THIS );
77 Bool				TB_EndOfBuffer( TextBuffer_THIS );
78 
79 
80 #endif
81 
82