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

LocatorImpl.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    LocatorImpl.h
00006  *
00007  *  $Id: LocatorImpl.h,v 1.1.1.1 2003/02/21 18:36:32 chad Exp $
00008  *
00009  *  @author Nanbor Wang <nanbor@cs.wustl.edu>
00010  *  @author Krishnakumar Balasubramanian <kitty@cs.wustl.edu>
00011  */
00012 //=============================================================================
00013 
00014 #ifndef ACEXML_LOCALTORIMPL_H
00015 #define ACEXML_LOCALTORIMPL_H
00016 
00017 #include "ace/pre.h"
00018 #include "ACEXML/common/ACEXML_Export.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 #pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "ACEXML/common/Locator.h"
00025 
00026 /**
00027  * @class ACEXML_LocatorImpl LocatorImpl.h "ACEXML/common/LocatorImpl.h"
00028  *
00029  * @brief ACEXML_LocatorImpl is an implementation of ACEXML_Locator.
00030  *
00031  * This class is available mainly for application writers, who can
00032  * use it to make a persistent snapshot of a locator at any point
00033  * during a document parse:
00034  *
00035  * @code
00036  *   ACEXML_Locator locator;
00037  *   ACEXML_Locator startloc;
00038  *
00039  *   public void setLocator (ACEXML_Locator locator)
00040  *   {
00041  *      // note the locator
00042  *      this.locator = locator;
00043  *   }
00044  *
00045  *   public void startDocument ()
00046  *   {
00047  *      // save the location of the start of the document
00048  *      // for future use.
00049  *      ACEXML_Locator startloc = new ACEXML_LocatorImpl(locator);
00050  *   }
00051  * @endcode
00052  *
00053  * Normally, parser writers will not use this class, since it is more
00054  * efficient to provide location information only when requested,
00055  * rather than constantly updating a Locator object.
00056  *
00057  * @todo ACEXML parser doesn't support the use of Locator yet.
00058  *
00059  * @sa ACEXML_Locator
00060  */
00061 class ACEXML_Export ACEXML_LocatorImpl : public ACEXML_Locator
00062 {
00063 public:
00064   /*
00065    * Default constructor.
00066    */
00067   ACEXML_LocatorImpl (void);
00068 
00069   /*
00070    * Copy constructor.  Create a persistent copy of the current state
00071    * of a locator. When the original locator changes, this copy will
00072    * still keep the original values (and it can be used outside the
00073    * scope of DocumentHandler methods).
00074    */
00075   ACEXML_LocatorImpl (const ACEXML_Locator& locator);
00076 
00077   /*
00078    * Destructor.
00079    */
00080   virtual ~ACEXML_LocatorImpl (void);
00081 
00082   /*
00083    * Return the column number where the current document event ends.
00084    */
00085   virtual int getColumnNumber (void) const;
00086 
00087   /*
00088    * Return the line number where the current document event ends.
00089    */
00090   virtual int getLineNumber (void) const;
00091 
00092   /*
00093    * Return the public identifier for the current document event.
00094    */
00095   virtual const ACEXML_Char *getPublicId (void) const;
00096 
00097   /*
00098    * Return the system identifier for the current document event.
00099    */
00100   virtual const ACEXML_Char *getSystemId (void) const;
00101 
00102   /*
00103    * Set the column number of this locator.
00104    */
00105   void setColumnNumber (int cn);
00106 
00107   /*
00108    * Set the line number of this locator.
00109    */
00110   void setLineNumber (int ln);
00111 
00112   /*
00113    * Set the public identifier of this locator.
00114    */
00115   void setPublicId (const ACEXML_Char *id);
00116 
00117   /*
00118    * Set the system identifier of this locator.
00119    */
00120   void setSystemId (const ACEXML_Char *id);
00121 
00122   /*
00123    * Increment the line number.
00124    */
00125   void incrLineNumber ();
00126 
00127   /*
00128    * Increment the column number.
00129    */
00130   void incrColumnNumber ();
00131 
00132   /*
00133    * Reset the Locator information. This is necessary because one might
00134    * want to use the same parser to parse multiple files. In that case,
00135    * tying the life of the Locator with the parser is not appropriate. The
00136    * parser calls this method as soon as issuing an endDocument() call.
00137    */
00138   void reset (void);
00139 
00140 private:
00141   ACEXML_Char *publicId_;
00142   ACEXML_Char *systemId_;
00143   int lineNumber_;
00144   int columnNumber_;
00145 };
00146 
00147 #if defined (__ACEXML_INLINE__)
00148 # include "ACEXML/common/LocatorImpl.i"
00149 #endif /* __ACEXML_INLINE__ */
00150 
00151 #include "ace/post.h"
00152 
00153 #endif /* ACEXML_LOCALTORIMPL_H */

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