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 // $TOG: SSPath.C /main/5 1998/04/17 11:49:33 mgreess $
28 #include "dti_cc/CC_Tokenizer.h"
34 #include "StyleSheetExceptions.h"
36 unsigned int GI_CASE_SENSITIVE = false;
38 PathTerm::PathTerm(const Element& element) :
39 f_element(element), f_PQExpr(0)
43 PathTerm::PathTerm(const Symbol& symbol, PQExpr* expr) :
44 f_element(symbol), f_PQExpr(expr)
48 PathTerm::PathTerm(const char* symbol, PQExpr* expr) :
49 f_element(gElemSymTab -> intern(symbol, true)), f_PQExpr(expr)
58 unsigned int PathTerm::operator ==(const PathTerm&)
60 MESSAGE(cerr, "PathTerm::operator ==() should not be called");
61 throw(CASTBEEXCEPT badEvaluationException());
65 ostream& operator <<(ostream& out, PathTerm& pt)
67 out << pt.symbol() << " (" << size_t(pt.f_PQExpr) << ") ";
71 ////////////////////////////////////////////
73 ////////////////////////////////////////////
75 void SSPath::appendPathTerm(PathTerm* pt)
78 f_containPathQualifier = true;
83 void SSPath::prependPath(SSPath& p)
85 if ( p.entries() == 0 )
88 CC_TPtrDlistIterator<PathTerm> l_Iter(p);
89 l_Iter += p.entries();
91 PathTerm* l_pathTerm = 0;
94 //prepend(new PathTerm(*l_Iter.key()));
96 l_pathTerm = l_Iter.key();
100 if ( l_pathTerm -> pqexpr() )
101 f_containPathQualifier = true;
104 } while ( --l_Iter );
108 : f_containPathQualifier(false), f_fastGetIndex(0)
116 delete f_fastGetIndex;
119 SSPath::SSPath(char* str, unsigned int AssignId) :
120 f_containPathQualifier(false), f_fastGetIndex(0)
123 CC_Tokenizer next(a);
127 while ( !(token=next()).isNull() ) {
128 append(new PathTerm(token.data(), 0));
132 append(new PathTerm(token.data(), 0));
137 ostream& operator<<(ostream& out, SSPath& p)
139 CC_TPtrDlistIterator<PathTerm> l_Iter(p);
141 out << *l_Iter.key() << ' ';
146 void SSPath::fastGetIndex()
148 f_fastGetIndex = new value_vector<PathTermPtr>(entries());
150 CC_TPtrDlistIterator<PathTerm> l_Iter(*this);
153 (*f_fastGetIndex)[i++] = l_Iter.key();