1*3cd96b95SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*3cd96b95SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*3cd96b95SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*3cd96b95SAndrew Rist * distributed with this work for additional information
6*3cd96b95SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*3cd96b95SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*3cd96b95SAndrew Rist * "License"); you may not use this file except in compliance
9*3cd96b95SAndrew Rist * with the License. You may obtain a copy of the License at
10*3cd96b95SAndrew Rist *
11*3cd96b95SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*3cd96b95SAndrew Rist *
13*3cd96b95SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*3cd96b95SAndrew Rist * software distributed under the License is distributed on an
15*3cd96b95SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*3cd96b95SAndrew Rist * KIND, either express or implied. See the License for the
17*3cd96b95SAndrew Rist * specific language governing permissions and limitations
18*3cd96b95SAndrew Rist * under the License.
19*3cd96b95SAndrew Rist *
20*3cd96b95SAndrew Rist *************************************************************/
21*3cd96b95SAndrew Rist
22*3cd96b95SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_l10ntools.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir
28cdf0e10cSrcweir #include "wtranode.hxx"
29cdf0e10cSrcweir
30cdf0e10cSrcweir
31cdf0e10cSrcweir // NOT FULLY DECLARED SERVICES
32cdf0e10cSrcweir
33cdf0e10cSrcweir
34cdf0e10cSrcweir const ByteString sEmptyString("");
35cdf0e10cSrcweir
36cdf0e10cSrcweir
WTT_Node(UINT8 i_nValue,WTT_Node * i_pDefaultBranch,WTT_Node * i_pDefaultBranchForAlphas)37cdf0e10cSrcweir WTT_Node::WTT_Node( UINT8 i_nValue,
38cdf0e10cSrcweir WTT_Node * i_pDefaultBranch,
39cdf0e10cSrcweir WTT_Node * i_pDefaultBranchForAlphas )
40cdf0e10cSrcweir : nValue(i_nValue),
41cdf0e10cSrcweir eType(token_to_keep),
42cdf0e10cSrcweir sReplaceString(sEmptyString),
43cdf0e10cSrcweir // aBranches,
44cdf0e10cSrcweir bIsOnDeleting(char(0))
45cdf0e10cSrcweir {
46cdf0e10cSrcweir int i = 0;
47cdf0e10cSrcweir for ( ; i < C_BR_ALPHABASE; i++ )
48cdf0e10cSrcweir {
49cdf0e10cSrcweir aBranches[i] = i_pDefaultBranch;
50cdf0e10cSrcweir } // end for
51cdf0e10cSrcweir for ( ; i < C_NR_OF_BRANCHES; i++ )
52cdf0e10cSrcweir {
53cdf0e10cSrcweir aBranches[i] = i_pDefaultBranchForAlphas;
54cdf0e10cSrcweir }
55cdf0e10cSrcweir }
56cdf0e10cSrcweir
57cdf0e10cSrcweir void
SetBranch(UINT8 i_cBranch,WTT_Node * i_pNode)58cdf0e10cSrcweir WTT_Node::SetBranch( UINT8 i_cBranch,
59cdf0e10cSrcweir WTT_Node * i_pNode )
60cdf0e10cSrcweir {
61cdf0e10cSrcweir if (i_cBranch < C_NR_OF_BRANCHES)
62cdf0e10cSrcweir {
63cdf0e10cSrcweir aBranches[i_cBranch] = i_pNode;
64cdf0e10cSrcweir }
65cdf0e10cSrcweir }
66cdf0e10cSrcweir
67cdf0e10cSrcweir void
SetAsTokenToReplace(const ByteString & i_sReplaceString)68cdf0e10cSrcweir WTT_Node::SetAsTokenToReplace(const ByteString & i_sReplaceString)
69cdf0e10cSrcweir {
70cdf0e10cSrcweir sReplaceString = i_sReplaceString;
71cdf0e10cSrcweir eType = token_to_replace;
72cdf0e10cSrcweir }
73cdf0e10cSrcweir
~WTT_Node()74cdf0e10cSrcweir WTT_Node::~WTT_Node()
75cdf0e10cSrcweir {
76cdf0e10cSrcweir // Delete the tree hanging below this node:
77cdf0e10cSrcweir
78cdf0e10cSrcweir bIsOnDeleting = sal_True; // Avoid double deleting of multiple used nodes.
79cdf0e10cSrcweir
80cdf0e10cSrcweir for (int i = 0; i < C_NR_OF_BRANCHES; i++)
81cdf0e10cSrcweir {
82cdf0e10cSrcweir if (aBranches[i] != 0 ? ! aBranches[i]->IsOnDeleting() : sal_False)
83cdf0e10cSrcweir {
84cdf0e10cSrcweir delete aBranches[i];
85cdf0e10cSrcweir }
86cdf0e10cSrcweir } // end for
87cdf0e10cSrcweir }
88cdf0e10cSrcweir
89cdf0e10cSrcweir
90cdf0e10cSrcweir
91cdf0e10cSrcweir
92cdf0e10cSrcweir
93cdf0e10cSrcweir
94cdf0e10cSrcweir
95cdf0e10cSrcweir
96cdf0e10cSrcweir
97cdf0e10cSrcweir
98cdf0e10cSrcweir
99cdf0e10cSrcweir
100cdf0e10cSrcweir
101cdf0e10cSrcweir
102cdf0e10cSrcweir
103cdf0e10cSrcweir
104cdf0e10cSrcweir
105