1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef ADC_TKPCONT2_HXX 29 #define ADC_TKPCONT2_HXX 30 31 // USED SERVICES 32 // BASE CLASSES 33 // COMPONENTS 34 // PARAMETERS 35 class CharacterSource; 36 class TkpNullContext; 37 class TkpNullContex2; 38 39 /** @task 40 Specifies a context within which tokens are interpreted in a special 41 way. For example in parsing C++ there could be a context for code, 42 one for comments and a third one for preprocessor statements, because 43 each of these would give the same token different meanings. 44 **/ 45 class TkpContext 46 { 47 public: 48 // LIFECYCLE 49 virtual ~TkpContext() {} 50 51 // OPERATIONS 52 /** @descr 53 The functions starts to parse with the CurToken() of io_rText. 54 It leaves io_rText at the first char of the following Token or 55 the following Context. 56 57 This function returns, when a context has parsed some characterss 58 and completed a token OR left the context. 59 If the token is to be ignored, PassNewToken() returns false 60 and cuts the token from io_rText. 61 If the token is to be parsed further in a different context, 62 PassNewToken() returns false, but the token is 63 NOT cut from io_rText. 64 65 If the function has found a valid and complete token, PassNewToken() 66 passes the parsed token to the internally known receiver and 67 returns true. The token is cut from io_rText. 68 **/ 69 virtual void ReadCharChain( 70 CharacterSource & io_rText ) = 0; 71 /** Has to pass the parsed token to a known receiver. 72 @return true, if a token was passed. 73 false, if no token was parsed complete by this context. 74 */ 75 virtual bool PassNewToken() = 0; 76 virtual TkpContext & 77 FollowUpContext() = 0; 78 79 static TkpNullContext & 80 Null_(); 81 }; 82 83 TkpNullContex2 & TkpContext_Null2_(); 84 85 class StateMachineContext 86 { 87 public: 88 virtual ~StateMachineContext() {} 89 90 /// Is used by StmBoundsStatu2 only. 91 virtual void PerformStatusFunction( 92 uintt i_nStatusSignal, 93 UINT16 i_nTokenId, 94 CharacterSource & io_rText ) = 0; 95 }; 96 97 class TkpNullContex2 : public TkpContext 98 { 99 public: 100 ~TkpNullContex2(); 101 102 virtual void ReadCharChain( 103 CharacterSource & io_rText ); 104 virtual bool PassNewToken(); 105 virtual TkpContext & 106 FollowUpContext(); 107 }; 108 109 class TkpDocuContext : public TkpContext 110 { 111 public: 112 virtual void SetParentContext( 113 TkpContext & io_rParentContext, 114 const char * i_sMultiLineEndToken ) = 0; 115 virtual void SetMode_IsMultiLine( 116 bool i_bTrue ) = 0; 117 }; 118 119 120 121 #endif 122 123 124