Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Parser.i

Go to the documentation of this file.
00001 //=============================================================================
00002 /**
00003  *  @file    Parser.i
00004  *
00005  *  $Id: Parser.i,v 1.1.1.1 2003/02/21 18:36:32 chad Exp $
00006  *
00007  *  @author Nanbor Wang <nanbor@cs.wustl.edu>
00008  */
00009 //=============================================================================
00010 
00011 ACEXML_INLINE ACEXML_ContentHandler *
00012 ACEXML_Parser::getContentHandler (void) const
00013 {
00014   return this->content_handler_;
00015 }
00016 
00017 ACEXML_INLINE ACEXML_DTDHandler *
00018 ACEXML_Parser::getDTDHandler (void) const
00019 {
00020   return this->dtd_handler_;
00021 }
00022 
00023 ACEXML_INLINE ACEXML_EntityResolver *
00024 ACEXML_Parser::getEntityResolver (void) const
00025 {
00026   return this->entity_resolver_;
00027 }
00028 
00029 ACEXML_INLINE ACEXML_ErrorHandler *
00030 ACEXML_Parser::getErrorHandler (void) const
00031 {
00032   return this->error_handler_;
00033 }
00034 
00035 ACEXML_INLINE void
00036 ACEXML_Parser::setContentHandler (ACEXML_ContentHandler *handler)
00037 {
00038   this->content_handler_ = handler;
00039 }
00040 
00041 ACEXML_INLINE void
00042 ACEXML_Parser::setDTDHandler (ACEXML_DTDHandler *handler)
00043 {
00044   this->dtd_handler_ = handler;
00045 }
00046 
00047 ACEXML_INLINE void
00048 ACEXML_Parser::setEntityResolver (ACEXML_EntityResolver *resolver)
00049 {
00050   this->entity_resolver_ = resolver;
00051 }
00052 
00053 ACEXML_INLINE void
00054 ACEXML_Parser::setErrorHandler (ACEXML_ErrorHandler *handler)
00055 {
00056   this->error_handler_ = handler;
00057 }
00058 
00059 ACEXML_INLINE int
00060 ACEXML_Parser::is_whitespace (ACEXML_Char c)
00061 {
00062   switch (c)
00063     {
00064     case 0xa:
00065     case 0x20:
00066     case 0x9:
00067     case 0xd:
00068       return 1;
00069     default:
00070       return 0;
00071     }
00072 }
00073 
00074 
00075 ACEXML_INLINE int
00076 ACEXML_Parser::is_whitespace_or_equal (ACEXML_Char c)
00077 {
00078   return (is_whitespace (c) || c == '=') ? 1 : 0;
00079 }
00080 
00081 ACEXML_INLINE int
00082 ACEXML_Parser::is_nonname (ACEXML_Char c)
00083 {
00084   // Handle this separately as doing so avoids code duplication and enables
00085   // setting of line and column numbers in one place.
00086   if (is_whitespace_or_equal (c))
00087     return 1;
00088 
00089   switch (c)
00090     {
00091     case '/':
00092     case '?':
00093     case '>':
00094     case '<':
00095     case ')':
00096     case '(':
00097     case '+':
00098     case '*':
00099     case '\'':
00100     case '"':
00101     case ',':
00102     case '|':
00103       return 1;
00104     default:
00105       return 0;
00106     }
00107 }
00108 
00109 ACEXML_INLINE ACEXML_Char
00110 ACEXML_Parser::get (void)
00111 {
00112   // Using an extra level of indirection so we can
00113   // manage document location in the future.
00114 
00115   if (this->instream_ != 0)
00116     {
00117       ACEXML_Char ch;
00118       if (this->instream_->get (ch) == -1)
00119         return 0;
00120       this->locator_.incrColumnNumber();
00121       if (ch == 0x0A) {
00122         this->locator_.incrLineNumber();
00123         this->locator_.setColumnNumber (0);
00124       }
00125       return ch;
00126     }
00127   return 0;
00128 }
00129 
00130 ACEXML_INLINE ACEXML_Char
00131 ACEXML_Parser::peek (void)
00132 {
00133   // Using an extra level of indirection so we can
00134   // manage document location in the future.
00135 
00136   if (this->instream_ != 0)
00137     return this->instream_->peek ();
00138   return 0;
00139 
00140 }

Generated on Mon Jun 16 13:23:25 2003 for ACEXML by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002