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