Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
118
cde/programs/nsgmls/ContentState.h
Normal file
118
cde/programs/nsgmls/ContentState.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/* $XConsortium: ContentState.h /main/1 1996/07/29 16:48:27 cde-hp $ */
|
||||
// Copyright (c) 1994, 1996 James Clark
|
||||
// See the file COPYING for copying permission.
|
||||
|
||||
#ifndef ContentState_INCLUDED
|
||||
#define ContentState_INCLUDED 1
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include "OpenElement.h"
|
||||
#include "IList.h"
|
||||
#include "Vector.h"
|
||||
#include "Message.h"
|
||||
#include "Dtd.h"
|
||||
#include "Mode.h"
|
||||
#include "Boolean.h"
|
||||
|
||||
#ifdef SP_NAMESPACE
|
||||
namespace SP_NAMESPACE {
|
||||
#endif
|
||||
|
||||
class SP_API ContentState {
|
||||
public:
|
||||
ContentState();
|
||||
void startContent(const Dtd &);
|
||||
void pushElement(OpenElement *);
|
||||
OpenElement *popSaveElement();
|
||||
void popElement();
|
||||
OpenElement ¤tElement();
|
||||
const OpenElement ¤tElement() const;
|
||||
void getOpenElementInfo(Vector<OpenElementInfo> &,
|
||||
const StringC &rniPcdata) const;
|
||||
unsigned tagLevel() const;
|
||||
Boolean elementIsIncluded(const ElementType *) const;
|
||||
Boolean elementIsExcluded(const ElementType *) const;
|
||||
Boolean elementIsOpen(const ElementType *) const;
|
||||
Boolean afterDocumentElement() const;
|
||||
const ElementType *lastEndedElementType() const;
|
||||
Mode contentMode() const;
|
||||
const ElementType *lookupCreateUndefinedElement(const StringC &,
|
||||
const Location &);
|
||||
Boolean checkImplyLoop(unsigned);
|
||||
static const ShortReferenceMap theEmptyMap;
|
||||
private:
|
||||
IList<OpenElement> openElements_;
|
||||
Vector<unsigned> openElementCount_;
|
||||
Vector<unsigned> includeCount_;
|
||||
Vector<unsigned> excludeCount_;
|
||||
unsigned totalExcludeCount_;
|
||||
unsigned tagLevel_;
|
||||
unsigned netEnablingCount_;
|
||||
const ElementType *lastEndedElementType_;
|
||||
NamedTable<ElementType> undefinedElementTypeTable_;
|
||||
ElementType documentElementContainer_;
|
||||
};
|
||||
|
||||
inline
|
||||
OpenElement &ContentState::currentElement()
|
||||
{
|
||||
return *openElements_.head();
|
||||
}
|
||||
|
||||
inline
|
||||
const OpenElement &ContentState::currentElement() const
|
||||
{
|
||||
return *openElements_.head();
|
||||
}
|
||||
|
||||
inline
|
||||
Boolean ContentState::elementIsOpen(const ElementType *e) const
|
||||
{
|
||||
return openElementCount_[e->index()] != 0;
|
||||
}
|
||||
|
||||
inline
|
||||
Boolean ContentState::elementIsIncluded(const ElementType *e) const
|
||||
{
|
||||
return includeCount_[e->index()] != 0 && excludeCount_[e->index()] == 0;
|
||||
}
|
||||
|
||||
inline
|
||||
Boolean ContentState::elementIsExcluded(const ElementType *e) const
|
||||
{
|
||||
return excludeCount_[e->index()] != 0;
|
||||
}
|
||||
|
||||
inline
|
||||
const ElementType *ContentState::lastEndedElementType() const
|
||||
{
|
||||
return lastEndedElementType_;
|
||||
}
|
||||
|
||||
inline
|
||||
unsigned ContentState::tagLevel() const
|
||||
{
|
||||
return tagLevel_;
|
||||
}
|
||||
|
||||
inline
|
||||
Boolean ContentState::afterDocumentElement() const
|
||||
{
|
||||
return tagLevel() == 0 && currentElement().isFinished();
|
||||
}
|
||||
|
||||
inline
|
||||
Mode ContentState::contentMode() const
|
||||
{
|
||||
return openElements_.head()->mode(netEnablingCount_ > 0);
|
||||
}
|
||||
|
||||
#ifdef SP_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not ContentState_INCLUDED */
|
||||
Reference in New Issue
Block a user