2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: PathTable.h /main/4 1996/08/21 15:50:37 drk $ */
31 #include "dti_cc/CC_Dlist.h"
32 #include "dti_cc/cc_hdict.h"
39 #include "BitVector.h"
46 typedef unsigned int LetterType;
54 hashTable<LetterType, BitVector> f_SVectors;
56 LetterType f_wildCard;
57 LetterType f_unlimitedWildCard;
59 BitVector* f_copyOfS; // copy of S vector, used in match()
62 EncodedPath(SSPath* p, unsigned int asPattern = false);
65 int length() { return f_size; };
66 int patternLength() { return f_patternSize; };
68 unsigned int match(EncodedPath& p, SSPath* Pattern, SSPath* Elements);
77 FeatureSet* f_featureSet;
81 basePathFeature(SSPath* p=0, FeatureSet* f=0):
82 f_path(p), f_featureSet(f) {};
85 unsigned int operator==(const basePathFeature&) const;
87 SSPath* path() { return f_path; };
88 FeatureSet* featureSet() { return f_featureSet; };
90 void setPath(SSPath* p) { f_path = p; };
91 void setFeatureSet(FeatureSet* fs) { f_featureSet = fs; };
94 class PathFeature : public basePathFeature
97 EncodedPath* f_encodedPath;
100 PathFeature(SSPath* p,FeatureSet* f,EncodedPath* e=0, unsigned int id=0):
101 basePathFeature(p, f), f_id(id), f_encodedPath(e) {};
104 EncodedPath* encodedPath() { return f_encodedPath; };
105 unsigned int id() { return f_id; };
107 void setEncodedPath(EncodedPath* e) { f_encodedPath = e; };
108 void setID(int x) { f_id = x; };
110 unsigned int operator==(const PathFeature&) const;
112 unsigned int match(SSPath& p);
115 class PathFeatureList : public CC_TPtrDlist<PathFeature>
119 PathFeatureList() {};
120 virtual ~PathFeatureList();
122 void appendList(PathFeatureList&);
125 typedef CC_TPtrDlistIterator<PathFeature> PathFeatureListIterator;
128 // /////////////////////////////////////////////////////////////////////////
132 // /////////////////////////////////////////////////////////////////////////
134 typedef CC_TPtrDlist<PathFeature>* CC_TPtrDlist_PathFeature_Ptr_T;
142 // add a path and associated raw feature set
143 // this should only be called by the style sheet parser to build this internal
146 // Assume that the paths are passed in in left to right order. i.e.,
150 // with the example shown above.
152 //void addPathFeatureSet(Path*, FeatureSet *rawFeatureSet);
153 void addPathFeatureSet(PathFeature*);
155 // returns a NULL value if no feature set is available at this point
156 // this "new"s a new feature set, and the caller is responsible for
157 // deleting the object
158 FeatureSet* getFeatureSet(SSPath&);
160 friend ostream& operator<<(ostream&, PathTable&);
163 CC_TPtrDlist<PathFeature> f_pathFeatureList;
164 CC_TPtrDlist_PathFeature_Ptr_T *f_lastSymIndex;
165 unsigned int f_lastSymIndexCount ;
168 void initLastSymIndex();
169 unsigned int findIndex(SSPath&);
170 FeatureSet* getFeatureSet(int bucketIndex, SSPath&, int& pathId);
173 extern PathTable* gPathTab;
175 #endif /* _PathTable_h */
176 /* DO NOT ADD ANY LINES AFTER THIS #endif */