1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tkpstam2.hxx,v $
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_TKPSTAM2_HXX
32 #define ADC_TKPSTAM2_HXX
36 #include <tokens/tkpcont2.hxx>
38 #include <tokens/stmstar2.hxx>
39 #include <tokens/stmstfi2.hxx>
42 This state-machine models state transitions from one state to another
43 per indices of branches. If the indices represent ascii-char-values,
44 the state-machine can be used for recognising tokens of text.
46 The state-machine can be a status itself.
48 StateMachin2 needs the array-size of all stati as a guess, how many stati
49 the state machine will contain, when at work.
57 typedef StmStatu2::Branch Branch
;
58 typedef StmStatu2
* * StatusList
;
64 intt in_nInitial_StatusListSize
); /// The user of the constructor should guess
65 /// the approximate number of stati here to
66 /// avoid multiple reallocations.
68 intt
AddStatus( /// @return the new #Status' ID
69 DYN StmStatu2
* let_dpStatus
);
72 const char * in_sToken
,
74 const INT16
* in_aBranches
,
75 INT16 in_nBoundsStatus
);
82 CharacterSource
& io_rText
);
86 intt in_nStatusNr
) const;
88 CurrentStatus() const;
92 /// Sets the PeekedStatus.
96 void ResizeStati(); // Adds space for 32 stati.
99 StatusList pStati
; /// List of Status, implemented as simple C-array of length #nStatiSpace
100 /// with nStatiLength valid members (beginning from zero).
104 intt nStatusSize
; /// Size of the branch array of a single status.
106 intt nNrofStati
; /// Nr of Stati so far.
107 intt nStatiSpace
; /// Size of allocated array for #pStati (size in items).
114 Adds a token, which will be recogniszeds by the