1983d4c8aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3983d4c8aSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4983d4c8aSAndrew Rist * or more contributor license agreements. See the NOTICE file
5983d4c8aSAndrew Rist * distributed with this work for additional information
6983d4c8aSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7983d4c8aSAndrew Rist * to you under the Apache License, Version 2.0 (the
8983d4c8aSAndrew Rist * "License"); you may not use this file except in compliance
9983d4c8aSAndrew Rist * with the License. You may obtain a copy of the License at
10983d4c8aSAndrew Rist *
11983d4c8aSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12983d4c8aSAndrew Rist *
13983d4c8aSAndrew Rist * Unless required by applicable law or agreed to in writing,
14983d4c8aSAndrew Rist * software distributed under the License is distributed on an
15983d4c8aSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16983d4c8aSAndrew Rist * KIND, either express or implied. See the License for the
17983d4c8aSAndrew Rist * specific language governing permissions and limitations
18983d4c8aSAndrew Rist * under the License.
19983d4c8aSAndrew Rist *
20983d4c8aSAndrew Rist *************************************************************/
21983d4c8aSAndrew Rist
22983d4c8aSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir
25cdf0e10cSrcweir #ifndef TX3_WTRANODE_HXX
26cdf0e10cSrcweir #define TX3_WTRANODE_HXX
27cdf0e10cSrcweir
28cdf0e10cSrcweir // USED
29cdf0e10cSrcweir // Base Classes
30cdf0e10cSrcweir // Components
31cdf0e10cSrcweir // Parameters
32cdf0e10cSrcweir #include <tools/string.hxx>
33cdf0e10cSrcweir
34cdf0e10cSrcweir
35cdf0e10cSrcweir typedef UINT8 BRANCH_T;
36cdf0e10cSrcweir
37cdf0e10cSrcweir
38cdf0e10cSrcweir
39cdf0e10cSrcweir const BRANCH_T C_BR_ALPHABASE = 4;
40cdf0e10cSrcweir const BRANCH_T C_NR_OF_BRANCHES = 34;
41cdf0e10cSrcweir
42cdf0e10cSrcweir
43cdf0e10cSrcweir
44cdf0e10cSrcweir
45cdf0e10cSrcweir /** @task
46cdf0e10cSrcweir This is a node of the parsing-tree which implements the fuctionality of
47cdf0e10cSrcweir class WordTransTree.
48*a893be29SPedro Giffuni WordTransTree is dependent of this class, but NOT the other way!
49cdf0e10cSrcweir **/
50cdf0e10cSrcweir class WTT_Node // WordTransTree-Node
51cdf0e10cSrcweir {
52cdf0e10cSrcweir public:
53cdf0e10cSrcweir enum E_TokenType
54cdf0e10cSrcweir {
55cdf0e10cSrcweir // no_token = 0,
56cdf0e10cSrcweir token_to_keep,
57cdf0e10cSrcweir token_to_replace
58cdf0e10cSrcweir };
59cdf0e10cSrcweir
60cdf0e10cSrcweir // LIFECYCLE
61cdf0e10cSrcweir WTT_Node(
62cdf0e10cSrcweir UINT8 i_nValue, // Own branch-value.
63cdf0e10cSrcweir WTT_Node * i_pDefaultBranch,
64cdf0e10cSrcweir WTT_Node * i_pDefaultBranchForAlphas );
65cdf0e10cSrcweir void SetBranch(
66cdf0e10cSrcweir UINT8 i_cBranch,
67cdf0e10cSrcweir WTT_Node * i_pNode );
68cdf0e10cSrcweir void SetAsTokenToReplace(
69cdf0e10cSrcweir const ByteString & i_sReplaceString );
70cdf0e10cSrcweir ~WTT_Node();
71cdf0e10cSrcweir
72cdf0e10cSrcweir // OPERATIONS
73cdf0e10cSrcweir WTT_Node * GetNextNode(
74cdf0e10cSrcweir UINT8 i_cBranch ); /// [0 .. C_NR_OF_BRANCHES-1], sonst GPF !!!
75cdf0e10cSrcweir
76cdf0e10cSrcweir // INQUIRY
77cdf0e10cSrcweir E_TokenType TokenType() const;
78cdf0e10cSrcweir UINT8 Value() const;
79cdf0e10cSrcweir sal_Bool IsOnDeleting() const;
80cdf0e10cSrcweir const ByteString & ReplaceString() const;
81cdf0e10cSrcweir
82cdf0e10cSrcweir private:
83cdf0e10cSrcweir // DATA
84cdf0e10cSrcweir UINT8 nValue;
85cdf0e10cSrcweir E_TokenType eType;
86cdf0e10cSrcweir ByteString sReplaceString;
87cdf0e10cSrcweir WTT_Node * aBranches[C_NR_OF_BRANCHES]; // Mostly DYN pointers.
88cdf0e10cSrcweir char bIsOnDeleting;
89cdf0e10cSrcweir };
90cdf0e10cSrcweir
91cdf0e10cSrcweir
92cdf0e10cSrcweir inline WTT_Node *
GetNextNode(UINT8 i_cBranch)93cdf0e10cSrcweir WTT_Node::GetNextNode(UINT8 i_cBranch)
94cdf0e10cSrcweir { return aBranches[i_cBranch]; }
95cdf0e10cSrcweir inline WTT_Node::E_TokenType
TokenType() const96cdf0e10cSrcweir WTT_Node::TokenType() const
97cdf0e10cSrcweir { return eType; }
98cdf0e10cSrcweir inline UINT8
Value() const99cdf0e10cSrcweir WTT_Node::Value() const
100cdf0e10cSrcweir { return nValue; }
101cdf0e10cSrcweir inline sal_Bool
IsOnDeleting() const102cdf0e10cSrcweir WTT_Node::IsOnDeleting() const
103cdf0e10cSrcweir { return bIsOnDeleting; }
104cdf0e10cSrcweir inline const ByteString &
ReplaceString() const105cdf0e10cSrcweir WTT_Node::ReplaceString() const
106cdf0e10cSrcweir { return sReplaceString; }
107cdf0e10cSrcweir
108cdf0e10cSrcweir
109cdf0e10cSrcweir
110cdf0e10cSrcweir
111cdf0e10cSrcweir #endif
112cdf0e10cSrcweir
113cdf0e10cSrcweir
114cdf0e10cSrcweir
115