Update ooo320-m1
[ooovba.git] / autodoc / source / parser / inc / tokens / tkpcontx.hxx
blob9b627b9febc283ad37b648d26ffae343a01483b9
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tkpcontx.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef ADC_TKPCONTX_HXX
32 #define ADC_TKPCONTX_HXX
34 // USED SERVICES
35 // BASE CLASSES
36 // COMPONENTS
37 // PARAMETERS
38 #include <tokens/token.hxx>
39 class CharacterSource;
40 class TkpNullContext;
42 /** @task
43 Specifies a context within which tokens are interpreted in a special
44 way. For example in parsing C++ there could be a context for code,
45 one for comments and a third one for preprocessor statements, because
46 each of these would give the same token different meanings.
48 The three functions
49 ReadCharChain()
50 PassNewToken()
51 FollowUpContext()
52 have to be called in this sequence.
54 **/
55 class TkpContext
57 public:
58 // LIFECYCLE
59 virtual ~TkpContext() {}
61 // OPERATIONS
62 /** @descr
63 The functions starts to parse with the CurChar() of io_rText.
64 It leaves io_rText.CurChar() at the first char of the following Token or
65 the following Context.
67 This function returns, when a context has parsed some characterss
68 and completed a token OR left the context.
69 If the token is to be ignored, it is cut from io_rText.
71 If the token is to be parsed further in a different context,
72 it is NOT cut from io_rText.
74 After this function PassNewToken() has to be called.
76 If the function has found a valid and complete token, PassNewToken()
77 passes the parsed token to the internally known receiver and
78 returns true. The token is cut from io_rText.
79 **/
80 virtual void ReadCharChain(
81 CharacterSource & io_rText ) = 0;
82 /** Has to pass the parsed token to a known receiver.
83 If the token is to be parsed further in a different context,
84 PassNewToken() returns false, but the token is NOT cut from io_rText.
86 @return true, if a token was passed.
87 false, if the token was not parsed completely by this context
88 or if the token is to be ignored.
90 virtual bool PassNewToken() = 0;
91 virtual TkpContext &
92 FollowUpContext() = 0;
94 static TkpNullContext &
95 Null_();
98 class StateMachineContext
100 public:
101 typedef TextToken::F_CRTOK F_CRTOK;
103 virtual ~StateMachineContext() {}
105 /// Is used by StmBoundsStatus only.
106 virtual void PerformStatusFunction(
107 uintt i_nStatusSignal,
108 F_CRTOK i_fTokenCreateFunction,
109 CharacterSource & io_rText ) = 0;
112 class TkpNullContext : public TkpContext
114 public:
115 ~TkpNullContext();
117 virtual void ReadCharChain(
118 CharacterSource & io_rText );
119 virtual bool PassNewToken();
120 virtual TkpContext &
121 FollowUpContext();
124 namespace autodoc
127 class TkpDocuContext : public TkpContext
129 public:
130 virtual void SetParentContext(
131 TkpContext & io_rParentContext,
132 const char * i_sMultiLineEndToken ) = 0;
133 virtual void AssignDealer(
134 TokenDealer & o_rDealer ) = 0;
135 virtual void SetMode_IsMultiLine(
136 bool i_bTrue ) = 0;
139 } // namespace autodoc
141 #endif