xref: /aoo41x/main/l10ntools/inc/wtranode.hxx (revision 983d4c8a)
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 
25 #ifndef TX3_WTRANODE_HXX
26 #define TX3_WTRANODE_HXX
27 
28 // USED
29 	// Base Classes
30 	// Components
31 	// Parameters
32 #include <tools/string.hxx>
33 
34 
35 typedef UINT8 BRANCH_T;
36 
37 
38 
39 const BRANCH_T C_BR_ALPHABASE 	=  4;
40 const BRANCH_T C_NR_OF_BRANCHES = 34;
41 
42 
43 
44 
45 /**	@task
46 	This is a node of the parsing-tree which implements the fuctionality of
47 	class WordTransTree.
48 	WordTransTree is dependant of this class, but NOT the other way!
49 **/
50 class WTT_Node	// WordTransTree-Node
51 {
52   public:
53 	enum E_TokenType
54 	{
55 //		no_token = 0,
56 		token_to_keep,
57 		token_to_replace
58 	};
59 
60 	// LIFECYCLE
61 						WTT_Node(
62 							UINT8				i_nValue,	// Own branch-value.
63 							WTT_Node *			i_pDefaultBranch,
64 							WTT_Node *			i_pDefaultBranchForAlphas );
65 	void				SetBranch(
66 							UINT8               i_cBranch,
67 							WTT_Node *			i_pNode );
68 	void				SetAsTokenToReplace(
69 							const ByteString &	i_sReplaceString );
70 						~WTT_Node();
71 
72 	// OPERATIONS
73 	WTT_Node *			GetNextNode(
74 							UINT8				i_cBranch ); /// [0 .. C_NR_OF_BRANCHES-1], sonst GPF !!!
75 
76 	// INQUIRY
77 	E_TokenType			TokenType() const;
78 	UINT8               Value() const;
79 	sal_Bool				IsOnDeleting() const;
80 	const ByteString &	ReplaceString() const;
81 
82   private:
83 	// DATA
84 	UINT8				nValue;
85 	E_TokenType			eType;
86 	ByteString 			sReplaceString;
87 	WTT_Node *			aBranches[C_NR_OF_BRANCHES];	// Mostly DYN pointers.
88 	char				bIsOnDeleting;
89 };
90 
91 
92 inline WTT_Node *
GetNextNode(UINT8 i_cBranch)93 WTT_Node::GetNextNode(UINT8	i_cBranch)
94 	{ return aBranches[i_cBranch]; }
95 inline WTT_Node::E_TokenType
TokenType() const96 WTT_Node::TokenType() const
97 	{ return eType; }
98 inline UINT8
Value() const99 WTT_Node::Value() const
100 	{ return nValue; }
101 inline sal_Bool
IsOnDeleting() const102 WTT_Node::IsOnDeleting() const
103 	{ return bIsOnDeleting; }
104 inline const ByteString &
ReplaceString() const105 WTT_Node::ReplaceString() const
106 	{ return sReplaceString; }
107 
108 
109 
110 
111 #endif
112 
113 
114 
115