Initial import of the CDE 2.1.30 sources from the Open Group.

This commit is contained in:
Peter Howkins
2012-03-10 18:21:40 +00:00
commit 83b6996daa
18978 changed files with 3945623 additions and 0 deletions

View File

@@ -0,0 +1,134 @@
// $TOG: SSPath.C /main/5 1998/04/17 11:49:33 mgreess $
#ifndef CDE_NEXT
#else
#include "dti_cc/CC_Tokenizer.h"
#endif
#include "SSPath.h"
#include "Debug.h"
#include "SymTab.h"
#include "StyleSheetExceptions.h"
unsigned int GI_CASE_SENSITIVE = false;
PathTerm::PathTerm(const Element& element) :
f_element(element), f_PQExpr(0)
{
}
PathTerm::PathTerm(const Symbol& symbol, PQExpr* expr) :
f_element(symbol), f_PQExpr(expr)
{
}
PathTerm::PathTerm(const char* symbol, PQExpr* expr) :
f_element(gElemSymTab -> intern(symbol, true)), f_PQExpr(expr)
{
}
PathTerm::~PathTerm()
{
delete f_PQExpr;
}
unsigned int PathTerm::operator ==(const PathTerm&)
{
MESSAGE(cerr, "PathTerm::operator ==() should not be called");
throw(CASTBEEXCEPT badEvaluationException());
return 0;
}
ostream& operator <<(ostream& out, PathTerm& pt)
{
out << pt.symbol() << " (" << int(pt.f_PQExpr) << ") ";
return out;
}
////////////////////////////////////////////
//
////////////////////////////////////////////
void SSPath::appendPathTerm(PathTerm* pt)
{
if ( pt -> pqexpr() )
f_containPathQualifier = true;
append(pt);
}
void SSPath::prependPath(SSPath& p)
{
if ( p.entries() == 0 )
return;
CC_TPtrDlistIterator<PathTerm> l_Iter(p);
l_Iter += p.entries();
PathTerm* l_pathTerm = 0;
do {
//prepend(new PathTerm(*l_Iter.key()));
l_pathTerm = l_Iter.key();
prepend(l_pathTerm);
if ( l_pathTerm -> pqexpr() )
f_containPathQualifier = true;
} while ( --l_Iter );
}
SSPath::SSPath()
: f_containPathQualifier(false), f_fastGetIndex(0)
{
}
SSPath::~SSPath()
{
// clean up memory
clearAndDestroy();
delete f_fastGetIndex;
}
SSPath::SSPath(char* str, unsigned int AssignId) :
f_containPathQualifier(false), f_fastGetIndex(0)
{
CC_String a(str);
CC_Tokenizer next(a);
CC_String token;
#ifndef CDE_NEXT
while ( !(token=next()).isNull() ) {
append(new PathTerm(token.data(), 0));
}
#else
while ( next() ) {
append(new PathTerm(token.data(), 0));
}
#endif
}
ostream& operator<<(ostream& out, SSPath& p)
{
CC_TPtrDlistIterator<PathTerm> l_Iter(p);
while ( ++l_Iter ) {
out << *l_Iter.key() << ' ';
}
return out;
}
void SSPath::fastGetIndex()
{
f_fastGetIndex = new value_vector<PathTermPtr>(entries());
CC_TPtrDlistIterator<PathTerm> l_Iter(*this);
int i=0;
while ( ++l_Iter ) {
(*f_fastGetIndex)[i++] = l_Iter.key();
}
}