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 ADC_TKP2_HXX
25 #define ADC_TKP2_HXX
26 
27 // USED SERVICES
28 	// BASE CLASSES
29 	// COMPONENTS
30 class CharacterSource;
31 class TkpContext;
32 	// PARAMETRS
33 
34 
35 
36 /** This is the interface for parser classes, which get a sequence of Token s from
37 	a text.
38 
39 	Start() starts to parse the text from the given i_rSource.
40 	GetNextToken() returns a Token on the heap as long as there are
41 	still characters in the text left. The last time GetNextToken()
42 	returns NULL.
43 
44 	The algorithms for parsing tokens from the text are an issue of
45 	the derived classes.
46 */
47 class TokenParse2
48 {
49   public:
50 	// LIFECYCLE
51 						TokenParse2();
~TokenParse2()52 	virtual				~TokenParse2() {}
53 
54 	// OPERATIONS
55 	virtual void   		Start(
56 							CharacterSource &
57 											i_rSource );
58 
59 	/** @short	Gets the next identifiable token out of the
60 		source code.
61 		@return true, if there was passed a valid token.
62 				false, if the parsed stream is finished or
63                 	   an error occured.
64 	*/
65 	bool				GetNextToken();
66 
67   private:
68 	virtual void		SetStartContext() = 0;
69 	virtual void        SetCurrentContext(
70 							TkpContext &		io_rContext ) = 0;
71 	virtual TkpContext &
72 						CurrentContext() = 0;
73 	// DATA
74 	CharacterSource *	pChars;
75 };
76 
77 
78 #endif
79 
80 
81