Update ooo320-m1
[ooovba.git] / autodoc / source / parser / inc / tokens / tkp.hxx
blobef79d6dff3d41490a47782ccb6504d6e91a0a67c
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: tkp.hxx,v $
10 * $Revision: 1.3 $
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_TKP_HXX
32 #define ADC_TKP_HXX
34 // USED SERVICES
35 // BASE CLASSES
36 // COMPONENTS
37 class CharacterSource;
38 class TkpContext;
39 // PARAMETRS
43 /** This is the interface for parser classes, which get a sequence of tokens from
44 a text.
46 Start() starts to parse the text from the given i_rSource.
47 GetNextToken() returns a Token on the heap as long as there are
48 still characters in the text left. This can be checked by
49 HasMore().
51 The algorithms for parsing tokens from the text are an issue of
52 the derived classes.
54 #if 0
55 /**
56 Parsing can be interrupted for a different source by PushSource().
57 The parsing before interruption is continued after PopSource().
59 #endif // 0
61 class TokenParser
63 public:
64 // LIFECYCLE
65 TokenParser();
66 virtual ~TokenParser() {}
68 // OPERATIONS
69 /** Start parsing a character source. Any previously parsed sources
70 are discarded.
72 virtual void Start(
73 CharacterSource &
74 i_rSource );
76 /** @short Gets the next identifiable token out of the
77 source code.
79 void GetNextToken();
81 /// @return true, if there are more tokens to parse.
82 bool HasMore() const { return bHasMore; }
84 private:
85 void InitSource(
86 CharacterSource &
87 i_rSource );
89 virtual void SetStartContext() = 0;
90 virtual void SetCurrentContext(
91 TkpContext & io_rContext ) = 0;
92 virtual TkpContext &
93 CurrentContext() = 0;
94 // DATA
95 CharacterSource * pChars;
96 bool bHasMore;
100 #endif