You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2001/05/03 20:18:46 UTC

cvs commit: xml-xerces/c/src/util/regx RangeTokenMap.cpp RangeTokenMap.hpp ASCIIRangeFactory.cpp BlockRangeFactory.cpp ConditionToken.hpp Makefile.in Match.hpp Op.hpp ParserForXMLSchema.cpp ParserForXMLSchema.hpp RangeFactory.cpp RangeFactory.hpp RangeToken.cpp RangeToken.hpp RegularExpression.cpp RegularExpression.hpp RegxParser.cpp RegxParser.hpp Token.cpp Token.hpp TokenFactory.cpp TokenFactory.hpp UnicodeRangeFactory.cpp UnionToken.cpp UnionToken.hpp XMLRangeFactory.cpp

knoaman     01/05/03 11:18:45

  Modified:    c/src/util/regx ASCIIRangeFactory.cpp BlockRangeFactory.cpp
                        ConditionToken.hpp Makefile.in Match.hpp Op.hpp
                        ParserForXMLSchema.cpp ParserForXMLSchema.hpp
                        RangeFactory.cpp RangeFactory.hpp RangeToken.cpp
                        RangeToken.hpp RegularExpression.cpp
                        RegularExpression.hpp RegxParser.cpp RegxParser.hpp
                        Token.cpp Token.hpp TokenFactory.cpp
                        TokenFactory.hpp UnicodeRangeFactory.cpp
                        UnionToken.cpp UnionToken.hpp XMLRangeFactory.cpp
  Added:       c/src/util/regx RangeTokenMap.cpp RangeTokenMap.hpp
  Log:
  Some design changes:
  o Changed the TokenFactory from a single static instance, to a
     normal class. Each RegularExpression object will have its own
     instance of TokenFactory, and that instance will be passed to
     other classes that need to use a TokenFactory to create Token
     objects (with the exception of RangeTokenMap).
  o Added a new class RangeTokenMap to map a the different ranges
     in a given category to a specific RangeFactory object. In the old
     design RangeFactory had dual functionality (act as a Map, and as
     a factory for creating RangeToken(s)). The RangeTokenMap will
     have its own copy of the TokenFactory. There will be only one
     instance of the RangeTokenMap class, and that instance will be
     lazily deleted when XPlatformUtils::Terminate is called.
  
  Revision  Changes    Path
  1.2       +29 -16    xml-xerces/c/src/util/regx/ASCIIRangeFactory.cpp
  
  Index: ASCIIRangeFactory.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/ASCIIRangeFactory.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ASCIIRangeFactory.cpp	2001/03/02 19:26:39	1.1
  +++ ASCIIRangeFactory.cpp	2001/05/03 18:17:18	1.2
  @@ -56,6 +56,21 @@
   
   /*
    * $Log: ASCIIRangeFactory.cpp,v $
  + * Revision 1.2  2001/05/03 18:17:18  knoaman
  + * Some design changes:
  + * o Changed the TokenFactory from a single static instance, to a
  + *    normal class. Each RegularExpression object will have its own
  + *    instance of TokenFactory, and that instance will be passed to
  + *    other classes that need to use a TokenFactory to create Token
  + *    objects (with the exception of RangeTokenMap).
  + * o Added a new class RangeTokenMap to map a the different ranges
  + *    in a given category to a specific RangeFactory object. In the old
  + *    design RangeFactory had dual functionality (act as a Map, and as
  + *    a factory for creating RangeToken(s)). The RangeTokenMap will
  + *    have its own copy of the TokenFactory. There will be only one
  + *    instance of the RangeTokenMap class, and that instance will be
  + *    lazily deleted when XPlatformUtils::Terminate is called.
  + *
    * Revision 1.1  2001/03/02 19:26:39  knoaman
    * Schema: Regular expression handling part II
    *
  @@ -68,6 +83,7 @@
   #include <util/regx/RegxDefs.hpp>
   #include <util/regx/TokenFactory.hpp>
   #include <util/regx/RangeToken.hpp>
  +#include <util/regx/RangeTokenMap.hpp>
   
   
   // ---------------------------------------------------------------------------
  @@ -95,39 +111,46 @@
       if (fRangesCreated)
           return;
   
  +    if (!fKeywordsInitialized) {
  +        initializeKeywordMap();
  +    }
  +
  +    RangeTokenMap* rangeTokMap = RangeTokenMap::instance();
  +    TokenFactory* tokFactory = rangeTokMap->getTokenFactory();
  +
       // Create space ranges
  -    RangeToken* tok = TokenFactory::instance()->createRange();
  +    RangeToken* tok = tokFactory->createRange();
       tok->addRange(chHTab, chHTab);
   	tok->addRange(chLF, chLF);
   	tok->addRange(chFF, chFF);
   	tok->addRange(chCR, chCR);
   	tok->addRange(chSpace, chSpace);
  -    setRangeToken(fgASCIISpace, tok);
  +	rangeTokMap->setRangeToken(fgASCIISpace, tok);
   
       // Create digits ranges
  -    tok = TokenFactory::instance()->createRange();
  +    tok = tokFactory->createRange();
       tok->addRange(chDigit_0, chDigit_9);
  -    setRangeToken(fgASCIIDigit, tok);
  +    rangeTokMap->setRangeToken(fgASCIIDigit, tok);
   
       // Create word ranges
  -    tok = TokenFactory::instance()->createRange();
  +    tok = tokFactory->createRange();
       tok->addRange(chDigit_0, chDigit_9);
   	tok->addRange(chLatin_A, chLatin_Z);
       tok->addRange(chUnderscore, chUnderscore);
   	tok->addRange(chLatin_a, chLatin_z);
  -    setRangeToken(fgASCIIWord, tok);
  +    rangeTokMap->setRangeToken(fgASCIIWord, tok);
   
       // Create xdigit ranges
  -    tok = TokenFactory::instance()->createRange();
  +    tok = tokFactory->createRange();
       tok->addRange(chDigit_0, chDigit_9);
       tok->addRange(chLatin_A, chLatin_F);
       tok->addRange(chLatin_a, chLatin_a);
  -    setRangeToken(fgASCIIXDigit, tok);
  +    rangeTokMap->setRangeToken(fgASCIIXDigit, tok);
   
       // Create ascii ranges
  -    tok = TokenFactory::instance()->createRange();
  +    tok = tokFactory->createRange();
       tok->addRange(0x00, 0x7F);
  -    setRangeToken(fgASCII, tok);
  +    rangeTokMap->setRangeToken(fgASCII, tok);
   
       fRangesCreated = true;
   }
  @@ -139,12 +162,14 @@
   
       if (fKeywordsInitialized)
           return;
  +
  +	RangeTokenMap* rangeTokMap = RangeTokenMap::instance();
   
  -    addKeywordMap(fgASCIISpace, fgASCIICategory);
  -    addKeywordMap(fgASCIIDigit, fgASCIICategory);
  -    addKeywordMap(fgASCIIWord, fgASCIICategory);
  -    addKeywordMap(fgASCIIXDigit, fgASCIICategory);
  -    addKeywordMap(fgASCII, fgASCIICategory);
  +    rangeTokMap->addKeywordMap(fgASCIISpace, fgASCIICategory);
  +    rangeTokMap->addKeywordMap(fgASCIIDigit, fgASCIICategory);
  +    rangeTokMap->addKeywordMap(fgASCIIWord, fgASCIICategory);
  +    rangeTokMap->addKeywordMap(fgASCIIXDigit, fgASCIICategory);
  +    rangeTokMap->addKeywordMap(fgASCII, fgASCIICategory);
   
       fKeywordsInitialized = true;
   }
  
  
  
  1.2       +18 -5     xml-xerces/c/src/util/regx/BlockRangeFactory.cpp
  
  Index: BlockRangeFactory.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/BlockRangeFactory.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BlockRangeFactory.cpp	2001/03/02 19:26:41	1.1
  +++ BlockRangeFactory.cpp	2001/05/03 18:17:21	1.2
  @@ -56,6 +56,21 @@
   
   /*
    * $Log: BlockRangeFactory.cpp,v $
  + * Revision 1.2  2001/05/03 18:17:21  knoaman
  + * Some design changes:
  + * o Changed the TokenFactory from a single static instance, to a
  + *    normal class. Each RegularExpression object will have its own
  + *    instance of TokenFactory, and that instance will be passed to
  + *    other classes that need to use a TokenFactory to create Token
  + *    objects (with the exception of RangeTokenMap).
  + * o Added a new class RangeTokenMap to map a the different ranges
  + *    in a given category to a specific RangeFactory object. In the old
  + *    design RangeFactory had dual functionality (act as a Map, and as
  + *    a factory for creating RangeToken(s)). The RangeTokenMap will
  + *    have its own copy of the TokenFactory. There will be only one
  + *    instance of the RangeTokenMap class, and that instance will be
  + *    lazily deleted when XPlatformUtils::Terminate is called.
  + *
    * Revision 1.1  2001/03/02 19:26:41  knoaman
    * Schema: Regular expression handling part II
    *
  @@ -65,9 +80,10 @@
   //  Includes
   // ---------------------------------------------------------------------------
   #include <util/regx/BlockRangeFactory.hpp>
  -#include <util/regx/TokenFactory.hpp>
   #include <util/regx/RangeToken.hpp>
   #include <util/regx/RegxDefs.hpp>
  +#include <util/regx/TokenFactory.hpp>
  +#include <util/regx/RangeTokenMap.hpp>
   #include <util/XMLString.hpp>
   
   
  @@ -291,16 +307,23 @@
       if (fRangesCreated)
           return;
   
  +    if (!fKeywordsInitialized) {
  +        initializeKeywordMap();
  +    }
  +
  +    RangeTokenMap* rangeTokMap = RangeTokenMap::instance();
  +    TokenFactory* tokFactory = rangeTokMap->getTokenFactory();
  +
       for (int i=0; i < SIZE; i++) {
   
  -		RangeToken* tok = TokenFactory::instance()->createRange();
  +		RangeToken* tok = tokFactory->createRange();
           tok->addRange(blockRanges[i*2], blockRanges[(i*2)+1]);
   
   		if (XMLString::compareString((XMLCh*)fgBlockNames[i] , (XMLCh*) fgBlockSpecials) == 0) {
               tok->addRange(0xFFF0, 0xFFFd);
           }
   
  -		setRangeToken(fgBlockNames[i], tok);
  +		rangeTokMap->setRangeToken(fgBlockNames[i], tok);
       }
   
       fRangesCreated = true;
  @@ -314,8 +337,10 @@
       if (fKeywordsInitialized)
           return;
   
  +	RangeTokenMap* rangeTokMap = RangeTokenMap::instance();
  +
   	for (int i=0; i< SIZE; i++) {
  -        addKeywordMap(fgBlockNames[i], fgBlockCategory);
  +        rangeTokMap->addKeywordMap(fgBlockNames[i], fgBlockCategory);
       }
   
       fKeywordsInitialized = true;
  
  
  
  1.2       +2 -2      xml-xerces/c/src/util/regx/ConditionToken.hpp
  
  Index: ConditionToken.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/ConditionToken.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConditionToken.hpp	2001/03/02 19:22:39	1.1
  +++ ConditionToken.hpp	2001/05/03 18:17:22	1.2
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: ConditionToken.hpp,v 1.1 2001/03/02 19:22:39 knoaman Exp $
  + * $Id: ConditionToken.hpp,v 1.2 2001/05/03 18:17:22 knoaman Exp $
    */
   
   #if !defined(CONDITIONTOKEN_HPP)
  @@ -117,7 +117,7 @@
   inline Token* ConditionToken::getChild(const int index) const {
   
       if (index < 0 || index > 1)
  -        throw; //ThrowXML(RuntimeException, ...)
  +        ThrowXML(RuntimeException, XMLExcepts::Regex_InvalidChildIndex);
   
       if (index == 0)
           return fYesToken;
  
  
  
  1.2       +5 -0      xml-xerces/c/src/util/regx/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/Makefile.in,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Makefile.in	2001/03/02 19:26:43	1.1
  +++ Makefile.in	2001/05/03 18:17:24	1.2
  @@ -56,6 +56,21 @@
   #
   #
   # $Log: Makefile.in,v $
  +# Revision 1.2  2001/05/03 18:17:24  knoaman
  +# Some design changes:
  +# o Changed the TokenFactory from a single static instance, to a
  +#    normal class. Each RegularExpression object will have its own
  +#    instance of TokenFactory, and that instance will be passed to
  +#    other classes that need to use a TokenFactory to create Token
  +#    objects (with the exception of RangeTokenMap).
  +# o Added a new class RangeTokenMap to map a the different ranges
  +#    in a given category to a specific RangeFactory object. In the old
  +#    design RangeFactory had dual functionality (act as a Map, and as
  +#    a factory for creating RangeToken(s)). The RangeTokenMap will
  +#    have its own copy of the TokenFactory. There will be only one
  +#    instance of the RangeTokenMap class, and that instance will be
  +#    lazily deleted when XPlatformUtils::Terminate is called.
  +#
   # Revision 1.1  2001/03/02 19:26:43  knoaman
   # Schema: Regular expression handling part II
   #
  @@ -106,6 +121,7 @@
   	BlockRangeFactory.hpp \
   	UnicodeRangeFactory.hpp \
   	ASCIIRangeFactory.hpp \
  +	RangeTokenMap.hpp \
   	TokenFactory.hpp \
   	RegxParser.hpp \
   	ParserForXMLSchema.hpp \
  @@ -132,6 +148,7 @@
   	BlockRangeFactory.$(TO) \
   	UnicodeRangeFactory.$(TO) \
   	ASCIIRangeFactory.$(TO) \
  +	RangeTokenMap.$(TO) \
   	TokenFactory.$(TO) \
   	RegxParser.$(TO) \
   	ParserForXMLSchema.$(TO) \
  
  
  
  1.2       +7 -6      xml-xerces/c/src/util/regx/Match.hpp
  
  Index: Match.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/Match.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Match.hpp	2001/03/02 19:22:40	1.1
  +++ Match.hpp	2001/05/03 18:17:26	1.2
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: Match.hpp,v 1.1 2001/03/02 19:22:40 knoaman Exp $
  + * $Id: Match.hpp,v 1.2 2001/05/03 18:17:26 knoaman Exp $
    */
   
   #if !defined(MATCH_HPP)
  @@ -65,6 +65,7 @@
   //  Includes
   // ---------------------------------------------------------------------------
   #include <util/ArrayIndexOutOfBoundsException.hpp>
  +#include <util/RuntimeException.hpp>
   
   /**
     * An instance of this class has ranges captured in matching
  @@ -131,7 +132,7 @@
   inline int Match::getNoGroups() const {
   
   	if (fNoGroups < 0)
  -		throw; // ThrowXML(IllegalStateException, REGEX_RESULT_NOT_SET)
  +		ThrowXML(RuntimeException, XMLExcepts::Regex_Result_Not_Set);
   
   	return fNoGroups;
   }
  @@ -139,7 +140,7 @@
   inline int Match::getStartPos(int index) const {
   
   	if (!fStartPositions)
  -		throw; // ThrowXML(IllegalStateException, REGEX_RESULT_NOT_SET)
  +		ThrowXML(RuntimeException, XMLExcepts::Regex_Result_Not_Set);
   
   	if (index < 0 || fNoGroups <= index)
   		ThrowXML(ArrayIndexOutOfBoundsException, XMLExcepts::Array_BadIndex);
  @@ -150,7 +151,7 @@
   inline int Match::getEndPos(int index) const {
   
   	if (!fEndPositions)
  -		throw; // ThrowXML(IllegalStateException, REGEX_RESULT_NOT_SET)
  +		ThrowXML(RuntimeException, XMLExcepts::Regex_Result_Not_Set);
   
   	if (index < 0 || fNoGroups <= index)
   		ThrowXML(ArrayIndexOutOfBoundsException, XMLExcepts::Array_BadIndex);
  @@ -164,7 +165,7 @@
   inline void Match::setStartPos(const int index, const int value) {
   
   	if (!fStartPositions)
  -		throw; // ThrowXML(IllegalStateException, REGEX_RESULT_NOT_SET)
  +        ThrowXML(RuntimeException, XMLExcepts::Regex_Result_Not_Set);
   
   	if (index < 0 || fNoGroups <= index)
   		ThrowXML(ArrayIndexOutOfBoundsException, XMLExcepts::Array_BadIndex);
  @@ -175,7 +176,7 @@
   inline void Match::setEndPos(const int index, const int value) {
   
   	if (!fEndPositions)
  -		throw; // ThrowXML(IllegalStateException, REGEX_RESULT_NOT_SET)
  +        ThrowXML(RuntimeException, XMLExcepts::Regex_Result_Not_Set);
   
   	if (index < 0 || fNoGroups <= index)
   		ThrowXML(ArrayIndexOutOfBoundsException, XMLExcepts::Array_BadIndex);
  
  
  
  1.2       +13 -23    xml-xerces/c/src/util/regx/Op.hpp
  
  Index: Op.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/Op.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Op.hpp	2001/03/02 19:22:47	1.1
  +++ Op.hpp	2001/05/03 18:17:28	1.2
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: Op.hpp,v 1.1 2001/03/02 19:22:47 knoaman Exp $
  + * $Id: Op.hpp,v 1.2 2001/05/03 18:17:28 knoaman Exp $
    */
   
   #if !defined(OP_HPP)
  @@ -66,6 +66,7 @@
   // ---------------------------------------------------------------------------
   #include <util/XercesDefs.hpp>
   #include <util/RefVectorOf.hpp>
  +#include <util/RuntimeException.hpp>
   
   // ---------------------------------------------------------------------------
   //  Forward Declaration
  @@ -319,68 +320,57 @@
   
   inline int Op::getSize() const {
   
  -	//REVISIT do we throw an exception
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline XMLInt32	Op::getData() const {
   
  -    //REVISIT do we throw an exception
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline XMLInt32	Op::getData2() const {
   
  -    //REVISIT do we throw an exception
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline int	Op::getRefNo() const {
   
  -    //REVISIT do we throw an exception
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline const Op* Op::elementAt(int index) const {
   
  -    //REVISIT do we throw an exception
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline const Op* Op::getChild() const {
   
  -    //REVISIT do we throw an exception
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline const Op* Op::getConditionFlow() const {
   
  -    //REVISIT do we throw an exception
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline const Op* Op::getYesFlow() const {
   
  -    //REVISIT do we throw an exception
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline const Op* Op::getNoFlow() const {
   
  -    //REVISIT do we throw an exception
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   	
   inline const XMLCh* Op::getLiteral() const {
   
  -    //REVISIT do we throw an exception
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   	
   inline const Token* Op::getToken() const {
   
  -    //REVISIT do we throw an exception
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   // ---------------------------------------------------------------------------
  
  
  
  1.2       +41 -35    xml-xerces/c/src/util/regx/ParserForXMLSchema.cpp
  
  Index: ParserForXMLSchema.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/ParserForXMLSchema.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ParserForXMLSchema.cpp	2001/03/02 19:26:43	1.1
  +++ ParserForXMLSchema.cpp	2001/05/03 18:17:30	1.2
  @@ -56,6 +56,21 @@
   
   /*
    * $Log: ParserForXMLSchema.cpp,v $
  + * Revision 1.2  2001/05/03 18:17:30  knoaman
  + * Some design changes:
  + * o Changed the TokenFactory from a single static instance, to a
  + *    normal class. Each RegularExpression object will have its own
  + *    instance of TokenFactory, and that instance will be passed to
  + *    other classes that need to use a TokenFactory to create Token
  + *    objects (with the exception of RangeTokenMap).
  + * o Added a new class RangeTokenMap to map a the different ranges
  + *    in a given category to a specific RangeFactory object. In the old
  + *    design RangeFactory had dual functionality (act as a Map, and as
  + *    a factory for creating RangeToken(s)). The RangeTokenMap will
  + *    have its own copy of the TokenFactory. There will be only one
  + *    instance of the RangeTokenMap class, and that instance will be
  + *    lazily deleted when XPlatformUtils::Terminate is called.
  + *
    * Revision 1.1  2001/03/02 19:26:43  knoaman
    * Schema: Regular expression handling part II
    *
  @@ -69,6 +84,7 @@
   #include <util/regx/RangeToken.hpp>
   #include <util/regx/TokenInc.hpp>
   #include <util/regx/RegxDefs.hpp>
  +#include <util/ParseException.hpp>
   
   // ---------------------------------------------------------------------------
   //  ParserForXMLSchema: Constructors and Destructors
  @@ -89,44 +105,46 @@
   Token* ParserForXMLSchema::processCaret() {
   
   	processNext();
  -	return TokenFactory::instance()->createChar(chCaret);
  +	return getTokenFactory()->createChar(chCaret);
   }
   
   Token* ParserForXMLSchema::processDollar() {
   
   	processNext();
  -	return TokenFactory::instance()->createChar(chDollarSign);
  +	return getTokenFactory()->createChar(chDollarSign);
   }
   
   Token* ParserForXMLSchema::processPlus(Token* const tok) {
   
   	processNext();
  -    return TokenFactory::instance()->createConcat(tok, 
  -		                       TokenFactory::instance()->createClosure(tok));
  +    return getTokenFactory()->createConcat(tok, 
  +		                       getTokenFactory()->createClosure(tok));
   }
   
   Token* ParserForXMLSchema::processStar(Token* const tok) {
   
       processNext();
  -    return TokenFactory::instance()->createClosure(tok);
  +    return getTokenFactory()->createClosure(tok);
   }
   
   Token* ParserForXMLSchema::processQuestion(Token* const tok) {
   
       processNext();
  -    Token* retTok = TokenFactory::instance()->createUnion();
  -	retTok->addChild(tok);
  -	retTok->addChild(TokenFactory::instance()->createToken(Token::EMPTY));
  +
  +    TokenFactory* tokFactory = getTokenFactory();
  +    Token* retTok = tokFactory->createUnion();
  +	retTok->addChild(tok, tokFactory);
  +	retTok->addChild(tokFactory->createToken(Token::EMPTY), tokFactory);
   	return retTok;
   }
   
   Token* ParserForXMLSchema::processParen() {
   
       processNext();
  -    Token* retTok = TokenFactory::instance()->createParenthesis(parseRegx(), 0);
  +    Token* retTok = getTokenFactory()->createParenthesis(parseRegx(), 0);
   
       if (getState() != T_RPAREN) {
  -        ThrowXML(RuntimeException, XMLExcepts::Parser_Factor1);
  +        ThrowXML(ParseException, XMLExcepts::Parser_Factor1);
       }
   
       processNext();
  @@ -146,12 +164,12 @@
   
           isNRange = true;
           processNext();
  -        base = TokenFactory::instance()->createRange();
  +        base = getTokenFactory()->createRange();
           base->addRange(0, Token::UTF16_MAX);
  -        tok = TokenFactory::instance()->createRange();
  +        tok = getTokenFactory()->createRange();
   	}
   	else {
  -        tok= TokenFactory::instance()->createRange();
  +        tok= getTokenFactory()->createRange();
   	}
   
       int type;
  @@ -205,7 +223,7 @@
                       RangeToken* tok2 = processBacksolidus_pP(ch);
   
                       if (tok2 == 0) {
  -						ThrowXML(RuntimeException,XMLExcepts::Parser_Atom5);
  +						ThrowXML(ParseException,XMLExcepts::Parser_Atom5);
                       }
   
   					tok->mergeRanges(tok2);
  @@ -228,7 +246,7 @@
   			tok->subtractRanges(rangeTok);
   
               if (getState() != T_CHAR || getCharData() != chCloseSquare) {
  -                ThrowXML(RuntimeException,XMLExcepts::Parser_CC5);
  +                ThrowXML(ParseException,XMLExcepts::Parser_CC5);
               }
               break;
           } // end if T_XMLSCHEMA...
  @@ -240,10 +258,10 @@
               if (type == T_CHAR) {
   
   				if (ch == chOpenSquare)
  -					ThrowXML(RuntimeException,XMLExcepts::Parser_CC6);
  +					ThrowXML(ParseException,XMLExcepts::Parser_CC6);
   
   				if (ch == chCloseSquare)
  -                    ThrowXML(RuntimeException,XMLExcepts::Parser_CC7);
  +                    ThrowXML(ParseException,XMLExcepts::Parser_CC7);
               }
   
   			if (getState() != T_CHAR || getCharData() != chDash) {
  @@ -253,7 +271,7 @@
   
   				processNext();
                   if ((type = getState()) == T_EOF)
  -					ThrowXML(RuntimeException,XMLExcepts::Parser_CC2);
  +					ThrowXML(ParseException,XMLExcepts::Parser_CC2);
   
   				if (type == T_CHAR && getCharData() == chCloseSquare) {
   
  @@ -271,10 +289,10 @@
   					if (type == T_CHAR) {
   
   						if (rangeEnd == chOpenSquare)
  -							ThrowXML(RuntimeException,XMLExcepts::Parser_CC6);
  +							ThrowXML(ParseException,XMLExcepts::Parser_CC6);
   
   						if (rangeEnd == chCloseSquare)
  -							ThrowXML(RuntimeException,XMLExcepts::Parser_CC7);
  +							ThrowXML(ParseException,XMLExcepts::Parser_CC7);
   					}
   
   					if (type == T_BACKSOLIDUS) {
  @@ -290,7 +308,7 @@
       }
   
   	if (getState() == T_EOF)
  -		ThrowXML(RuntimeException,XMLExcepts::Parser_CC2);
  +		ThrowXML(ParseException,XMLExcepts::Parser_CC2);
   
   	tok->sortRanges();
   	tok->compactRanges();
  @@ -314,25 +332,25 @@
   
       switch(ch) {
       case chLatin_d:
  -        return TokenFactory::instance()->getRange(fgXMLDigit);
  +        return getTokenFactory()->getRange(fgXMLDigit);
       case chLatin_D:
  -        return TokenFactory::instance()->getRange(fgXMLDigit, true);
  +        return getTokenFactory()->getRange(fgXMLDigit, true);
       case chLatin_w:
  -        return TokenFactory::instance()->getRange(fgXMLWord);
  +        return getTokenFactory()->getRange(fgXMLWord);
       case chLatin_W:
  -        return TokenFactory::instance()->getRange(fgXMLWord, true);
  +        return getTokenFactory()->getRange(fgXMLWord, true);
       case chLatin_s:
  -        return TokenFactory::instance()->getRange(fgXMLSpace);
  +        return getTokenFactory()->getRange(fgXMLSpace);
       case chLatin_S:
  -        return TokenFactory::instance()->getRange(fgXMLSpace, true);
  +        return getTokenFactory()->getRange(fgXMLSpace, true);
       case chLatin_c:
  -        return TokenFactory::instance()->getRange(fgXMLNameChar);
  +        return getTokenFactory()->getRange(fgXMLNameChar);
       case chLatin_C:
  -        return TokenFactory::instance()->getRange(fgXMLNameChar, true);
  +        return getTokenFactory()->getRange(fgXMLNameChar, true);
       case chLatin_i:
  -        return TokenFactory::instance()->getRange(fgXMLInitialNameChar);
  +        return getTokenFactory()->getRange(fgXMLInitialNameChar);
       case chLatin_I:
  -        return TokenFactory::instance()->getRange(fgXMLInitialNameChar, true);
  +        return getTokenFactory()->getRange(fgXMLInitialNameChar, true);
       }
   
       return 0;
  @@ -344,7 +362,7 @@
   XMLInt32 ParserForXMLSchema::decodeEscaped() {
   
   	if (getState() != T_BACKSOLIDUS)
  -		ThrowXML(RuntimeException,XMLExcepts::Parser_Next1);;
  +		ThrowXML(ParseException,XMLExcepts::Parser_Next1);;
   
   	XMLInt32 ch = getCharData();
   
  @@ -363,11 +381,11 @@
   	case chLatin_x:
   	case chLatin_u:
   	case chLatin_v:
  -		ThrowXML(RuntimeException,XMLExcepts::Parser_Process1);
  +		ThrowXML(ParseException,XMLExcepts::Parser_Process1);
   	case chLatin_A:
   	case chLatin_Z:
   	case chLatin_z:
  -		ThrowXML(RuntimeException,XMLExcepts::Parser_Descape5);
  +		ThrowXML(ParseException,XMLExcepts::Parser_Descape5);
   	}
   
   	return ch;
  
  
  
  1.2       +18 -34    xml-xerces/c/src/util/regx/ParserForXMLSchema.hpp
  
  Index: ParserForXMLSchema.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/ParserForXMLSchema.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ParserForXMLSchema.hpp	2001/03/02 19:26:44	1.1
  +++ ParserForXMLSchema.hpp	2001/05/03 18:17:31	1.2
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: ParserForXMLSchema.hpp,v 1.1 2001/03/02 19:26:44 knoaman Exp $
  + * $Id: ParserForXMLSchema.hpp,v 1.2 2001/05/03 18:17:31 knoaman Exp $
    */
   
   #if !defined(PARSERFORXMLSCHEMA_HPP)
  @@ -65,7 +65,7 @@
   //  Includes
   // ---------------------------------------------------------------------------
   #include <util/regx/RegxParser.hpp>
  -//#include <util/ParseException.hpp>
  +#include <util/RuntimeException.hpp>
   
   // ---------------------------------------------------------------------------
   //  Forward Declaration
  @@ -156,26 +156,22 @@
   // ---------------------------------------------------------------------------
   inline Token* ParserForXMLSchema::processLook(const unsigned short tokType) {
   
  -    // REVISIT: Do we need to throw an exception or just do nothing
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline Token* ParserForXMLSchema::processBacksolidus_A() {
   
  -    // REVISIT: Do we need to throw an exception or just do nothing
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline Token* ParserForXMLSchema::processBacksolidus_B() {
   
  -    // REVISIT: Do we need to throw an exception or just do nothing
  -    return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline Token* ParserForXMLSchema::processBacksolidus_b() {
   
  -    // REVISIT: Do we need to throw an exception or just do nothing
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline Token* ParserForXMLSchema::processBacksolidus_C() {
  @@ -192,14 +188,12 @@
   
   inline Token* ParserForXMLSchema::processBacksolidus_g() {
   
  -    // REVISIT: Do we need to throw an exception or just do nothing
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline Token* ParserForXMLSchema::processBacksolidus_gt() {
   
  -    // REVISIT: Do we need to throw an exception or just do nothing
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline Token* ParserForXMLSchema::processBacksolidus_I() {
  @@ -216,63 +210,53 @@
   
   inline Token* ParserForXMLSchema::processBacksolidus_lt() {
   
  -    // REVISIT: Do we need to throw an exception or just do nothing
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline Token* ParserForXMLSchema::processBacksolidus_X() {
   
   
  -    // REVISIT: Do we need to throw an exception or just do nothing
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline Token* ParserForXMLSchema::processBacksolidus_Z() {
   
  -    // REVISIT: Do we need to throw an exception or just do nothing
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline Token* ParserForXMLSchema::processBacksolidus_z() {
   
  -    // REVISIT: Do we need to throw an exception or just do nothing
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline Token* ParserForXMLSchema::processBackReference() {
   
  -    // REVISIT: Do we need to throw an exception or just do nothing
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline Token* ParserForXMLSchema::processCondition() {
   
  -    // REVISIT: Do we need to throw an exception or just do nothing
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline Token* ParserForXMLSchema::processIndependent() {
   
  -    // REVISIT: Do we need to throw an exception or just do nothing
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline Token* ParserForXMLSchema::processModifiers() {
   
  -    // REVISIT: Do we need to throw an exception or just do nothing
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline Token* ParserForXMLSchema::processParen2() {
   
  -    // REVISIT: Do we need to throw an exception or just do nothing
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline RangeToken* ParserForXMLSchema::parseSetOperations() {
   
  -    // REVISIT: Do we need to throw an exception or just do nothing
  -	return 0;
  +	ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   #endif
   
  
  
  
  1.3       +3 -174    xml-xerces/c/src/util/regx/RangeFactory.cpp
  
  Index: RangeFactory.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/RangeFactory.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RangeFactory.cpp	2001/03/22 13:23:32	1.2
  +++ RangeFactory.cpp	2001/05/03 18:17:33	1.3
  @@ -56,6 +56,21 @@
   
   /*
    * $Log: RangeFactory.cpp,v $
  + * Revision 1.3  2001/05/03 18:17:33  knoaman
  + * Some design changes:
  + * o Changed the TokenFactory from a single static instance, to a
  + *    normal class. Each RegularExpression object will have its own
  + *    instance of TokenFactory, and that instance will be passed to
  + *    other classes that need to use a TokenFactory to create Token
  + *    objects (with the exception of RangeTokenMap).
  + * o Added a new class RangeTokenMap to map a the different ranges
  + *    in a given category to a specific RangeFactory object. In the old
  + *    design RangeFactory had dual functionality (act as a Map, and as
  + *    a factory for creating RangeToken(s)). The RangeTokenMap will
  + *    have its own copy of the TokenFactory. There will be only one
  + *    instance of the RangeTokenMap class, and that instance will be
  + *    lazily deleted when XPlatformUtils::Terminate is called.
  + *
    * Revision 1.2  2001/03/22 13:23:32  knoaman
    * Minor modifications to eliminate compiler warnings.
    *
  @@ -68,37 +83,8 @@
   //  Includes
   // ---------------------------------------------------------------------------
   #include <util/regx/RangeFactory.hpp>
  -#include <util/regx/RangeToken.hpp>
  -#include <util/PlatformUtils.hpp>
  -#include <util/regx/RegxDefs.hpp>
  -#include <stdlib.h>
  -
  -// ---------------------------------------------------------------------------
  -//  Static member data initialization
  -// ---------------------------------------------------------------------------
  -RefHashTableOf<RangeTokenElemMap>* RangeFactory::fTokenRegistry = 0;
  -RefHashTableOf<RangeFactory>*      RangeFactory::fRangeMap = 0;
  -XMLStringPool*                     RangeFactory::fCategories = 0;
  -RangeFactory*                      RangeFactory::fInstance = 0;
  -bool                               RangeFactory::fRegistryInitialized = false;
  -
   
   // ---------------------------------------------------------------------------
  -//  RangeTokenElemMap: Constructors and Destructor
  -// ---------------------------------------------------------------------------
  -RangeTokenElemMap::RangeTokenElemMap(unsigned int categoryId) :
  -    fCategoryId(categoryId)
  -    , fRange(0)
  -    , fNRange(0)
  -{
  -
  -}
  -
  -RangeTokenElemMap::~RangeTokenElemMap()
  -{
  -}
  -
  -// ---------------------------------------------------------------------------
   //  RangeFactory: Constructors and Destructor
   // ---------------------------------------------------------------------------
   RangeFactory::RangeFactory() {
  @@ -107,151 +93,6 @@
   
   RangeFactory::~RangeFactory() {
   
  -}
  -
  -// ---------------------------------------------------------------------------
  -//  RangeFactory: Getter methods
  -// ---------------------------------------------------------------------------
  -RangeToken* RangeFactory::getRange(const XMLCh* const keyword,
  -								   const bool complement) {
  -
  -	if (fTokenRegistry == 0 || fRangeMap == 0 || fCategories == 0)
  -		return 0;
  -
  -    if (!fTokenRegistry->containsKey(keyword))
  -		return 0;
  -
  -
  -	RangeTokenElemMap* elemMap = 0;
  -
  -	// Use a faux scope to synchronize while we do this
  -    {
  -        XMLMutexLock lockInit(&fMutex);
  -
  -		elemMap = fTokenRegistry->get(keyword);
  -		RangeToken* rangeTok = 0;
  -
  -		if (elemMap->getRangeToken() == 0) {
  -		
  -			unsigned int categId = elemMap->getCategoryId();
  -			const XMLCh* categName = fCategories->getValueForId(categId);
  -			RangeFactory* rangeFactory = fRangeMap->get(categName);
  -
  -			if (rangeFactory == 0)
  -				return 0;
  -
  -			rangeFactory->buildRanges();
  -		}
  -
  -		if (complement && ((rangeTok = elemMap->getRangeToken()) != 0)) {
  -			elemMap->setRangeToken((RangeToken*)
  -									RangeToken::complementRanges(rangeTok),
  -									complement);    
  -		}        
  -    }
  -
  -	return (elemMap == 0) ? 0 : elemMap->getRangeToken(complement);
  -}
  -
  -void RangeFactory::buildRanges() {
  -
  -	return;
  -}
  -
  -
  -// ---------------------------------------------------------------------------
  -//  RangeFactory: Putter methods
  -// ---------------------------------------------------------------------------
  -void RangeFactory::addCategory(const XMLCh* const categoryName) {
  -
  -    if (fCategories)
  -	    fCategories->addOrFind(categoryName);
  -}
  -
  -void RangeFactory::addRangeMap(const XMLCh* const categoryName,
  -                               RangeFactory* const rangeFactory) {
  -
  -    if (fRangeMap)
  -	    fRangeMap->put((void*)categoryName, rangeFactory);
  -}
  -
  -void RangeFactory::addKeywordMap(const XMLCh* const keyword,
  -                                 const XMLCh* const categoryName) {
  -
  -    if (fCategories == 0 || fTokenRegistry == 0)
  -        return;
  -
  -	unsigned int categId = fCategories->getId(categoryName);
  -
  -	if (categId == 0) {
  -		throw; // ThrowXML(RuntimeException, "Invalid Category")
  -	}
  -
  -    if (fTokenRegistry->containsKey(keyword)) {
  -
  -        RangeTokenElemMap* elemMap = fTokenRegistry->get(keyword);
  -
  -		if (elemMap->getCategoryId() != categId)
  -			elemMap->setCategoryId(categId);
  -
  -		return;
  -	}
  -
  -	fTokenRegistry->put((void*) keyword, new RangeTokenElemMap(categId));
  -}
  -
  -// ---------------------------------------------------------------------------
  -//  RangeFactory: Setter methods
  -// ---------------------------------------------------------------------------
  -void RangeFactory::setRangeToken(const XMLCh* const keyword,
  -                                 RangeToken* const tok,const bool complement) {
  -
  -    if (fTokenRegistry == 0)
  -		return;
  -
  -	if (fTokenRegistry->containsKey(keyword)) {
  -        fTokenRegistry->get(keyword)->setRangeToken(tok, complement);
  -    }
  -    else {
  -		throw; //ThrowXML(RuntimeException, "Keyword {0} not found")
  -	}
  -}
  -
  -
  -// ---------------------------------------------------------------------------
  -//  RangeFactory: Initialization methods
  -// ---------------------------------------------------------------------------
  -void RangeFactory::initializeRegistry() {
  -
  -	XMLMutexLock lockInit(&fMutex);
  -
  -	if (fRegistryInitialized)
  -		return;
  -
  -    fTokenRegistry = new RefHashTableOf<RangeTokenElemMap>(109, false);
  -    fRangeMap = new RefHashTableOf<RangeFactory>(29);
  -	fCategories = new XMLStringPool();
  -	fRegistryInitialized = true;
  -}
  -
  -
  -void RangeFactory::initializeKeywordMap() {
  -	// Behavior defined at child level
  -}
  -
  -
  -// ---------------------------------------------------------------------------
  -//  RangeFactory: Instance methods
  -// ---------------------------------------------------------------------------
  -RangeFactory* RangeFactory::instance() {
  -
  -	if (!fInstance) {
  -
  -		fInstance = new RangeFactory();
  -		atexit(RangeFactory::cleanUp);
  -	}
  -	
  -    return (fInstance);
   }
   
   /**
  
  
  
  1.3       +9 -182    xml-xerces/c/src/util/regx/RangeFactory.hpp
  
  Index: RangeFactory.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/RangeFactory.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RangeFactory.hpp	2001/03/22 13:23:33	1.2
  +++ RangeFactory.hpp	2001/05/03 18:17:35	1.3
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: RangeFactory.hpp,v 1.2 2001/03/22 13:23:33 knoaman Exp $
  + * $Id: RangeFactory.hpp,v 1.3 2001/05/03 18:17:35 knoaman Exp $
    */
   
   #if !defined(RANGEFACTORY_HPP)
  @@ -64,79 +64,26 @@
   // ---------------------------------------------------------------------------
   //  Includes
   // ---------------------------------------------------------------------------
  -#include <util/StringPool.hpp>
  -#include <util/Mutexes.hpp>
  +#include <util/XercesDefs.hpp>
   
  -// ---------------------------------------------------------------------------
  -//  Forward Declaration
  -// ---------------------------------------------------------------------------
  -class RangeToken;
  -class TokenFactory;
  -
  -
  -class XMLUTIL_EXPORT RangeTokenElemMap {
  -
  -public:
  -    RangeTokenElemMap(unsigned int categoryId);
  -    ~RangeTokenElemMap();
  -
  -    // -----------------------------------------------------------------------
  -    //  Getter methods
  -    // -----------------------------------------------------------------------
  -	unsigned int getCategoryId() const;
  -	RangeToken*  getRangeToken(const bool complement = false) const;
  -
  -	// -----------------------------------------------------------------------
  -    //  Setter methods
  -    // -----------------------------------------------------------------------
  -	void setRangeToken(RangeToken* const tok, const bool complement = false);
  -	void setCategoryId(const unsigned int categId);
  -
  -private:
  -    // -----------------------------------------------------------------------
  -    //  Unimplemented constructors and operators
  -    // -----------------------------------------------------------------------
  -    RangeTokenElemMap(const RangeTokenElemMap&);
  -    void operator=(const RangeTokenElemMap&);
  -
  -    // Data members
  -    unsigned int fCategoryId;
  -    RangeToken*  fRange;
  -    RangeToken*  fNRange;
  -};
   
  -
   class XMLUTIL_EXPORT RangeFactory {
   
   public:
  -	// -----------------------------------------------------------------------
  +    // -----------------------------------------------------------------------
       //  Constructors and destructors
       // -----------------------------------------------------------------------
       virtual ~RangeFactory();
  -
  -    // -----------------------------------------------------------------------
  -    //  Putter methods
  -    // -----------------------------------------------------------------------
  -    void addCategory(const XMLCh* const categoryName);
  -	void addRangeMap(const XMLCh* const categoryName,
  -                     RangeFactory* const rangeFactory);
  -    void addKeywordMap(const XMLCh* const keyword,
  -                       const XMLCh* const categoryName);
   
  -    // -----------------------------------------------------------------------
  -    //  Instance methods
  -    // -----------------------------------------------------------------------
  -	static RangeFactory* instance();
  -
  -	//-----------------------------------------------------------------------
  +    //-----------------------------------------------------------------------
       //  Initialization methods
       // -----------------------------------------------------------------------
  -	virtual void initializeKeywordMap();
  +    virtual void initializeKeywordMap() = 0;
   
  -    // -----------------------------------------------------------------------
  -    //  CleanUp methods
  -    // -----------------------------------------------------------------------
  -    static void cleanUp();
  +    /*
  +     * Used by children to build commonly used ranges
  +     */
  +    virtual void buildRanges() = 0;
   
   protected:
       // -----------------------------------------------------------------------
  @@ -144,133 +91,13 @@
       // -----------------------------------------------------------------------
       RangeFactory();
   
  -    // -----------------------------------------------------------------------
  -    //  Setter methods
  -    // -----------------------------------------------------------------------
  -	void setRangeToken(const XMLCh* const keyword, RangeToken* const tok,
  -                       const bool complement = false);
  -
  -    // -----------------------------------------------------------------------
  -    //  Getter methods
  -    // -----------------------------------------------------------------------
  -    /*
  -     *  Gets a commonly used RangeToken from the token registry based on the
  -     *  range name - Called by TokenFactory.
  -     */
  -	 RangeToken* getRange(const XMLCh* const name,
  -                          const bool complement = false);
  -
  -     RefHashTableOf<RangeTokenElemMap>* getTokenRegistry() const;
  -     RefHashTableOf<RangeFactory>* getRangeMap() const;
  -	 XMLStringPool* getCategories() const;
  -
  -	 /*
  -	  *	Used by children to build commonly used ranges
  -	  */
  -     virtual void buildRanges();
  -
   private:
   	// -----------------------------------------------------------------------
       //  Unimplemented constructors and operators
       // -----------------------------------------------------------------------
       RangeFactory(const RangeFactory&);
       void operator=(const RangeFactory&);
  -
  -    // -----------------------------------------------------------------------
  -    //  Private Helpers methods
  -    // -----------------------------------------------------------------------
  -    /*
  -     *  Initializes the registry with a set of commonly used RangeToken
  -     *  objects.
  -     */
  -     void initializeRegistry();
  -	 friend class TokenFactory; 
  -
  -    // -----------------------------------------------------------------------
  -    //  Private data members
  -    //
  -    //  fTokenRegistry
  -    //      Contains a set of commonly used tokens
  -	//
  -    //  fRangeMap
  -    //      Contains a map between a category name and a RangeFactory object.
  -    //
  -    //  fCategories
  -    //      Contains range categories names
  -    // -----------------------------------------------------------------------
  -    static bool                               fRegistryInitialized;	
  -    static RefHashTableOf<RangeTokenElemMap>* fTokenRegistry;
  -    static RefHashTableOf<RangeFactory>*      fRangeMap;
  -	static XMLStringPool*                     fCategories;
  -	static RangeFactory*                      fInstance;
  -    XMLMutex                                  fMutex;
   };
  -
  -// ---------------------------------------------------------------------------
  -//  RangeTokenElemMap: Getter methods
  -// ---------------------------------------------------------------------------
  -inline unsigned int RangeTokenElemMap::getCategoryId() const {
  -
  -    return fCategoryId;
  -}
  -
  -inline RangeToken* RangeTokenElemMap::getRangeToken(const bool complement) const {
  -
  -	return complement ? fNRange : fRange;
  -}
  -
  -// ---------------------------------------------------------------------------
  -//  RangeTokenElemMap: Setter methods
  -// ---------------------------------------------------------------------------
  -inline void RangeTokenElemMap::setCategoryId(const unsigned int categId) {
  -
  -    fCategoryId = categId;
  -}
  -
  -inline void RangeTokenElemMap::setRangeToken(RangeToken* const tok,
  -                                      const bool complement) {
  -
  -    if (complement)
  -        fNRange = tok;
  -	else
  -        fRange = tok;
  -}
  -
  -// ---------------------------------------------------------------------------
  -//  RangeFactory: Getter methods
  -// ---------------------------------------------------------------------------
  -inline RefHashTableOf<RangeTokenElemMap>* RangeFactory::getTokenRegistry() const {
  -
  -    return fTokenRegistry;
  -}
  -
  -inline RefHashTableOf<RangeFactory>* RangeFactory::getRangeMap() const {
  -
  -    return fRangeMap;
  -}
  -
  -inline XMLStringPool* RangeFactory::getCategories() const {
  -
  -    return fCategories;
  -}
  -
  -// ---------------------------------------------------------------------------
  -//  RangeFactory: cleanUp methods
  -// ---------------------------------------------------------------------------
  -inline void RangeFactory::cleanUp() {
  -
  -    delete fTokenRegistry;
  -    fTokenRegistry = 0;
  -
  -    delete fRangeMap;
  -    fRangeMap = 0;
  -
  -    delete fCategories;
  -    fCategories = 0;
  -
  -    delete fInstance;
  -    fInstance = 0;
  -}
   
   #endif
   
  
  
  
  1.2       +16 -11    xml-xerces/c/src/util/regx/RangeToken.cpp
  
  Index: RangeToken.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/RangeToken.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RangeToken.cpp	2001/03/02 19:26:46	1.1
  +++ RangeToken.cpp	2001/05/03 18:17:37	1.2
  @@ -56,6 +56,21 @@
   
   /*
    * $Log: RangeToken.cpp,v $
  + * Revision 1.2  2001/05/03 18:17:37  knoaman
  + * Some design changes:
  + * o Changed the TokenFactory from a single static instance, to a
  + *    normal class. Each RegularExpression object will have its own
  + *    instance of TokenFactory, and that instance will be passed to
  + *    other classes that need to use a TokenFactory to create Token
  + *    objects (with the exception of RangeTokenMap).
  + * o Added a new class RangeTokenMap to map a the different ranges
  + *    in a given category to a specific RangeFactory object. In the old
  + *    design RangeFactory had dual functionality (act as a Map, and as
  + *    a factory for creating RangeToken(s)). The RangeTokenMap will
  + *    have its own copy of the TokenFactory. There will be only one
  + *    instance of the RangeTokenMap class, and that instance will be
  + *    lazily deleted when XPlatformUtils::Terminate is called.
  + *
    * Revision 1.1  2001/03/02 19:26:46  knoaman
    * Schema: Regular expression handling part II
    *
  @@ -66,6 +81,7 @@
   // ---------------------------------------------------------------------------
   #include <util/regx/RangeToken.hpp>
   #include <util/regx/TokenFactory.hpp>
  +#include <util/XMLExceptMsgs.hpp>
   
   // ---------------------------------------------------------------------------
   //  Static member data initialization
  @@ -99,15 +115,15 @@
   // ---------------------------------------------------------------------------
   //  RangeToken: Getter methods
   // ---------------------------------------------------------------------------
  -RangeToken* RangeToken::getCaseInsensitiveToken() {
  +RangeToken* RangeToken::getCaseInsensitiveToken(TokenFactory* const tokFactory) {
   
   	// REVIST
   	// We will not build a token with case insenstive ranges
   	// For now we will return a copy of ourselves.
  -	if (fCaseIToken == 0) {
  +	if (fCaseIToken == 0 && tokFactory) {
   	
   		bool isNRange = (getTokenType() == NRANGE) ? true : false;
  -		RangeToken* lwrToken = TokenFactory::instance()->createRange(isNRange);
  +		RangeToken* lwrToken = tokFactory->createRange(isNRange);
   
   		lwrToken->mergeRanges(this);
   		fCaseIToken = lwrToken;
  @@ -233,7 +249,7 @@
   				target += 2;
   			}
   			else {
  -				throw; //ThrowXML(RuntimeException, "CompactRanges - Internal Error")
  +				ThrowXML(RuntimeException, XMLExcepts::Regex_CompactRangesError);
   			}
   		} // inner while
   
  @@ -254,7 +270,7 @@
   
   
   	if (tok->getTokenType() != this->getTokenType())
  -		throw; //ThrowXML(IllegalArgumentException, "Merge Ranges - Mismatched type")
  +		ThrowXML(IllegalArgumentException, XMLExcepts::Regex_MergeRangesTypeMismatch);
   
   	RangeToken* rangeTok = (RangeToken *) tok;
   	
  @@ -382,7 +398,7 @@
   		}
   		else {
   			delete [] result;
  -			throw; //ThrowXML(RuntimeExceptions, "SubtractRanges - Internal Error")
  +			ThrowXML(RuntimeException, XMLExcepts::Regex_SubtractRangesError);
   		}
   	} //end while
   
  @@ -475,7 +491,7 @@
   		else {
   
   			delete [] result;
  -			throw; //ThrowXML(RuntimeException, "IntersectRanges - Internal Error")
  +			ThrowXML(RuntimeException, XMLExcepts::Regex_IntersectRangesError);
   		}
   	} //end while
   
  @@ -489,16 +505,17 @@
     * for RANGE: Creates complement.
     * for NRANGE: Creates the same meaning RANGE.
     */
  -Token* RangeToken::complementRanges(RangeToken* const tok) {
  +Token* RangeToken::complementRanges(RangeToken* const tok,
  +                                    TokenFactory* const tokFactory) {
   
   	if (tok->getTokenType() != RANGE && tok->getTokenType() != NRANGE)
  -		throw; //ThrowXML(IllegalArgumentException, "Must be RangeToken")
  +		ThrowXML(IllegalArgumentException, XMLExcepts::Regex_ComplementRangesInvalidArg);
   
   	tok->sortRanges();
   	tok->compactRanges();
   
   	XMLInt32 lastElem = tok->fRanges[tok->fElemCount - 1];
  -	RangeToken* rangeTok = TokenFactory::instance()->createRange();
  +	RangeToken* rangeTok = tokFactory->createRange();
   
   	if (tok->fRanges[0] > 0) {
   		rangeTok->addRange(0, tok->fRanges[0] - 1);
  
  
  
  1.2       +9 -3      xml-xerces/c/src/util/regx/RangeToken.hpp
  
  Index: RangeToken.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/RangeToken.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RangeToken.hpp	2001/03/02 19:26:47	1.1
  +++ RangeToken.hpp	2001/05/03 18:17:39	1.2
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: RangeToken.hpp,v 1.1 2001/03/02 19:26:47 knoaman Exp $
  + * $Id: RangeToken.hpp,v 1.2 2001/05/03 18:17:39 knoaman Exp $
    */
   
   #if !defined(RANGETOKEN_HPP)
  @@ -66,6 +66,11 @@
   // ---------------------------------------------------------------------------
   #include <util/regx/Token.hpp>
   
  +// ---------------------------------------------------------------------------
  +//  Forward Declaration
  +// ---------------------------------------------------------------------------
  +class TokenFactory;
  +
   
   class XMLUTIL_EXPORT RangeToken : public Token {
   public:
  @@ -84,7 +89,7 @@
   	// -----------------------------------------------------------------------
       //  Getter methods
       // -----------------------------------------------------------------------
  -	RangeToken* getCaseInsensitiveToken();
  +	RangeToken* getCaseInsensitiveToken(TokenFactory* const tokFactory);
   
   	// -----------------------------------------------------------------------
       //  Setter methods
  @@ -100,7 +105,8 @@
   	void compactRanges();
   	void subtractRanges(RangeToken* const tok);
   	void intersectRanges(RangeToken* const tok);
  -	static Token* complementRanges(RangeToken* const tok);
  +	static Token* complementRanges(RangeToken* const tok,
  +                                   TokenFactory* const tokFactory);
   
   	// -----------------------------------------------------------------------
       //  Match methods
  
  
  
  1.2       +21 -11    xml-xerces/c/src/util/regx/RegularExpression.cpp
  
  Index: RegularExpression.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/RegularExpression.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RegularExpression.cpp	2001/03/02 19:22:52	1.1
  +++ RegularExpression.cpp	2001/05/03 18:17:42	1.2
  @@ -56,6 +56,21 @@
   
   /*
    * $Log: RegularExpression.cpp,v $
  + * Revision 1.2  2001/05/03 18:17:42  knoaman
  + * Some design changes:
  + * o Changed the TokenFactory from a single static instance, to a
  + *    normal class. Each RegularExpression object will have its own
  + *    instance of TokenFactory, and that instance will be passed to
  + *    other classes that need to use a TokenFactory to create Token
  + *    objects (with the exception of RangeTokenMap).
  + * o Added a new class RangeTokenMap to map a the different ranges
  + *    in a given category to a specific RangeFactory object. In the old
  + *    design RangeFactory had dual functionality (act as a Map, and as
  + *    a factory for creating RangeToken(s)). The RangeTokenMap will
  + *    have its own copy of the TokenFactory. There will be only one
  + *    instance of the RangeTokenMap class, and that instance will be
  + *    lazily deleted when XPlatformUtils::Terminate is called.
  + *
    * Revision 1.1  2001/03/02 19:22:52  knoaman
    * Schema: Regular expression handling part I
    *
  @@ -74,6 +89,8 @@
   #include <util/regx/XMLUniCharacter.hpp>
   #include <util/regx/ParserForXMLSchema.hpp>
   #include <util/Janitor.hpp>
  +#include <util/ParseException.hpp>
  +
   
   // ---------------------------------------------------------------------------
   //  Static member data initialization
  @@ -108,7 +125,6 @@
   	, fMatch(0)
   	, fString(0)
   {
  -
   }
   
   RegularExpression::Context::~Context()
  @@ -191,7 +207,8 @@
   	 fFixedString(0),
   	 fOperations(0),
   	 fTokenTree(0),
  -	 fFirstChar(0) 
  +	 fFirstChar(0),
  +     fTokenFactory(0)
   {
   	try {
   
  @@ -302,12 +319,17 @@
   void RegularExpression::setPattern(const XMLCh* const pattern,
   								   const XMLCh* const options) {
   
  +    fTokenFactory = new TokenFactory();
   	fOptions = parseOptions(options);
   	fPattern = XMLString::replicate(pattern);
   
   	RegxParser* regxParser = isSet(fOptions, XMLSCHEMA_MODE) 
   		? new ParserForXMLSchema() : new RegxParser();
   
  +    if (regxParser) {
  +        regxParser->setTokenFactory(fTokenFactory);
  +    }
  +
   	Janitor<RegxParser> janRegxParser(regxParser);
   	fTokenTree = regxParser->parse(fPattern, fOptions);
   	fNoGroups = regxParser->getNoParen();
  @@ -516,7 +538,7 @@
   			RangeToken* range = fFirstChar;
   
   			if (ignoreCase)
  -				range = fFirstChar->getCaseInsensitiveToken();
  +				range = fFirstChar->getCaseInsensitiveToken(fTokenFactory);
   
   			for (matchStart=context->fStart; matchStart<=limit; matchStart++) {
   
  @@ -958,7 +980,7 @@
   										   const bool ignoreCase)
   {
   	if (refNo <=0 || refNo >= fNoGroups)
  -		throw; // ThrowXML(..., "Reference no must be more than zero")
  +		ThrowXML(IllegalArgumentException, XMLExcepts::Regex_BadRefNo);
   
   	if (context->fMatch->getStartPos(refNo) < 0
   		|| context->fMatch->getEndPos(refNo) < 0)
  @@ -1055,7 +1077,7 @@
   		int v = getOptionValue(options[i]);
   
   		if (v == 0)
  -			throw; // ThrowXML(ParseException, "Unknown option {0}", options);
  +			ThrowXML1(ParseException, XMLExcepts::Regex_UnknownOption, options);
   
   		opts |= v;
   	}
  @@ -1119,7 +1141,7 @@
   		ret = compileCondition(token, next, reverse);
   		break;
   	default:
  -		//ThrowXML(RuntimeException, "Unknown token type {0}", tokenTypeAsString)
  +		ThrowXML(RuntimeException, XMLExcepts::Regex_UnknownTokenType);
   		break; // this line to be deleted
   	}
   
  @@ -1150,8 +1172,8 @@
   	if (!isSet(fOptions, PROHIBIT_HEAD_CHARACTER_OPTIMIZATION) &&
   		!isSet(fOptions, XMLSCHEMA_MODE))							{
   
  -		RangeToken* rangeTok = TokenFactory::instance()->createRange();
  -		int result = fTokenTree->analyzeFirstCharacter(rangeTok, fOptions);
  +		RangeToken* rangeTok = fTokenFactory->createRange();
  +		int result = fTokenTree->analyzeFirstCharacter(rangeTok, fOptions, fTokenFactory);
   
   		if (result == Token::FC_TERMINAL) {
   
  @@ -1224,9 +1246,9 @@
   
   			if (fWordRange == 0) {
   
  -				fWordRange = TokenFactory::instance()->getRange(fgUniIsWord);
  +				fWordRange = fTokenFactory->getRange(fgUniIsWord);
   				if (fWordRange == 0)
  -					throw; //ThrowXML(RuntimeException, "Failed to get {0} RangeToken", fgUniIsWord)
  +					ThrowXML1(RuntimeException, XMLExcepts::Regex_RangeTokenGetError, fgUniIsWord);
   			}
   
   			return fWordRange->match(ch) ? WT_LETTER : WT_OTHER;
  
  
  
  1.3       +4 -1      xml-xerces/c/src/util/regx/RegularExpression.hpp
  
  Index: RegularExpression.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/RegularExpression.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RegularExpression.hpp	2001/03/22 13:23:33	1.2
  +++ RegularExpression.hpp	2001/05/03 18:17:44	1.3
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: RegularExpression.hpp,v 1.2 2001/03/22 13:23:33 knoaman Exp $
  + * $Id: RegularExpression.hpp,v 1.3 2001/05/03 18:17:44 knoaman Exp $
    */
   
   #if !defined(REGULAREXPRESSION_HPP)
  @@ -81,6 +81,7 @@
   class BMPattern;
   class RangeToken;
   class Match;
  +class TokenFactory;
   
   class XMLUTIL_EXPORT RegularExpression {
   public:
  @@ -264,6 +265,7 @@
   	static RangeToken* fWordRange;
   	OpFactory          fOpFactory;
   	XMLMutex           fMutex;  
  +    TokenFactory*      fTokenFactory;
   };
   
   
  @@ -276,6 +278,7 @@
       delete [] fFixedString;
       delete fContext;
       delete fBMPattern;
  +    delete fTokenFactory;
   }
   
   // ---------------------------------------------------------------------------
  
  
  
  1.2       +136 -125  xml-xerces/c/src/util/regx/RegxParser.cpp
  
  Index: RegxParser.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/RegxParser.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RegxParser.cpp	2001/03/02 19:22:54	1.1
  +++ RegxParser.cpp	2001/05/03 18:17:45	1.2
  @@ -56,6 +56,21 @@
   
   /*
    * $Log: RegxParser.cpp,v $
  + * Revision 1.2  2001/05/03 18:17:45  knoaman
  + * Some design changes:
  + * o Changed the TokenFactory from a single static instance, to a
  + *    normal class. Each RegularExpression object will have its own
  + *    instance of TokenFactory, and that instance will be passed to
  + *    other classes that need to use a TokenFactory to create Token
  + *    objects (with the exception of RangeTokenMap).
  + * o Added a new class RangeTokenMap to map a the different ranges
  + *    in a given category to a specific RangeFactory object. In the old
  + *    design RangeFactory had dual functionality (act as a Map, and as
  + *    a factory for creating RangeToken(s)). The RangeTokenMap will
  + *    have its own copy of the TokenFactory. There will be only one
  + *    instance of the RangeTokenMap class, and that instance will be
  + *    lazily deleted when XPlatformUtils::Terminate is called.
  + *
    * Revision 1.1  2001/03/02 19:22:54  knoaman
    * Schema: Regular expression handling part I
    *
  @@ -69,9 +84,10 @@
   #include <util/XMLString.hpp>
   #include <util/regx/RegularExpression.hpp>
   #include <util/regx/RegxUtil.hpp>
  -#include <framework/XMLErrorCodes.hpp>
   #include <util/regx/RegxDefs.hpp>
   #include <util/regx/TokenInc.hpp>
  +#include <framework/XMLErrorCodes.hpp>
  +#include <util/ParseException.hpp>
   
   // ---------------------------------------------------------------------------
   //  Static member data initialization
  @@ -104,7 +120,8 @@
        fState(0),
   	 fCharData(0),
   	 fString(0),
  -	 fReferences(0) 
  +	 fReferences(0),
  +     fTokenFactory()
   {
   
   }
  @@ -120,6 +137,12 @@
   // ---------------------------------------------------------------------------
   Token* RegxParser::parse(const XMLCh* const regxStr, const int options) {
   
  +    // if TokenFactory is not set do nothing.
  +    // REVISIT - should we throw an exception
  +    if (fTokenFactory == 0) {
  +        return 0;
  +    }
  +
   	XMLMutexLock lockInit(&fMutex);
   
   	fOptions = options;
  @@ -142,7 +165,7 @@
       Token* retTok = parseRegx();
   
   	if (fOffset != fStringLen) {
  -        ThrowXML(RuntimeException,XMLExcepts::Parser_Parse1);
  +        ThrowXML(ParseException,XMLExcepts::Parser_Parse1);
       }
   
       if (fReferences != 0) {
  @@ -151,7 +174,7 @@
           for (unsigned int i = 0; i < refSize; i++) {
   
   			if (fNoGroups <= fReferences->elementAt(i)->fReferenceNo) {
  -                ThrowXML(RuntimeException,XMLExcepts::Parser_Parse2);
  +                ThrowXML(ParseException,XMLExcepts::Parser_Parse2);
               }
           }
   
  @@ -182,7 +205,7 @@
               nextState = T_BACKSOLIDUS;
   
   			if (fOffset >= fStringLen) {
  -				ThrowXML(RuntimeException,XMLExcepts::Parser_Next1);
  +				ThrowXML(ParseException,XMLExcepts::Parser_Next1);
   			}
   
   			fCharData = fString[fOffset++];
  @@ -265,7 +288,7 @@
                   break;
   
               if (++fOffset >= fStringLen)
  -                ThrowXML(RuntimeException,XMLExcepts::Parser_Next2);
  +                ThrowXML(ParseException,XMLExcepts::Parser_Next2);
   
               ch = fString[fOffset++];
   
  @@ -287,7 +310,7 @@
   				break;
               case chOpenAngle:
   				if (fOffset >= fStringLen)
  -					ThrowXML(RuntimeException,XMLExcepts::Parser_Next2);
  +					ThrowXML(ParseException,XMLExcepts::Parser_Next2);
   
   				ch = fString[fOffset++];
   
  @@ -298,7 +321,7 @@
   					nextState = T_NEGATIVELOOKBEHIND;
   				}
   				else {
  -					ThrowXML(RuntimeException,XMLExcepts::Parser_Next3);
  +					ThrowXML(ParseException,XMLExcepts::Parser_Next3);
   				}
   				break;
               case chPound:
  @@ -310,7 +333,7 @@
   				}
   
   				if (ch != chCloseParen)
  -					ThrowXML(RuntimeException,XMLExcepts::Parser_Next4);
  +					ThrowXML(ParseException,XMLExcepts::Parser_Next4);
   
   				nextState = T_COMMENT;
   				break;
  @@ -326,14 +349,14 @@
                       nextState = T_CONDITION;
                       break;
                   }
  -                ThrowXML(RuntimeException,XMLExcepts::Parser_Next2);
  +                ThrowXML(ParseException,XMLExcepts::Parser_Next2);
               }
           }
   		break;
   	case chBackSlash:
           nextState = T_BACKSOLIDUS;
           if (fOffset >= fStringLen) {
  -			ThrowXML(RuntimeException,XMLExcepts::Parser_Next1);
  +			ThrowXML(ParseException,XMLExcepts::Parser_Next1);
           }
   
           fCharData = fString[fOffset++];
  @@ -367,12 +390,12 @@
           processNext();
           if (parentTok == 0) {
   
  -            parentTok = TokenFactory::instance()->createUnion();
  -		    parentTok->addChild(tok);
  +            parentTok = fTokenFactory->createUnion();
  +		    parentTok->addChild(tok, fTokenFactory);
               tok = parentTok;
           }
   
  -        tok->addChild(parseTerm());
  +        tok->addChild(parseTerm(), fTokenFactory);
       }
   
       return tok;
  @@ -384,7 +407,7 @@
       unsigned short state = fState;
   
       if (state == T_OR || state == T_RPAREN || state == T_EOF) {
  -        return TokenFactory::instance()->createToken(Token::EMPTY);
  +        return fTokenFactory->createToken(Token::EMPTY);
       }
       else {
   
  @@ -395,11 +418,11 @@
           {
               if (concatTok == 0) {
   
  -                concatTok = TokenFactory::instance()->createUnion(true);
  -                concatTok->addChild(tok);
  +                concatTok = fTokenFactory->createUnion(true);
  +                concatTok->addChild(tok, fTokenFactory);
                   tok = concatTok;
               }
  -            concatTok->addChild(parseFactor());
  +            concatTok->addChild(parseFactor(), fTokenFactory);
           }
   
           return tok;
  @@ -410,14 +433,14 @@
   Token* RegxParser::processCaret() {
   
       processNext();
  -	return TokenFactory::instance()->getLineBegin();
  +	return fTokenFactory->getLineBegin();
   }
   
   
   Token* RegxParser::processDollar() {
   
       processNext();
  -    return TokenFactory::instance()->getLineEnd();
  +    return fTokenFactory->getLineEnd();
   }
   
   
  @@ -425,10 +448,10 @@
   
       processNext();
   
  -	Token* tok = TokenFactory::instance()->createLook(tokType, parseRegx());
  +	Token* tok = fTokenFactory->createLook(tokType, parseRegx());
   
       if (fState != T_RPAREN) {
  -        ThrowXML(RuntimeException,XMLExcepts::Parser_Factor1);
  +        ThrowXML(ParseException,XMLExcepts::Parser_Factor1);
       }
   
       processNext();
  @@ -440,49 +463,49 @@
   Token* RegxParser::processBacksolidus_A() {
   
       processNext();
  -	return TokenFactory::instance()->getStringBegin();
  +	return fTokenFactory->getStringBegin();
   }
   
   
   Token* RegxParser::processBacksolidus_Z() {
   
       processNext();
  -    return TokenFactory::instance()->getStringEnd2();
  +    return fTokenFactory->getStringEnd2();
   }
   
   
   Token* RegxParser::processBacksolidus_z() {
   
       processNext();
  -    return TokenFactory::instance()->getStringEnd();
  +    return fTokenFactory->getStringEnd();
   }
   
   
   Token* RegxParser::processBacksolidus_b() {
   
       processNext();
  -    return TokenFactory::instance()->getWordEdge();
  +    return fTokenFactory->getWordEdge();
   }
   
   
   Token* RegxParser::processBacksolidus_B() {
   
       processNext();
  -    return TokenFactory::instance()->getNotWordEdge();
  +    return fTokenFactory->getNotWordEdge();
   }
   
   
   Token* RegxParser::processBacksolidus_lt() {
   
       processNext();
  -    return TokenFactory::instance()->getWordBegin();
  +    return fTokenFactory->getWordBegin();
   }
   
   
   Token* RegxParser::processBacksolidus_gt() {
   
       processNext();
  -    return TokenFactory::instance()->getWordEnd();
  +    return fTokenFactory->getWordEnd();
   }
   
   
  @@ -493,10 +516,10 @@
       if (fState == T_QUESTION) {
   
           processNext();
  -        return TokenFactory::instance()->createClosure(tok, true);
  +        return fTokenFactory->createClosure(tok, true);
       }
   
  -    return TokenFactory::instance()->createClosure(tok);
  +    return fTokenFactory->createClosure(tok);
   }
   
   
  @@ -507,12 +530,12 @@
       if (fState == T_QUESTION) {
   
   		processNext();
  -		return TokenFactory::instance()->createConcat(tok,
  -			               TokenFactory::instance()->createClosure(tok,true));
  +		return fTokenFactory->createConcat(tok,
  +			               fTokenFactory->createClosure(tok,true));
       }
   
  -    return TokenFactory::instance()->createConcat(tok, 
  -		                        TokenFactory::instance()->createClosure(tok));
  +    return fTokenFactory->createConcat(tok, 
  +		                        fTokenFactory->createClosure(tok));
   }
   
   
  @@ -520,18 +543,18 @@
   
       processNext();
   
  -    Token* parentTok = TokenFactory::instance()->createUnion();
  +    Token* parentTok = fTokenFactory->createUnion();
   
       if (fState == T_QUESTION) {
   
           processNext();
  -        parentTok->addChild(TokenFactory::instance()->createToken(Token::EMPTY));
  -        parentTok->addChild(tok);
  +        parentTok->addChild(fTokenFactory->createToken(Token::EMPTY), fTokenFactory);
  +        parentTok->addChild(tok, fTokenFactory);
       }
       else {
   
  -        parentTok->addChild(tok);
  -        parentTok->addChild(TokenFactory::instance()->createToken(Token::EMPTY));
  +        parentTok->addChild(tok, fTokenFactory);
  +        parentTok->addChild(fTokenFactory->createToken(Token::EMPTY), fTokenFactory);
       }
   
       return parentTok;
  @@ -542,10 +565,10 @@
   
       processNext();
       int num = fNoGroups++;
  -    Token* tok = TokenFactory::instance()->createParenthesis(parseRegx(),num);
  +    Token* tok = fTokenFactory->createParenthesis(parseRegx(),num);
   
       if (fState != T_RPAREN)
  -        ThrowXML(RuntimeException,XMLExcepts::Parser_Factor1);
  +        ThrowXML(ParseException,XMLExcepts::Parser_Factor1);
   
       processNext();
       return tok;
  @@ -555,10 +578,10 @@
   Token* RegxParser::processParen2() {
   
       processNext();
  -    Token* tok = TokenFactory::instance()->createParenthesis(parseRegx(), 0);
  +    Token* tok = fTokenFactory->createParenthesis(parseRegx(), 0);
   
       if (fState != T_RPAREN)
  -        ThrowXML(RuntimeException,XMLExcepts::Parser_Factor1);
  +        ThrowXML(ParseException,XMLExcepts::Parser_Factor1);
   
       processNext();
       return tok;
  @@ -568,7 +591,7 @@
   Token* RegxParser::processCondition() {
   
       if (fOffset + 1 >= fStringLen)
  -		ThrowXML(RuntimeException,XMLExcepts::Parser_Factor4);
  +		ThrowXML(ParseException,XMLExcepts::Parser_Factor4);
   
       int refNo = -1;
   	Token* conditionTok = 0;
  @@ -587,7 +610,7 @@
           fOffset++;
   
           if (fString[fOffset] != chCloseParen)
  -            ThrowXML(RuntimeException,XMLExcepts::Parser_Factor1);
  +            ThrowXML(ParseException,XMLExcepts::Parser_Factor1);
   
           fOffset++;
       }
  @@ -607,10 +630,10 @@
               break;
           case Token::ANCHOR:
               if (fState != T_RPAREN)
  -				ThrowXML(RuntimeException,XMLExcepts::Parser_Factor1);
  +				ThrowXML(ParseException,XMLExcepts::Parser_Factor1);
   			break;
           default:
  -			ThrowXML(RuntimeException,XMLExcepts::Parser_Factor5);
  +			ThrowXML(ParseException,XMLExcepts::Parser_Factor5);
           }
       }
   
  @@ -621,17 +644,17 @@
       if (yesPattern->getTokenType() == Token::UNION) {
   
           if (yesPattern->size() != 2)
  -            ThrowXML(RuntimeException,XMLExcepts::Parser_Factor6);
  +            ThrowXML(ParseException,XMLExcepts::Parser_Factor6);
   
           noPattern = yesPattern->getChild(1);
           yesPattern = yesPattern->getChild(0);
       }
   
       if (fState != T_RPAREN)
  -        ThrowXML(RuntimeException,XMLExcepts::Parser_Factor1);
  +        ThrowXML(ParseException,XMLExcepts::Parser_Factor1);
   
   	processNext();
  -	return TokenFactory::instance()->createCondition(refNo,conditionTok,
  +	return fTokenFactory->createCondition(refNo,conditionTok,
   		                                             yesPattern,noPattern);
   }
   
  @@ -657,7 +680,7 @@
       } // end while
   
       if (fOffset >= fStringLen)
  -        ThrowXML(RuntimeException,XMLExcepts::Parser_Factor2);
  +        ThrowXML(ParseException,XMLExcepts::Parser_Factor2);
   
       if (ch == chDash) {
   
  @@ -674,7 +697,7 @@
           }
   
           if (fOffset >= fStringLen)
  -            ThrowXML(RuntimeException,XMLExcepts::Parser_Factor2);
  +            ThrowXML(ParseException,XMLExcepts::Parser_Factor2);
       }
   
       Token* tok = 0;
  @@ -683,10 +706,10 @@
   
           fOffset++;
   		processNext();
  -        tok = TokenFactory::instance()->createModifierGroup(parseRegx(),add,mask);
  +        tok = fTokenFactory->createModifierGroup(parseRegx(),add,mask);
   
           if (fState != T_RPAREN)
  -            ThrowXML(RuntimeException,XMLExcepts::Parser_Factor1);
  +            ThrowXML(ParseException,XMLExcepts::Parser_Factor1);
   
           processNext();
       }
  @@ -694,10 +717,10 @@
   
           fOffset++;
           processNext();
  -        tok = TokenFactory::instance()->createModifierGroup(parseRegx(),add,mask);
  +        tok = fTokenFactory->createModifierGroup(parseRegx(),add,mask);
       }
       else {
  -        ThrowXML(RuntimeException,XMLExcepts::Parser_Factor3);
  +        ThrowXML(ParseException,XMLExcepts::Parser_Factor3);
   	}
   
   	return tok;
  @@ -708,11 +731,11 @@
   
       processNext();
   
  -	Token* tok = TokenFactory::instance()->createLook(Token::INDEPENDENT,
  +	Token* tok = fTokenFactory->createLook(Token::INDEPENDENT,
   		                                              parseRegx());
   
   	if (fState != T_RPAREN)
  -		ThrowXML(RuntimeException,XMLExcepts::Parser_Factor1);
  +		ThrowXML(ParseException,XMLExcepts::Parser_Factor1);
   
       processNext();
       return tok;
  @@ -725,10 +748,10 @@
   
       if (fOffset >= fStringLen 
           || ((ch = fString[fOffset++]) & 0xFFE0) != 0x0040)
  -        ThrowXML(RuntimeException,XMLExcepts::Parser_Atom1);
  +        ThrowXML(ParseException,XMLExcepts::Parser_Atom1);
   
       processNext();
  -	return TokenFactory::instance()->createChar(ch - 0x40);
  +	return fTokenFactory->createChar(ch - 0x40);
   }
   
   
  @@ -742,7 +765,7 @@
   Token* RegxParser::processBacksolidus_i() {
   
       processNext();
  -	return TokenFactory::instance()->createChar(chLatin_i);
  +	return fTokenFactory->createChar(chLatin_i);
   }
   
   
  @@ -756,20 +779,20 @@
   Token* RegxParser::processBacksolidus_g() {
   
       processNext();
  -    return TokenFactory::instance()->getGraphemePattern();
  +    return fTokenFactory->getGraphemePattern();
   }
   
   
   Token* RegxParser::processBacksolidus_X() {
   
       processNext();
  -    return TokenFactory::instance()->getCombiningCharacterSequence();
  +    return fTokenFactory->getCombiningCharacterSequence();
   }
   
   Token* RegxParser::processBackReference() {
   
       int refNo = fCharData - chDigit_0;
  -    Token* tok = TokenFactory::instance()->createBackReference(refNo);
  +    Token* tok = fTokenFactory->createBackReference(refNo);
   
       fHasBackReferences = true;
       if (fReferences == 0) {
  @@ -800,7 +823,7 @@
           return processLook(Token::NEGATIVELOOKBEHIND);
       case T_COMMENT:
           processNext();
  -        return TokenFactory::instance()->createToken(Token::EMPTY);
  +        return fTokenFactory->createToken(Token::EMPTY);
       case T_BACKSOLIDUS:
           switch(fCharData) {
           case chLatin_A:
  @@ -892,12 +915,12 @@
   
               if (checkQuestion(offset)) {
   
  -                tok = TokenFactory::instance()->createClosure(tok, true);
  +                tok = fTokenFactory->createClosure(tok, true);
                   fOffset = offset + 1;
               }
               else {
   
  -                tok = TokenFactory::instance()->createClosure(tok);
  +                tok = fTokenFactory->createClosure(tok);
                   fOffset = offset;
               }
   
  @@ -929,7 +952,7 @@
           return processIndependent();
       case T_DOT:
           processNext();
  -        tok = TokenFactory::instance()->getDot();
  +        tok = fTokenFactory->getDot();
           break;
       case T_LBRACKET:
           return parseCharacterClass(true);
  @@ -958,13 +981,13 @@
   			{
                   XMLInt32 ch = decodeEscaped();
                   if (ch < 0x10000) {
  -                    tok = TokenFactory::instance()->createChar(ch);
  +                    tok = fTokenFactory->createChar(ch);
                   }
                   else {
   
                       XMLCh* surrogateStr = RegxUtil::decomposeToSurrogates(ch);
   				    ArrayJanitor<XMLCh> janSurrogate(surrogateStr);
  -				    tok = TokenFactory::instance()->createString(surrogateStr);
  +				    tok = fTokenFactory->createString(surrogateStr);
                   }
               }
   			break;
  @@ -997,22 +1020,22 @@
   				int start = fOffset;
   				tok = processBacksolidus_pP(fCharData);
   				if (tok = 0) {
  -					ThrowXML(RuntimeException,XMLExcepts::Parser_Atom5);
  +					ThrowXML(ParseException,XMLExcepts::Parser_Atom5);
   				}
   			}
               break;
           default:
  -            tok = TokenFactory::instance()->createChar(fCharData);
  +            tok = fTokenFactory->createChar(fCharData);
   		} // end switch
   
           processNext();
           break;
       case T_CHAR:
  -        tok = TokenFactory::instance()->createChar(fCharData);
  +        tok = fTokenFactory->createChar(fCharData);
           processNext();
           break;
       default:
  -        ThrowXML(RuntimeException,XMLExcepts::Parser_Atom4);
  +        ThrowXML(ParseException,XMLExcepts::Parser_Atom4);
       } //end switch
   
       return tok;
  @@ -1025,32 +1048,32 @@
   
       processNext();
   	if (fState != T_CHAR)
  -		ThrowXML(RuntimeException,XMLExcepts::Parser_Atom2);
  +		ThrowXML(ParseException,XMLExcepts::Parser_Atom2);
   
       RangeToken* tok = 0;
   
   	switch(fCharData) {
   
       case chLatin_L:
  -		tok = TokenFactory::instance()->getRange(fgUniLetter, !positive);
  +		tok = fTokenFactory->getRange(fgUniLetter, !positive);
   		break;
       case chLatin_M:
  -		tok = TokenFactory::instance()->getRange(fgUniMark, !positive);
  +		tok = fTokenFactory->getRange(fgUniMark, !positive);
   		break;
       case chLatin_N:
  -		tok = TokenFactory::instance()->getRange(fgUniNumber, !positive);
  +		tok = fTokenFactory->getRange(fgUniNumber, !positive);
   		break;
       case chLatin_Z:
  -		tok = TokenFactory::instance()->getRange(fgUniSeparator, !positive);
  +		tok = fTokenFactory->getRange(fgUniSeparator, !positive);
   		break;
       case chLatin_C:
  -		tok = TokenFactory::instance()->getRange(fgUniControl, !positive);
  +		tok = fTokenFactory->getRange(fgUniControl, !positive);
   		break;
       case chLatin_P:
  -		tok = TokenFactory::instance()->getRange(fgUniPunctuation, !positive);
  +		tok = fTokenFactory->getRange(fgUniPunctuation, !positive);
   		break;
       case chLatin_S:
  -		tok = TokenFactory::instance()->getRange(fgUniSymbol, !positive);
  +		tok = fTokenFactory->getRange(fgUniSymbol, !positive);
   		break;
       case chOpenCurly:
   		{
  @@ -1058,17 +1081,17 @@
   			int nameEnd = XMLString::indexOf(fString,chCloseCurly,nameStart);
   
   			if (nameEnd < 0)
  -				ThrowXML(RuntimeException,XMLExcepts::Parser_Atom3);
  +				ThrowXML(ParseException,XMLExcepts::Parser_Atom3);
   
   			fOffset = nameEnd + 1;
   			XMLCh* rangeName = new XMLCh[(nameEnd - nameStart) + 1];
   			ArrayJanitor<XMLCh> janRangeName(rangeName);
   			XMLString::subString(rangeName, fString, nameStart, nameEnd);
  -			tok = TokenFactory::instance()->getRange(rangeName, !positive);
  +			tok = fTokenFactory->getRange(rangeName, !positive);
   		}
   		break;
   	default:
  -		ThrowXML(RuntimeException,XMLExcepts::Parser_Atom2);
  +		ThrowXML(ParseException,XMLExcepts::Parser_Atom2);
   	}
   
       return tok;
  @@ -1097,17 +1120,17 @@
           processNext();
   
   		if (useNRange) {
  -            tok = TokenFactory::instance()->createRange(true);
  +            tok = fTokenFactory->createRange(true);
           }
           else {
   
  -			base = TokenFactory::instance()->createRange();
  +			base = fTokenFactory->createRange();
               base->addRange(0, Token::UTF16_MAX);
  -            tok = TokenFactory::instance()->createRange();
  +            tok = fTokenFactory->createRange();
           }
       }
       else {
  -        tok = TokenFactory::instance()->createRange();
  +        tok = fTokenFactory->createRange();
       }
   
       bool firstLoop = true;
  @@ -1149,7 +1172,7 @@
   					RangeToken* tok2 = processBacksolidus_pP(ch);
   
   					if (tok2 == 0) {
  -						ThrowXML(RuntimeException,XMLExcepts::Parser_Atom5);
  +						ThrowXML(ParseException,XMLExcepts::Parser_Atom5);
   					}
   
   					tok->mergeRanges(tok2);
  @@ -1165,7 +1188,7 @@
               int nameEnd = XMLString::indexOf(fString, chColon, fOffset);
   
               if (nameEnd < 0) {
  -				ThrowXML(RuntimeException,XMLExcepts::Parser_CC1);
  +				ThrowXML(ParseException,XMLExcepts::Parser_CC1);
   			}
   
               bool positive = true;
  @@ -1180,17 +1203,17 @@
   			ArrayJanitor<XMLCh> janName(name);
   
   			XMLString::subString(name, fString, fOffset, nameEnd);
  -            RangeToken* rangeTok = TokenFactory::instance()->getRange(name, !positive);
  +            RangeToken* rangeTok = fTokenFactory->getRange(name, !positive);
   
               if (rangeTok = 0) {
  -				ThrowXML(RuntimeException,XMLExcepts::Parser_CC3);
  +				ThrowXML(ParseException,XMLExcepts::Parser_CC3);
               }
   
   			tok->mergeRanges(rangeTok);
   			end = true;
   
   			if (nameEnd+1 >= fStringLen || fString[nameEnd+1] != chCloseSquare) {
  -				ThrowXML(RuntimeException,XMLExcepts::Parser_CC1);
  +				ThrowXML(ParseException,XMLExcepts::Parser_CC1);
   			}
   
   			fOffset = nameEnd + 2;
  @@ -1207,7 +1230,7 @@
                   processNext();
   
                   if (fState == T_EOF)
  -                    ThrowXML(RuntimeException,XMLExcepts::Parser_CC2);
  +                    ThrowXML(ParseException,XMLExcepts::Parser_CC2);
   
                   if (fState == T_CHAR && fCharData == chCloseSquare) {
   
  @@ -1235,7 +1258,7 @@
       } // end while fState
   
   	if (fState == T_EOF) {
  -        ThrowXML(RuntimeException,XMLExcepts::Parser_CC2);
  +        ThrowXML(ParseException,XMLExcepts::Parser_CC2);
   	}
   
       if (!useNRange && nRange) {
  @@ -1265,7 +1288,7 @@
   
               processNext();
               if (fState != T_LBRACKET)
  -                ThrowXML(RuntimeException,XMLExcepts::Parser_Ope1);
  +                ThrowXML(ParseException,XMLExcepts::Parser_Ope1);
   
               RangeToken* tok2 = parseCharacterClass(false);
   
  @@ -1283,7 +1306,7 @@
               }
           }
           else {
  -			ThrowXML(RuntimeException,XMLExcepts::Parser_Ope2);
  +			ThrowXML(ParseException,XMLExcepts::Parser_Ope2);
   		}
       }
   
  @@ -1298,30 +1321,30 @@
   
   	switch (ch) {
   	case chLatin_d:
  -		tok = useUnicode ? TokenFactory::instance()->getRange(fgUniDecimalDigit)
  -						 : TokenFactory::instance()->getRange(fgASCIIDigit);
  +		tok = useUnicode ? fTokenFactory->getRange(fgUniDecimalDigit)
  +						 : fTokenFactory->getRange(fgASCIIDigit);
   		break;
   	case chLatin_D:
  -		tok = useUnicode ? TokenFactory::instance()->getRange(fgUniDecimalDigit, true)
  -						 : TokenFactory::instance()->getRange(fgASCIIDigit, true);
  +		tok = useUnicode ? fTokenFactory->getRange(fgUniDecimalDigit, true)
  +						 : fTokenFactory->getRange(fgASCIIDigit, true);
   		break;
   	case chLatin_w:
  -		tok = useUnicode ? TokenFactory::instance()->getRange(fgUniIsWord)
  -						 : TokenFactory::instance()->getRange(fgASCIIWord);
  +		tok = useUnicode ? fTokenFactory->getRange(fgUniIsWord)
  +						 : fTokenFactory->getRange(fgASCIIWord);
   		break;
   	case chLatin_W:
  -		tok = useUnicode ? TokenFactory::instance()->getRange(fgUniIsWord, true)
  -						 : TokenFactory::instance()->getRange(fgASCIIWord, true);
  +		tok = useUnicode ? fTokenFactory->getRange(fgUniIsWord, true)
  +						 : fTokenFactory->getRange(fgASCIIWord, true);
   		break;
   	case chLatin_s:
  -		tok = useUnicode ? TokenFactory::instance()->getRange(fgUniIsSpace)
  -						 : TokenFactory::instance()->getRange(fgASCIISpace);
  +		tok = useUnicode ? fTokenFactory->getRange(fgUniIsSpace)
  +						 : fTokenFactory->getRange(fgASCIISpace);
   		break;
   	case chLatin_S:
  -		tok = useUnicode ? TokenFactory::instance()->getRange(fgUniIsSpace, true)
  -						 : TokenFactory::instance()->getRange(fgASCIISpace, true);
  -	default:
  -		throw; //ThrowXML(RuntimeException, "Invalid shorthand {0}", chAsString)
  +		tok = useUnicode ? fTokenFactory->getRange(fgUniIsSpace, true)
  +						 : fTokenFactory->getRange(fgASCIISpace, true);
  +//	default:
  +//		ThrowXML(RuntimeException, "Invalid shorthand {0}", chAsString)
   	}
   
       return tok;
  @@ -1331,7 +1354,7 @@
   XMLInt32 RegxParser::decodeEscaped() {
   
       if (fState != T_BACKSOLIDUS)
  -		ThrowXML(RuntimeException,XMLExcepts::Parser_Next1);
  +		ThrowXML(ParseException,XMLExcepts::Parser_Next1);
   
       XMLInt32 ch = fCharData;
   
  @@ -1355,7 +1378,7 @@
   		{
   			processNext();
   			if (fState != T_CHAR) {
  -				ThrowXML(RuntimeException,XMLExcepts::Parser_Descape1);
  +				ThrowXML(ParseException,XMLExcepts::Parser_Descape1);
   			}
   			if (fCharData == chOpenCurly) {
   
  @@ -1365,7 +1388,7 @@
   				do {
   					processNext();
   					if (fState != T_CHAR)
  -						ThrowXML(RuntimeException,XMLExcepts::Parser_Descape1);
  +						ThrowXML(ParseException,XMLExcepts::Parser_Descape1);
   
   					if ((v1 = hexChar(fCharData)) < 0)
   						break;
  @@ -1374,23 +1397,23 @@
   				} while (true);
   
   				if (fCharData != chCloseCurly)
  -					ThrowXML(RuntimeException,XMLExcepts::Parser_Descape3);
  +					ThrowXML(ParseException,XMLExcepts::Parser_Descape3);
   
   				if (uv > Token::UTF16_MAX)
  -					ThrowXML(RuntimeException,XMLExcepts::Parser_Descape4);
  +					ThrowXML(ParseException,XMLExcepts::Parser_Descape4);
   
   				ch = uv;
   			}
   			else {
   				int v1 = 0;
   				if (fState != T_CHAR || (v1 = hexChar(fCharData)) < 0)
  -					ThrowXML(RuntimeException,XMLExcepts::Parser_Descape1);
  +					ThrowXML(ParseException,XMLExcepts::Parser_Descape1);
   
   				int uv = v1;
   
   				processNext();
   				if (fState != T_CHAR || (v1 = hexChar(fCharData)) < 0)
  -					ThrowXML(RuntimeException,XMLExcepts::Parser_Descape1);
  +					ThrowXML(ParseException,XMLExcepts::Parser_Descape1);
   
   				ch = uv*16 + v1;
   			}
  @@ -1405,7 +1428,7 @@
   
   				processNext();
   				if (fState != T_CHAR || (v1 = hexChar(fCharData)) < 0)
  -					ThrowXML(RuntimeException,XMLExcepts::Parser_Descape1);
  +					ThrowXML(ParseException,XMLExcepts::Parser_Descape1);
   
   				uv = (i == 0) ? v1 : uv*16 + v1;
   			}
  @@ -1422,13 +1445,13 @@
   
   				processNext();
   				if (fState != T_CHAR || (v1 = hexChar(fCharData)) < 0)
  -					ThrowXML(RuntimeException,XMLExcepts::Parser_Descape1);
  +					ThrowXML(ParseException,XMLExcepts::Parser_Descape1);
   
   				uv = (i == 0) ? v1 : uv*16 + v1;
   			}
   
   			if (uv > Token::UTF16_MAX)
  -				ThrowXML(RuntimeException,XMLExcepts::Parser_Descape1);
  +				ThrowXML(ParseException,XMLExcepts::Parser_Descape1);
   
   			ch = uv;
   		}
  @@ -1436,7 +1459,7 @@
   	case chLatin_A:
   	case chLatin_Z:
   	case chLatin_z:
  -		ThrowXML(RuntimeException,XMLExcepts::Parser_Descape5);
  +		ThrowXML(ParseException,XMLExcepts::Parser_Descape5);
   	} // end switch
   
       return ch;
  
  
  
  1.3       +15 -1     xml-xerces/c/src/util/regx/RegxParser.hpp
  
  Index: RegxParser.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/RegxParser.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RegxParser.hpp	2001/03/22 13:23:33	1.2
  +++ RegxParser.hpp	2001/05/03 18:17:46	1.3
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: RegxParser.hpp,v 1.2 2001/03/22 13:23:33 knoaman Exp $
  + * $Id: RegxParser.hpp,v 1.3 2001/05/03 18:17:46 knoaman Exp $
    */
   
   /*
  @@ -76,6 +76,7 @@
   // ---------------------------------------------------------------------------
   class Token;
   class RangeToken;
  +class TokenFactory;
   
   class XMLUTIL_EXPORT RegxParser {
   public:
  @@ -130,11 +131,13 @@
       int            getNoParen() const;
   	int            getOffset() const;
   	bool           hasBackReferences() const;
  +    TokenFactory*  getTokenFactory() const;
   
   	// -----------------------------------------------------------------------
       //  Setter methods
       // -----------------------------------------------------------------------
   	void setParseContext(const unsigned short value);
  +    void setTokenFactory(TokenFactory* const tokFactory);
   
   	// -----------------------------------------------------------------------
       //  Public Parsing methods
  @@ -228,6 +231,7 @@
   	XMLInt32                        fCharData;
   	XMLCh*                          fString;
   	RefVectorOf<ReferencePosition>* fReferences;
  +    TokenFactory*                   fTokenFactory;
   	XMLMutex						fMutex;
   };
   
  @@ -265,12 +269,22 @@
   	return fHasBackReferences;
   }
   
  +inline TokenFactory* RegxParser::getTokenFactory() const {
  +
  +    return fTokenFactory;
  +}
  +
   // ---------------------------------------------------------------------------
   //  RegxParser: Setter Methods
   // ---------------------------------------------------------------------------
   inline void RegxParser::setParseContext(const unsigned short value) {
   
   	fParseContext = value;
  +}
  +
  +inline void RegxParser::setTokenFactory(TokenFactory* const tokFactory) {
  +
  +    fTokenFactory = tokFactory;
   }
   
   // ---------------------------------------------------------------------------
  
  
  
  1.2       +22 -20    xml-xerces/c/src/util/regx/Token.cpp
  
  Index: Token.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/Token.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Token.cpp	2001/03/02 19:22:58	1.1
  +++ Token.cpp	2001/05/03 18:17:49	1.2
  @@ -56,6 +56,21 @@
   
   /*
    * $Log: Token.cpp,v $
  + * Revision 1.2  2001/05/03 18:17:49  knoaman
  + * Some design changes:
  + * o Changed the TokenFactory from a single static instance, to a
  + *    normal class. Each RegularExpression object will have its own
  + *    instance of TokenFactory, and that instance will be passed to
  + *    other classes that need to use a TokenFactory to create Token
  + *    objects (with the exception of RangeTokenMap).
  + * o Added a new class RangeTokenMap to map a the different ranges
  + *    in a given category to a specific RangeFactory object. In the old
  + *    design RangeFactory had dual functionality (act as a Map, and as
  + *    a factory for creating RangeToken(s)). The RangeTokenMap will
  + *    have its own copy of the TokenFactory. There will be only one
  + *    instance of the RangeTokenMap class, and that instance will be
  + *    lazily deleted when XPlatformUtils::Terminate is called.
  + *
    * Revision 1.1  2001/03/02 19:22:58  knoaman
    * Schema: Regular expression handling part I
    *
  @@ -151,8 +166,8 @@
   	case LOOKBEHIND:
   	case NEGATIVELOOKBEHIND:
   		return 0; // *****  - REVIST
  -	default:
  -		throw; //ThrowXML(RuntimeExceptions, ...)
  +//	default:
  +//		throw;
   	}
   
   	// We should not get here, but we have it to make some compilers happy
  @@ -233,8 +248,8 @@
       case LOOKBEHIND:
       case NEGATIVELOOKBEHIND:
   		return 0; // REVISIT
  -    default:
  -		throw; //ThrowXML(RuntimeException, ...)
  +//    default:
  +//		throw; //ThrowXML(RuntimeException, ...)
       } // end switch
   
   	return -1;
  @@ -244,7 +259,8 @@
   //  Token: Helper mthods
   // ---------------------------------------------------------------------------
   int Token::analyzeFirstCharacter(RangeToken* const rangeTok, 
  -								 const int options)
  +								 const int options,
  +                                 TokenFactory* const tokFactory)
   {
   	switch(fTokenType) {
   	case CONCAT:
  @@ -255,7 +271,7 @@
   				Token* tok = getChild(i);
   				if (tok
   					&& (ret=tok->analyzeFirstCharacter(rangeTok,
  -                                                       options))!= FC_CONTINUE)
  +                                    options, tokFactory))!= FC_CONTINUE)
   					break;
   			}
   			return ret;
  @@ -271,7 +287,7 @@
   
   			for (unsigned int i=0; i < childSize; i++) {
   
  -                ret = getChild(i)->analyzeFirstCharacter(rangeTok, options);
  +                ret = getChild(i)->analyzeFirstCharacter(rangeTok, options, tokFactory);
   
   				if (ret == FC_ANY)
   					break;
  @@ -282,14 +298,14 @@
   		}
   	case CONDITION:
   		{
  -            int ret1 = getChild(0)->analyzeFirstCharacter(rangeTok, options);
  +            int ret1 = getChild(0)->analyzeFirstCharacter(rangeTok, options, tokFactory);
   
               if (size() == 1)
                   return FC_CONTINUE;
   
   			int ret2;
   			if (ret1 != FC_ANY) {
  -			    ret2 = getChild(1)->analyzeFirstCharacter(rangeTok, options);  
  +			    ret2 = getChild(1)->analyzeFirstCharacter(rangeTok, options, tokFactory);
   			}
   
   			if (ret1 == FC_ANY || ret2 == FC_ANY)
  @@ -305,7 +321,7 @@
   		{
   			Token* tok = getChild(0);
   			if (tok)
  -				tok->analyzeFirstCharacter(rangeTok, options);
  +				tok->analyzeFirstCharacter(rangeTok, options, tokFactory);
   			return FC_CONTINUE;
   		}
   	case DOT:
  @@ -325,7 +341,7 @@
   		{
   			if (isSet(options, RegularExpression::IGNORE_CASE)) {
                   rangeTok->mergeRanges(((RangeToken*) 
  -                                         this)->getCaseInsensitiveToken());
  +                                         this)->getCaseInsensitiveToken(tokFactory));
   			}
   			else {
   				rangeTok->mergeRanges(this);
  @@ -337,12 +353,12 @@
   			if (isSet(options, RegularExpression::IGNORE_CASE)) {
   
   				RangeToken* caseITok = (((RangeToken*) 
  -					                       this)->getCaseInsensitiveToken());
  -				rangeTok->mergeRanges(RangeToken::complementRanges(caseITok));
  +					                       this)->getCaseInsensitiveToken(tokFactory));
  +				rangeTok->mergeRanges(RangeToken::complementRanges(caseITok, tokFactory));
   			}
   			else {
   				rangeTok->mergeRanges(
  -					RangeToken::complementRanges((RangeToken*) this));
  +					RangeToken::complementRanges((RangeToken*) this, tokFactory));
   			}
   		}
   	case INDEPENDENT:
  @@ -350,9 +366,7 @@
   		{
   			Token* tok = getChild(0);
   			if (tok)
  -				return tok->analyzeFirstCharacter(rangeTok,options);
  -			else
  -				throw; // ThrowXML(RuntimeException, ...)
  +				return tok->analyzeFirstCharacter(rangeTok,options, tokFactory);
   		}
   	case MODIFIERGROUP:
   	case BACKREFERENCE:
  @@ -377,8 +391,8 @@
   	case LOOKBEHIND:
   	case NEGATIVELOOKBEHIND:
   		FC_CONTINUE;
  -	default:
  -		throw;
  +//	default:
  +//		throw;
   	}
   
   	return 0;
  
  
  
  1.2       +18 -17    xml-xerces/c/src/util/regx/Token.hpp
  
  Index: Token.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/Token.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Token.hpp	2001/03/02 19:22:59	1.1
  +++ Token.hpp	2001/05/03 18:17:51	1.2
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: Token.hpp,v 1.1 2001/03/02 19:22:59 knoaman Exp $
  + * $Id: Token.hpp,v 1.2 2001/05/03 18:17:51 knoaman Exp $
    */
   
   #if !defined(TOKEN_HPP)
  @@ -65,8 +65,14 @@
   //  Includes
   // ---------------------------------------------------------------------------
   #include <util/XercesDefs.hpp>
  +#include <util/RuntimeException.hpp>
   
  +// ---------------------------------------------------------------------------
  +//  Forward Declaration
  +// ---------------------------------------------------------------------------
   class RangeToken;
  +class TokenFactory;
  +
   
   class XMLUTIL_EXPORT Token {
   public:
  @@ -143,12 +149,13 @@
   	// -----------------------------------------------------------------------
       //  Putter methods
       // -----------------------------------------------------------------------
  -	virtual void addChild(Token* const child);
  +	virtual void addChild(Token* const child, TokenFactory* const tokFactory);
   
   	// -----------------------------------------------------------------------
       //  Helper methods 
       // -----------------------------------------------------------------------
  -	int analyzeFirstCharacter(RangeToken* const rangeTok, const int options);
  +	int analyzeFirstCharacter(RangeToken* const rangeTok, const int options,
  +                              TokenFactory* const tokFactory);
       Token* findFixedString(int options, int& outOptions);
   
   private:
  @@ -243,9 +250,9 @@
   // ---------------------------------------------------------------------------
   //  Token: setter methods
   // ---------------------------------------------------------------------------
  -inline void Token::addChild(Token* const child) {
  +inline void Token::addChild(Token* const child, TokenFactory* const tokFactory) {
   
  -	throw; //ThrowXML(RuntimeException, "Not supported")
  +    ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   // ---------------------------------------------------------------------------
  @@ -253,38 +260,32 @@
   // ---------------------------------------------------------------------------
   inline void Token::addRange(const XMLInt32 start, const XMLInt32 end) {
   
  -	//REVISIT DO we need to throw an exception or just do nothing
  -	//throw; //ThrowXML(RuntimeException, "Not supported")
  +    ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline void Token::mergeRanges(const Token *const tok) {
   
  -	//REVISIT DO we need to throw an exception or just do nothing
  -	//throw; //ThrowXML(RuntimeException, "Not supported")
  +    ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline void Token::sortRanges() {
   
  -	//REVISIT DO we need to throw an exception or just do nothing
  -	//throw; //ThrowXML(RuntimeException, "Not supported")
  +    ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline void Token::compactRanges() {
   
  -	//REVISIT DO we need to throw an exception or just do nothing
  -	//throw; //ThrowXML(RuntimeException, "Not supported")
  +    ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline void Token::subtractRanges(RangeToken* const tok) {
   
  -	//REVISIT DO we need to throw an exception or just do nothing
  -	//throw; //ThrowXML(RuntimeException, "Not supported")
  +    ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   inline void Token::intersectRanges(RangeToken* const tok) {
   
  -	//REVISIT DO we need to throw an exception or just do nothing
  -	//throw; //ThrowXML(RuntimeException, "Not supported")
  +    ThrowXML(RuntimeException, XMLExcepts::Regex_NotSupported);
   }
   
   #endif
  
  
  
  1.3       +21 -36    xml-xerces/c/src/util/regx/TokenFactory.cpp
  
  Index: TokenFactory.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/TokenFactory.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TokenFactory.cpp	2001/03/22 13:23:34	1.2
  +++ TokenFactory.cpp	2001/05/03 18:17:52	1.3
  @@ -56,6 +56,21 @@
   
   /*
    * $Log: TokenFactory.cpp,v $
  + * Revision 1.3  2001/05/03 18:17:52  knoaman
  + * Some design changes:
  + * o Changed the TokenFactory from a single static instance, to a
  + *    normal class. Each RegularExpression object will have its own
  + *    instance of TokenFactory, and that instance will be passed to
  + *    other classes that need to use a TokenFactory to create Token
  + *    objects (with the exception of RangeTokenMap).
  + * o Added a new class RangeTokenMap to map a the different ranges
  + *    in a given category to a specific RangeFactory object. In the old
  + *    design RangeFactory had dual functionality (act as a Map, and as
  + *    a factory for creating RangeToken(s)). The RangeTokenMap will
  + *    have its own copy of the TokenFactory. There will be only one
  + *    instance of the RangeTokenMap class, and that instance will be
  + *    lazily deleted when XPlatformUtils::Terminate is called.
  + *
    * Revision 1.2  2001/03/22 13:23:34  knoaman
    * Minor modifications to eliminate compiler warnings.
    *
  @@ -73,13 +88,9 @@
   #include <util/regx/ASCIIRangeFactory.hpp>
   #include <util/regx/UnicodeRangeFactory.hpp>
   #include <util/regx/BlockRangeFactory.hpp>
  +#include <util/regx/RangeTokenMap.hpp>
   #include <util/regx/RegxDefs.hpp>
  -#include <stdlib.h>
   
  -// ---------------------------------------------------------------------------
  -//  Static member data initialization
  -// ---------------------------------------------------------------------------
  -TokenFactory* TokenFactory::fInstance = 0;
   
   // ---------------------------------------------------------------------------
   //  TokenFactory: Constructors and Destructor
  @@ -121,10 +132,12 @@
   
   	Token* tmpTok = new Token(tokType);
   
  -	if (tokType == Token::EMPTY)
  +	if (tokType == Token::EMPTY) {
   		fEmpty = tmpTok;
  +    }
   
   	fTokens->addElement(tmpTok);
  +
   	return tmpTok;
   }
   
  @@ -243,7 +256,7 @@
   		initializeRegistry();
   	}
   
  -	return RangeFactory::instance()->getRange(keyword, complement);
  +	return RangeTokenMap::instance()->getRange(keyword, complement);
   }
   
   Token* TokenFactory::getLineBegin() {
  @@ -379,12 +392,12 @@
           combiner_wo_virama->addRange(0xFF9F, 0xFF9F); // extras
   
           Token* left = TokenFactory::createUnion();       // base_char?
  -        left->addChild(base_char);
  -        left->addChild(createToken(Token::EMPTY));
  +        left->addChild(base_char, this);
  +        left->addChild(createToken(Token::EMPTY), this);
   
           Token* foo = createUnion();
  -        foo->addChild(TokenFactory::createConcat(virama,getRange(fgUniLetter)));
  -        foo->addChild(combiner_wo_virama);
  +        foo->addChild(TokenFactory::createConcat(virama,getRange(fgUniLetter)), this);
  +        foo->addChild(combiner_wo_virama, this);
   
           foo = createClosure(foo);
           foo = createConcat(left, foo);
  @@ -395,22 +408,6 @@
   	return fGrapheme;
   }
   
  -
  -// ---------------------------------------------------------------------------
  -//  RangeFactory: Instance methods
  -// ---------------------------------------------------------------------------
  -TokenFactory* TokenFactory::instance() {
  -
  -    if (!fInstance) {
  -
  -        fInstance = new TokenFactory();
  -        atexit(TokenFactory::cleanUp);
  -    }
  -	
  -    return (fInstance);
  -}
  -
  -
   // ---------------------------------------------------------------------------
   //  TokenFactory - Helper methods
   // ---------------------------------------------------------------------------
  @@ -421,32 +418,32 @@
       if (fRangeInitialized)
           return;
   
  -    RangeFactory::instance()->initializeRegistry();
  +    RangeTokenMap::instance()->initializeRegistry();
   
   	    // Add categories
  -    RangeFactory::instance()->addCategory(fgXMLCategory);
  -    RangeFactory::instance()->addCategory(fgASCIICategory);
  -    RangeFactory::instance()->addCategory(fgUnicodeCategory);
  -    RangeFactory::instance()->addCategory(fgBlockCategory);
  +    RangeTokenMap::instance()->addCategory(fgXMLCategory);
  +    RangeTokenMap::instance()->addCategory(fgASCIICategory);
  +    RangeTokenMap::instance()->addCategory(fgUnicodeCategory);
  +    RangeTokenMap::instance()->addCategory(fgBlockCategory);
   
   	// Add xml range factory
       RangeFactory* rangeFact = new XMLRangeFactory();
  -    rangeFact->addRangeMap(fgXMLCategory, rangeFact);
  +    RangeTokenMap::instance()->addRangeMap(fgXMLCategory, rangeFact);
       rangeFact->initializeKeywordMap();
   
       // Add ascii range factory
       rangeFact = new ASCIIRangeFactory();
  -    rangeFact->addRangeMap(fgASCIICategory, rangeFact);
  +    RangeTokenMap::instance()->addRangeMap(fgASCIICategory, rangeFact);
       rangeFact->initializeKeywordMap();
   
       // Add unicode range factory
       rangeFact = new UnicodeRangeFactory();
  -    rangeFact->addRangeMap(fgUnicodeCategory, rangeFact);
  +    RangeTokenMap::instance()->addRangeMap(fgUnicodeCategory, rangeFact);
       rangeFact->initializeKeywordMap();
   
       // Add block range factory
       rangeFact = new BlockRangeFactory();
  -    rangeFact->addRangeMap(fgBlockCategory, rangeFact);
  +    RangeTokenMap::instance()->addRangeMap(fgBlockCategory, rangeFact);
       rangeFact->initializeKeywordMap();
   
       fRangeInitialized = true;
  
  
  
  1.3       +21 -38    xml-xerces/c/src/util/regx/TokenFactory.hpp
  
  Index: TokenFactory.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/TokenFactory.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TokenFactory.hpp	2001/03/22 13:23:34	1.2
  +++ TokenFactory.hpp	2001/05/03 18:17:54	1.3
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: TokenFactory.hpp,v 1.2 2001/03/22 13:23:34 knoaman Exp $
  + * $Id: TokenFactory.hpp,v 1.3 2001/05/03 18:17:54 knoaman Exp $
    */
   
   #if !defined(TOKENFACTORY_HPP)
  @@ -89,13 +89,9 @@
   	// -----------------------------------------------------------------------
       //  Constructors and destructors
       // -----------------------------------------------------------------------
  +    TokenFactory();
       ~TokenFactory();
   
  -	// -----------------------------------------------------------------------
  -    //  Instance methods
  -    // -----------------------------------------------------------------------
  -	static TokenFactory* instance();
  -
       // -----------------------------------------------------------------------
       //  Factory methods
       // -----------------------------------------------------------------------
  @@ -115,10 +111,6 @@
       ConditionToken* createCondition(const int refNo, Token* const condition,
                                       Token* const yesFlow, Token* const noFlow);
   
  -    // -----------------------------------------------------------------------
  -    //  CleanUp methods
  -    // -----------------------------------------------------------------------
  -    static void cleanUp();
   
   	//static void printUnicode();
   
  @@ -148,7 +140,8 @@
       // -----------------------------------------------------------------------
       //  Unimplemented constructors and operators
       // -----------------------------------------------------------------------
  -    TokenFactory();
  +    TokenFactory(const TokenFactory&);
  +    operator=(const TokenFactory&);
   
       // -----------------------------------------------------------------------
       //  Private Helpers methods
  @@ -169,35 +162,25 @@
       //  fToken
       //      Contains user created Token objects. Used for memory cleanup.
       // -----------------------------------------------------------------------
  -    bool                 fRangeInitialized;
  -	XMLMutex             fMutex;
  -    RefVectorOf<Token>*  fTokens;
  -    Token*               fEmpty;
  -    Token*               fLineBegin;
  -    Token*               fLineBegin2;
  -    Token*               fLineEnd;
  -    Token*               fStringBegin;
  -    Token*               fStringEnd;
  -    Token*               fStringEnd2;
  -    Token*               fWordEdge;
  -    Token*               fNotWordEdge;
  -    Token*               fWordEnd;
  -    Token*               fWordBegin;
  -    Token*               fDot;
  -	Token*				 fCombiningChar;
  -	Token*				 fGrapheme;
  -	static TokenFactory* fInstance;
  +    bool                fRangeInitialized;
  +	XMLMutex            fMutex;
  +    RefVectorOf<Token>* fTokens;
  +    Token*              fEmpty;
  +    Token*              fLineBegin;
  +    Token*              fLineBegin2;
  +    Token*              fLineEnd;
  +    Token*              fStringBegin;
  +    Token*              fStringEnd;
  +    Token*              fStringEnd2;
  +    Token*              fWordEdge;
  +    Token*              fNotWordEdge;
  +    Token*              fWordEnd;
  +    Token*              fWordBegin;
  +    Token*              fDot;
  +	Token*              fCombiningChar;
  +	Token*              fGrapheme;
   };
   
  -
  -// ---------------------------------------------------------------------------
  -//  RangeFactory: Instance methods
  -// ---------------------------------------------------------------------------
  -inline void TokenFactory::cleanUp() {
  -
  -	delete fInstance;
  -	fInstance = 0;
  -}
   
   #endif
   
  
  
  
  1.2       +32 -18    xml-xerces/c/src/util/regx/UnicodeRangeFactory.cpp
  
  Index: UnicodeRangeFactory.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/UnicodeRangeFactory.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UnicodeRangeFactory.cpp	2001/03/02 19:26:48	1.1
  +++ UnicodeRangeFactory.cpp	2001/05/03 18:17:56	1.2
  @@ -56,6 +56,21 @@
   
   /*
    * $Log: UnicodeRangeFactory.cpp,v $
  + * Revision 1.2  2001/05/03 18:17:56  knoaman
  + * Some design changes:
  + * o Changed the TokenFactory from a single static instance, to a
  + *    normal class. Each RegularExpression object will have its own
  + *    instance of TokenFactory, and that instance will be passed to
  + *    other classes that need to use a TokenFactory to create Token
  + *    objects (with the exception of RangeTokenMap).
  + * o Added a new class RangeTokenMap to map a the different ranges
  + *    in a given category to a specific RangeFactory object. In the old
  + *    design RangeFactory had dual functionality (act as a Map, and as
  + *    a factory for creating RangeToken(s)). The RangeTokenMap will
  + *    have its own copy of the TokenFactory. There will be only one
  + *    instance of the RangeTokenMap class, and that instance will be
  + *    lazily deleted when XPlatformUtils::Terminate is called.
  + *
    * Revision 1.1  2001/03/02 19:26:48  knoaman
    * Schema: Regular expression handling part II
    *
  @@ -67,6 +82,7 @@
   #include <util/regx/UnicodeRangeFactory.hpp>
   #include <util/regx/TokenFactory.hpp>
   #include <util/regx/RangeToken.hpp>
  +#include <util/regx/RangeTokenMap.hpp>
   #include <util/regx/RegxDefs.hpp>
   #include <util/regx/XMLUniCharacter.hpp>
   
  @@ -147,9 +163,16 @@
       if (fRangesCreated)
           return;
   
  +    if (!fKeywordsInitialized) {
  +        initializeKeywordMap();
  +    }
  +
  +    RangeTokenMap* rangeTokMap = RangeTokenMap::instance();
  +    TokenFactory* tokFactory = rangeTokMap->getTokenFactory();
   	RangeToken* ranges[UNICATEGSIZE];
  +
       for (int i=0; i < UNICATEGSIZE; i++) {
  -        ranges[i] = TokenFactory::instance()->createRange();
  +        ranges[i] = tokFactory->createRange();
       }
   
       for (int j=0; j < 0x10000; j++) {
  @@ -173,36 +196,37 @@
   	ranges[XMLUniCharacter::UNASSIGNED]->addRange(0x10000, Token::UTF16_MAX);
   
   	for (int k=0; k < UNICATEGSIZE; k++) {
  -        setRangeToken(uniCategNames[k], ranges[k]);
  +        rangeTokMap->setRangeToken(uniCategNames[k], ranges[k]);
       }
   
       // Create all range
  -	RangeToken* tok = TokenFactory::instance()->createRange();
  +	RangeToken* tok = tokFactory->createRange();
   	tok->addRange(0, Token::UTF16_MAX);
  -	setRangeToken(fgUniAll, tok);
  +	rangeTokMap->setRangeToken(fgUniAll, tok);
   
       // Create alpha range
  -    tok = TokenFactory::instance()->createRange();
  +    tok = tokFactory->createRange();
       tok->mergeRanges(ranges[XMLUniCharacter::UPPERCASE_LETTER]);
       tok->mergeRanges(ranges[XMLUniCharacter::LOWERCASE_LETTER]);
       tok->mergeRanges(ranges[XMLUniCharacter::OTHER_LETTER]);
  -    setRangeToken(fgUniIsAlpha, tok);
  +    rangeTokMap->setRangeToken(fgUniIsAlpha, tok);
   
       // Create alpha-num range
  -    RangeToken* alnumTok = TokenFactory::instance()->createRange();
  +    RangeToken* alnumTok = tokFactory->createRange();
       alnumTok->mergeRanges(tok);
       alnumTok->mergeRanges(ranges[XMLUniCharacter::DECIMAL_DIGIT_NUMBER]);
  -    setRangeToken(fgUniIsAlnum, alnumTok);
  +    rangeTokMap->setRangeToken(fgUniIsAlnum, alnumTok);
   
       // Create word range
  -    tok = TokenFactory::instance()->createRange();
  +    tok = tokFactory->createRange();
       tok->mergeRanges(alnumTok);
       tok->addRange(chUnderscore, chUnderscore);
  -    setRangeToken(fgUniIsWord, tok);
  +    rangeTokMap->setRangeToken(fgUniIsWord, tok);
   
       // Create assigned range
       tok = ranges[XMLUniCharacter::UNASSIGNED];
  -    setRangeToken(fgUniAssigned,(RangeToken*)RangeToken::complementRanges(tok));
  +    rangeTokMap->setRangeToken(fgUniAssigned,(RangeToken*)RangeToken::complementRanges(tok,
  +		          tokFactory));
   
       fRangesCreated = true;
   }
  @@ -215,15 +239,17 @@
       if (fKeywordsInitialized)
           return;
   
  +    RangeTokenMap* rangeTokMap = RangeTokenMap::instance();
  +
   	for (int k=0; k < UNICATEGSIZE; k++) {
  -        addKeywordMap(uniCategNames[k], fgUnicodeCategory);
  +        rangeTokMap->addKeywordMap(uniCategNames[k], fgUnicodeCategory);
       }
   
  -	addKeywordMap(fgUniAll, fgUnicodeCategory);
  -    addKeywordMap(fgUniIsAlpha, fgUnicodeCategory);
  -    addKeywordMap(fgUniIsAlnum, fgUnicodeCategory);
  -    addKeywordMap(fgUniIsWord, fgUnicodeCategory);
  -    addKeywordMap(fgUniAssigned, fgUnicodeCategory);
  +	rangeTokMap->addKeywordMap(fgUniAll, fgUnicodeCategory);
  +    rangeTokMap->addKeywordMap(fgUniIsAlpha, fgUnicodeCategory);
  +    rangeTokMap->addKeywordMap(fgUniIsAlnum, fgUnicodeCategory);
  +    rangeTokMap->addKeywordMap(fgUniIsWord, fgUnicodeCategory);
  +    rangeTokMap->addKeywordMap(fgUniAssigned, fgUnicodeCategory);
   
       fKeywordsInitialized = true;
   }
  
  
  
  1.2       +6 -3      xml-xerces/c/src/util/regx/UnionToken.cpp
  
  Index: UnionToken.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/UnionToken.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UnionToken.cpp	2001/03/02 19:23:02	1.1
  +++ UnionToken.cpp	2001/05/03 18:17:59	1.2
  @@ -56,6 +56,21 @@
   
   /*
    * $Log: UnionToken.cpp,v $
  + * Revision 1.2  2001/05/03 18:17:59  knoaman
  + * Some design changes:
  + * o Changed the TokenFactory from a single static instance, to a
  + *    normal class. Each RegularExpression object will have its own
  + *    instance of TokenFactory, and that instance will be passed to
  + *    other classes that need to use a TokenFactory to create Token
  + *    objects (with the exception of RangeTokenMap).
  + * o Added a new class RangeTokenMap to map a the different ranges
  + *    in a given category to a specific RangeFactory object. In the old
  + *    design RangeFactory had dual functionality (act as a Map, and as
  + *    a factory for creating RangeToken(s)). The RangeTokenMap will
  + *    have its own copy of the TokenFactory. There will be only one
  + *    instance of the RangeTokenMap class, and that instance will be
  + *    lazily deleted when XPlatformUtils::Terminate is called.
  + *
    * Revision 1.1  2001/03/02 19:23:02  knoaman
    * Schema: Regular expression handling part I
    *
  @@ -94,7 +109,7 @@
   // ---------------------------------------------------------------------------
   //  UnionToken: Children manipulation methods
   // ---------------------------------------------------------------------------
  -void UnionToken::addChild(Token* const child) {
  +void UnionToken::addChild(Token* const child, TokenFactory* const tokFactory) {
   
       if (child == 0)
           return;
  @@ -152,7 +167,7 @@
   			stringBuf.append((XMLCh) ch);
   		}
   
  -		previousTok = TokenFactory::instance()->createString(0);
  +		previousTok = tokFactory->createString(0);
   		fChildren->setElementAt(previousTok, childSize - 1);
   	}
   	else {
  
  
  
  1.2       +2 -2      xml-xerces/c/src/util/regx/UnionToken.hpp
  
  Index: UnionToken.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/UnionToken.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UnionToken.hpp	2001/03/02 19:23:03	1.1
  +++ UnionToken.hpp	2001/05/03 18:18:01	1.2
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: UnionToken.hpp,v 1.1 2001/03/02 19:23:03 knoaman Exp $
  + * $Id: UnionToken.hpp,v 1.2 2001/05/03 18:18:01 knoaman Exp $
    */
   
   #if !defined(UNIONTOKEN_HPP)
  @@ -85,7 +85,7 @@
   	// -----------------------------------------------------------------------
       //  Children manipulation methods
       // -----------------------------------------------------------------------
  -    void addChild(Token* const child);
  +    void addChild(Token* const child, TokenFactory* const tokFactory);
   
   private:
   	// -----------------------------------------------------------------------
  
  
  
  1.2       +29 -16    xml-xerces/c/src/util/regx/XMLRangeFactory.cpp
  
  Index: XMLRangeFactory.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/regx/XMLRangeFactory.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XMLRangeFactory.cpp	2001/03/02 19:26:50	1.1
  +++ XMLRangeFactory.cpp	2001/05/03 18:18:02	1.2
  @@ -56,6 +56,21 @@
   
   /*
    * $Log: XMLRangeFactory.cpp,v $
  + * Revision 1.2  2001/05/03 18:18:02  knoaman
  + * Some design changes:
  + * o Changed the TokenFactory from a single static instance, to a
  + *    normal class. Each RegularExpression object will have its own
  + *    instance of TokenFactory, and that instance will be passed to
  + *    other classes that need to use a TokenFactory to create Token
  + *    objects (with the exception of RangeTokenMap).
  + * o Added a new class RangeTokenMap to map a the different ranges
  + *    in a given category to a specific RangeFactory object. In the old
  + *    design RangeFactory had dual functionality (act as a Map, and as
  + *    a factory for creating RangeToken(s)). The RangeTokenMap will
  + *    have its own copy of the TokenFactory. There will be only one
  + *    instance of the RangeTokenMap class, and that instance will be
  + *    lazily deleted when XPlatformUtils::Terminate is called.
  + *
    * Revision 1.1  2001/03/02 19:26:50  knoaman
    * Schema: Regular expression handling part II
    *
  @@ -69,6 +84,7 @@
   #include <util/regx/RegxDefs.hpp>
   #include <util/regx/TokenFactory.hpp>
   #include <util/regx/RangeToken.hpp>
  +#include <util/regx/RangeTokenMap.hpp>
   
   
   // ---------------------------------------------------------------------------
  @@ -122,29 +138,36 @@
       if (fRangesCreated)
           return;
   
  +    if (!fKeywordsInitialized) {
  +        initializeKeywordMap();
  +    }
  +
  +    RangeTokenMap* rangeTokMap = RangeTokenMap::instance();
  +    TokenFactory* tokFactory = rangeTokMap->getTokenFactory();
  +
       // Create space ranges
  -    RangeToken* tok = TokenFactory::instance()->createRange();
  +    RangeToken* tok = tokFactory->createRange();
       setupRange(tok, gWhitespaceChars);
  -    setRangeToken(fgXMLSpace, tok);
  +    rangeTokMap->setRangeToken(fgXMLSpace, tok);
   
       // Create digits ranges
  -    tok = TokenFactory::instance()->createRange();
  +    tok = tokFactory->createRange();
       setupRange(tok, gDigitChars);
       tok->sortRanges();
       tok->compactRanges();
  -    setRangeToken(fgXMLDigit, tok);
  +    rangeTokMap->setRangeToken(fgXMLDigit, tok);
   
       // Create word ranges
  -    tok = TokenFactory::instance()->createRange();
  +    tok = tokFactory->createRange();
       setupRange(tok, gBaseChars);
       setupRange(tok, gXMLChars);
       setupRange(tok, gDigitChars);
       tok->sortRanges();
       tok->compactRanges();
  -    setRangeToken(fgXMLWord, tok);
  +    rangeTokMap->setRangeToken(fgXMLWord, tok);
   
       // Create NameChar ranges
  -    tok = TokenFactory::instance()->createRange();
  +    tok = tokFactory->createRange();
       setupRange(tok, gBaseChars);
       setupRange(tok, gCombiningChars);
       setupRange(tok, gExtenderChars);
  @@ -156,17 +179,17 @@
       tok->addRange(chUnderscore, chUnderscore);
       tok->sortRanges();
       tok->compactRanges();
  -    setRangeToken(fgXMLNameChar, tok);
  +    rangeTokMap->setRangeToken(fgXMLNameChar, tok);
   
       // Create initialNameChar ranges
  -    tok = TokenFactory::instance()->createRange();
  +    tok = tokFactory->createRange();
       setupRange(tok, gBaseChars);
       setupRange(tok, gXMLChars);
       tok->addRange(chColon, chColon);
       tok->addRange(chUnderscore, chUnderscore);
       tok->sortRanges();
       tok->compactRanges();
  -    setRangeToken(fgXMLInitialNameChar, tok);
  +    rangeTokMap->setRangeToken(fgXMLInitialNameChar, tok);
   
       fRangesCreated = true;
   }
  @@ -178,12 +201,14 @@
   
       if (fKeywordsInitialized)
           return;
  +
  +    RangeTokenMap* rangeTokMap = RangeTokenMap::instance();
   
  -    addKeywordMap(fgXMLSpace, fgXMLCategory);
  -    addKeywordMap(fgXMLDigit, fgXMLCategory);
  -    addKeywordMap(fgXMLWord, fgXMLCategory);
  -    addKeywordMap(fgXMLNameChar, fgXMLCategory);
  -    addKeywordMap(fgXMLInitialNameChar, fgXMLCategory);
  +    rangeTokMap->addKeywordMap(fgXMLSpace, fgXMLCategory);
  +    rangeTokMap->addKeywordMap(fgXMLDigit, fgXMLCategory);
  +    rangeTokMap->addKeywordMap(fgXMLWord, fgXMLCategory);
  +    rangeTokMap->addKeywordMap(fgXMLNameChar, fgXMLCategory);
  +    rangeTokMap->addKeywordMap(fgXMLInitialNameChar, fgXMLCategory);
   
       fKeywordsInitialized = true;
   }
  
  
  
  1.1                  xml-xerces/c/src/util/regx/RangeTokenMap.cpp
  
  Index: RangeTokenMap.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   * 
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   * 
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   * 
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   * 
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   * 
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   * 
   * 4. The names "Xerces" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache\@apache.org.
   * 
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   * 
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation, and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com .  For more information
   * on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  /*
   * $Log: RangeTokenMap.cpp,v $
   * Revision 1.1  2001/05/03 18:17:40  knoaman
   * Some design changes:
   * o Changed the TokenFactory from a single static instance, to a
   *    normal class. Each RegularExpression object will have its own
   *    instance of TokenFactory, and that instance will be passed to
   *    other classes that need to use a TokenFactory to create Token
   *    objects (with the exception of RangeTokenMap).
   * o Added a new class RangeTokenMap to map a the different ranges
   *    in a given category to a specific RangeFactory object. In the old
   *    design RangeFactory had dual functionality (act as a Map, and as
   *    a factory for creating RangeToken(s)). The RangeTokenMap will
   *    have its own copy of the TokenFactory. There will be only one
   *    instance of the RangeTokenMap class, and that instance will be
   *    lazily deleted when XPlatformUtils::Terminate is called.
   *
   */
  
  // ---------------------------------------------------------------------------
  //  Includes
  // ---------------------------------------------------------------------------
  #include <util/regx/RangeTokenMap.hpp>
  #include <util/regx/RangeToken.hpp>
  #include <util/regx/RegxDefs.hpp>
  #include <util/regx/TokenFactory.hpp>
  #include <util/regx/RangeFactory.hpp>
  #include <util/PlatformUtils.hpp>
  #include <util/XMLDeleterFor.hpp>
  #include <util/XMLExceptMsgs.hpp>
  
  // ---------------------------------------------------------------------------
  //  Static member data initialization
  // ---------------------------------------------------------------------------
  RangeTokenMap*                     RangeTokenMap::fInstance = 0;
  
  
  // ---------------------------------------------------------------------------
  //  RangeTokenElemMap: Constructors and Destructor
  // ---------------------------------------------------------------------------
  RangeTokenElemMap::RangeTokenElemMap(unsigned int categoryId) :
      fCategoryId(categoryId)
      , fRange(0)
      , fNRange(0)
  {
  
  }
  
  RangeTokenElemMap::~RangeTokenElemMap()
  {
  
  }
  
  // ---------------------------------------------------------------------------
  //  RangeTokenMap: Constructors and Destructor
  // ---------------------------------------------------------------------------
  RangeTokenMap::RangeTokenMap() :
      fRegistryInitialized(0)
      , fTokenRegistry(0)
      , fRangeMap(0)
      , fCategories(0)
      , fTokenFactory(0) {
  
  }
  
  RangeTokenMap::~RangeTokenMap() {
  
      delete fTokenRegistry;
      fTokenRegistry = 0;
  
      delete fRangeMap;
      fRangeMap = 0;
  
      delete fCategories;
      fCategories = 0;
  
      delete fInstance;
      fInstance = 0;
  
      delete fTokenFactory;
      fTokenFactory = 0;
  }
  
  // ---------------------------------------------------------------------------
  //  RangeTokenMap: Getter methods
  // ---------------------------------------------------------------------------
  RangeToken* RangeTokenMap::getRange(const XMLCh* const keyword,
  								   const bool complement) {
  
  	if (fTokenRegistry == 0 || fRangeMap == 0 || fCategories == 0)
  		return 0;
  
      if (!fTokenRegistry->containsKey(keyword))
  		return 0;
  
  
  	RangeTokenElemMap* elemMap = 0;
  
  	// Use a faux scope to synchronize while we do this
      {
          XMLMutexLock lockInit(&fMutex);
  
  		elemMap = fTokenRegistry->get(keyword);
  		RangeToken* rangeTok = 0;
  
  		if (elemMap->getRangeToken() == 0) {
  		
  			unsigned int categId = elemMap->getCategoryId();
  			const XMLCh* categName = fCategories->getValueForId(categId);
  			RangeFactory* rangeFactory = fRangeMap->get(categName);
  
  			if (rangeFactory == 0)
  				return 0;
  
  			rangeFactory->buildRanges();
  		}
  
  		if (complement && ((rangeTok = elemMap->getRangeToken()) != 0)) {
  			elemMap->setRangeToken((RangeToken*)
  									RangeToken::complementRanges(rangeTok, fTokenFactory),
  									complement);    
  		}        
      }
  
  	return (elemMap == 0) ? 0 : elemMap->getRangeToken(complement);
  }
  
  
  // ---------------------------------------------------------------------------
  //  RangeTokenMap: Putter methods
  // ---------------------------------------------------------------------------
  void RangeTokenMap::addCategory(const XMLCh* const categoryName) {
  
      if (fCategories)
  	    fCategories->addOrFind(categoryName);
  }
  
  void RangeTokenMap::addRangeMap(const XMLCh* const categoryName,
                                  RangeFactory* const rangeFactory) {
  
      if (fRangeMap)
  	    fRangeMap->put((void*)categoryName, rangeFactory);
  }
  
  void RangeTokenMap::addKeywordMap(const XMLCh* const keyword,
                                   const XMLCh* const categoryName) {
  
      if (fCategories == 0 || fTokenRegistry == 0)
          return;
  
  	unsigned int categId = fCategories->getId(categoryName);
  
  	if (categId == 0) {
  		ThrowXML1(RuntimeException, XMLExcepts::Regex_InvalidCategoryName, categoryName);
  	}
  
      if (fTokenRegistry->containsKey(keyword)) {
  
          RangeTokenElemMap* elemMap = fTokenRegistry->get(keyword);
  
  		if (elemMap->getCategoryId() != categId)
  			elemMap->setCategoryId(categId);
  
  		return;
  	}
  
  	fTokenRegistry->put((void*) keyword, new RangeTokenElemMap(categId));
  }
  
  // ---------------------------------------------------------------------------
  //  RangeTokenMap: Setter methods
  // ---------------------------------------------------------------------------
  void RangeTokenMap::setRangeToken(const XMLCh* const keyword,
                                    RangeToken* const tok,const bool complement) {
  
      if (fTokenRegistry == 0)
  		return;
  
  	if (fTokenRegistry->containsKey(keyword)) {
          fTokenRegistry->get(keyword)->setRangeToken(tok, complement);
      }
      else {
  		ThrowXML1(RuntimeException, XMLExcepts::Regex_KeywordNotFound, keyword);
  	}
  }
  
  
  // ---------------------------------------------------------------------------
  //  RangeTokenMap: Initialization methods
  // ---------------------------------------------------------------------------
  void RangeTokenMap::initializeRegistry() {
  
  	XMLMutexLock lockInit(&fMutex);
  
  	if (fRegistryInitialized)
  		return;
  
      fTokenFactory = new TokenFactory();
      fTokenRegistry = new RefHashTableOf<RangeTokenElemMap>(109);
      fRangeMap = new RefHashTableOf<RangeFactory>(29);
  	fCategories = new XMLStringPool();
  	fRegistryInitialized = true;
  }
  
  
  // ---------------------------------------------------------------------------
  //  RangeTokenMap: Instance methods
  // ---------------------------------------------------------------------------
  RangeTokenMap* RangeTokenMap::instance() {
  
  	if (!fInstance) {
  
  		fInstance = new RangeTokenMap();
          XMLPlatformUtils::registerLazyData
          (
              new XMLDeleterFor<RangeTokenMap>(fInstance)
          );
  	}
  	
      return (fInstance);
  }
  
  /**
    * End of file RangeTokenMap.cpp
    */
  
  
  
  1.1                  xml-xerces/c/src/util/regx/RangeTokenMap.hpp
  
  Index: RangeTokenMap.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   * 
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   * 
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   * 
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   * 
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   * 
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   * 
   * 4. The names "Xerces" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache\@apache.org.
   * 
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   * 
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation, and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com .  For more information
   * on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  /*
   * $Id: RangeTokenMap.hpp,v 1.1 2001/05/03 18:17:41 knoaman Exp $
   */
  
  #if !defined(RANGETOKENMAP_HPP)
  #define RANGETOKENMAP_HPP
  
  // ---------------------------------------------------------------------------
  //  Includes
  // ---------------------------------------------------------------------------
  #include <util/StringPool.hpp>
  #include <util/Mutexes.hpp>
  
  // ---------------------------------------------------------------------------
  //  Forward Declaration
  // ---------------------------------------------------------------------------
  class RangeToken;
  class RangeFactory;
  class TokenFactory;
  
  
  class XMLUTIL_EXPORT RangeTokenElemMap {
  
  public:
      RangeTokenElemMap(unsigned int categoryId);
      ~RangeTokenElemMap();
  
      // -----------------------------------------------------------------------
      //  Getter methods
      // -----------------------------------------------------------------------
  	unsigned int getCategoryId() const;
  	RangeToken*  getRangeToken(const bool complement = false) const;
  
  	// -----------------------------------------------------------------------
      //  Setter methods
      // -----------------------------------------------------------------------
  	void setRangeToken(RangeToken* const tok, const bool complement = false);
  	void setCategoryId(const unsigned int categId);
  
  private:
      // -----------------------------------------------------------------------
      //  Unimplemented constructors and operators
      // -----------------------------------------------------------------------
      RangeTokenElemMap(const RangeTokenElemMap&);
      void operator=(const RangeTokenElemMap&);
  
      // Data members
      unsigned int fCategoryId;
      RangeToken*  fRange;
      RangeToken*  fNRange;
  };
  
  
  class XMLUTIL_EXPORT RangeTokenMap {
  
  public:
  	// -----------------------------------------------------------------------
      //  Constructors and destructors
      // -----------------------------------------------------------------------
      virtual ~RangeTokenMap();
  
      // -----------------------------------------------------------------------
      //  Putter methods
      // -----------------------------------------------------------------------
      void addCategory(const XMLCh* const categoryName);
  	void addRangeMap(const XMLCh* const categoryName,
                       RangeFactory* const rangeFactory);
      void addKeywordMap(const XMLCh* const keyword,
                         const XMLCh* const categoryName);
  
      // -----------------------------------------------------------------------
      //  Instance methods
      // -----------------------------------------------------------------------
  	static RangeTokenMap* instance();
  
      // -----------------------------------------------------------------------
      //  Setter methods
      // -----------------------------------------------------------------------
  	void setRangeToken(const XMLCh* const keyword, RangeToken* const tok,
                         const bool complement = false);
  
      // -----------------------------------------------------------------------
      //  Getter methods
      // -----------------------------------------------------------------------
  	TokenFactory* getTokenFactory() const;
  
  protected:
      // -----------------------------------------------------------------------
      //  Constructor and destructors
      // -----------------------------------------------------------------------
      RangeTokenMap();
  
      // -----------------------------------------------------------------------
      //  Getter methods
      // -----------------------------------------------------------------------
      /*
       *  Gets a commonly used RangeToken from the token registry based on the
       *  range name - Called by TokenFactory.
       */
  	 RangeToken* getRange(const XMLCh* const name,
                            const bool complement = false);
  
       RefHashTableOf<RangeTokenElemMap>* getTokenRegistry() const;
       RefHashTableOf<RangeFactory>* getRangeMap() const;
  	 XMLStringPool* getCategories() const;
  
  private:
  	// -----------------------------------------------------------------------
      //  Unimplemented constructors and operators
      // -----------------------------------------------------------------------
      RangeTokenMap(const RangeTokenMap&);
      void operator=(const RangeTokenMap&);
  
      // -----------------------------------------------------------------------
      //  Private Helpers methods
      // -----------------------------------------------------------------------
      /*
       *  Initializes the registry with a set of commonly used RangeToken
       *  objects.
       */
       void initializeRegistry();
  	 friend class TokenFactory;
  
      // -----------------------------------------------------------------------
      //  Private data members
      //
      //  fTokenRegistry
      //      Contains a set of commonly used tokens
  	//
      //  fRangeMap
      //      Contains a map between a category name and a RangeFactory object.
      //
      //  fCategories
      //      Contains range categories names
      //
      //  fTokenFactory
      //      Token factory object
      //
      //  fInstance
      //      A RangeTokenMap instance
      //
      //  fMutex
      //      A mutex object for synchronization
      // -----------------------------------------------------------------------
      bool                               fRegistryInitialized;	
      RefHashTableOf<RangeTokenElemMap>* fTokenRegistry;
      RefHashTableOf<RangeFactory>*      fRangeMap;
  	XMLStringPool*                     fCategories;
      TokenFactory*                      fTokenFactory;
      XMLMutex                           fMutex;
      static RangeTokenMap*              fInstance;
  };
  
  // ---------------------------------------------------------------------------
  //  RangeTokenElemMap: Getter methods
  // ---------------------------------------------------------------------------
  inline unsigned int RangeTokenElemMap::getCategoryId() const {
  
      return fCategoryId;
  }
  
  inline RangeToken* RangeTokenElemMap::getRangeToken(const bool complement) const {
  
  	return complement ? fNRange : fRange;
  }
  
  // ---------------------------------------------------------------------------
  //  RangeTokenElemMap: Setter methods
  // ---------------------------------------------------------------------------
  inline void RangeTokenElemMap::setCategoryId(const unsigned int categId) {
  
      fCategoryId = categId;
  }
  
  inline void RangeTokenElemMap::setRangeToken(RangeToken* const tok,
                                        const bool complement) {
  
      if (complement)
          fNRange = tok;
  	else
          fRange = tok;
  }
  
  // ---------------------------------------------------------------------------
  //  RangeTokenMap: Getter methods
  // ---------------------------------------------------------------------------
  inline RefHashTableOf<RangeTokenElemMap>* RangeTokenMap::getTokenRegistry() const {
  
      return fTokenRegistry;
  }
  
  inline RefHashTableOf<RangeFactory>* RangeTokenMap::getRangeMap() const {
  
      return fRangeMap;
  }
  
  inline XMLStringPool* RangeTokenMap::getCategories() const {
  
      return fCategories;
  }
  
  inline TokenFactory* RangeTokenMap::getTokenFactory() const {
  
      return fTokenFactory;
  }
  
  #endif
  
  /**
    *	End file RangeToken.hpp
    */
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org