xref: /trunk/main/l10ntools/inc/wtranode.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 
29 #ifndef TX3_WTRANODE_HXX
30 #define TX3_WTRANODE_HXX
31 
32 // USED
33     // Base Classes
34     // Components
35     // Parameters
36 #include <tools/string.hxx>
37 
38 
39 typedef UINT8 BRANCH_T;
40 
41 
42 
43 const BRANCH_T C_BR_ALPHABASE   =  4;
44 const BRANCH_T C_NR_OF_BRANCHES = 34;
45 
46 
47 
48 
49 /** @task
50     This is a node of the parsing-tree which implements the fuctionality of
51     class WordTransTree.
52     WordTransTree is dependant of this class, but NOT the other way!
53 **/
54 class WTT_Node  // WordTransTree-Node
55 {
56   public:
57     enum E_TokenType
58     {
59 //      no_token = 0,
60         token_to_keep,
61         token_to_replace
62     };
63 
64     // LIFECYCLE
65                         WTT_Node(
66                             UINT8               i_nValue,   // Own branch-value.
67                             WTT_Node *          i_pDefaultBranch,
68                             WTT_Node *          i_pDefaultBranchForAlphas );
69     void                SetBranch(
70                             UINT8               i_cBranch,
71                             WTT_Node *          i_pNode );
72     void                SetAsTokenToReplace(
73                             const ByteString &  i_sReplaceString );
74                         ~WTT_Node();
75 
76     // OPERATIONS
77     WTT_Node *          GetNextNode(
78                             UINT8               i_cBranch ); /// [0 .. C_NR_OF_BRANCHES-1], sonst GPF !!!
79 
80     // INQUIRY
81     E_TokenType         TokenType() const;
82     UINT8               Value() const;
83     sal_Bool                IsOnDeleting() const;
84     const ByteString &  ReplaceString() const;
85 
86   private:
87     // DATA
88     UINT8               nValue;
89     E_TokenType         eType;
90     ByteString          sReplaceString;
91     WTT_Node *          aBranches[C_NR_OF_BRANCHES];    // Mostly DYN pointers.
92     char                bIsOnDeleting;
93 };
94 
95 
96 inline WTT_Node *
97 WTT_Node::GetNextNode(UINT8 i_cBranch)
98     { return aBranches[i_cBranch]; }
99 inline WTT_Node::E_TokenType
100 WTT_Node::TokenType() const
101     { return eType; }
102 inline UINT8
103 WTT_Node::Value() const
104     { return nValue; }
105 inline sal_Bool
106 WTT_Node::IsOnDeleting() const
107     { return bIsOnDeleting; }
108 inline const ByteString &
109 WTT_Node::ReplaceString() const
110     { return sReplaceString; }
111 
112 
113 
114 
115 #endif
116 
117 
118 
119