Svcconf_Handler.h

Go to the documentation of this file.
00001 // $Id: Svcconf_Handler.h 78907 2007-07-16 10:22:58Z sowayaa $
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Svcconf_Handler.h
00006  *
00007  *  $Id: Svcconf_Handler.h 78907 2007-07-16 10:22:58Z sowayaa $
00008  *
00009  *  @author Nanbor Wang <nanbor@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef ACEXML_SVCCONF_HANDLER_H
00014 #define ACEXML_SVCCONF_HANDLER_H
00015 
00016 #include "ACEXML/common/DefaultHandler.h"
00017 #include "ace/Service_Types.h"
00018 
00019 #if (ACE_USES_CLASSIC_SVC_CONF == 0)
00020 
00021 class ACE_Parsed_Info
00022 {
00023 public:
00024   ACE_Parsed_Info ();
00025   ~ACE_Parsed_Info ();
00026 
00027   /**
00028    * Set/get name of a parsed entity.
00029    */
00030   int name (const ACEXML_Char *n);
00031   const ACEXML_Char *name (void);
00032 
00033   /**
00034    * Set/get type of a dynamic node.
00035    */
00036   int service_type (int type);
00037   int service_type (void);
00038 
00039   /**
00040    * Set/Get active status.
00041    */
00042   int active (int a);
00043   int active (void);
00044 
00045   /**
00046    * Set/get initializer path.
00047    */
00048   int path (const ACEXML_Char *n);
00049   const ACEXML_Char *path (void);
00050 
00051   /**
00052    * Set/get initializer init function.
00053    */
00054   int init_func (const ACEXML_Char *n);
00055   const ACEXML_Char *init_func (void);
00056 
00057   /**
00058    * Set/get initializer init parameter.
00059    */
00060   int init_params (const ACEXML_Char *n);
00061   const ACEXML_Char *init_params (void);
00062 
00063   /**
00064    * Reset Parsed_Info.
00065    */
00066   void reset (void);
00067 
00068 protected:
00069   ACEXML_Char *name_;
00070   int service_type_;
00071   int active_;
00072   ACEXML_Char *path_;
00073   ACEXML_Char *init_func_;
00074   ACEXML_Char *init_params_;
00075 };
00076 
00077 /**
00078  * @class ACEXML_Svcconf_Handler
00079  *
00080  * @brief ACEXML_Svcconf_Handler is an example SAX event handler.
00081  *
00082  * This SAX event handler try to regenerate the XML document it
00083  * reads with correct indentation.
00084  */
00085 class ACEXML_Svcconf_Handler : public ACEXML_DefaultHandler
00086 {
00087 public:
00088   /*
00089    * Default constructor.
00090    */
00091   ACEXML_Svcconf_Handler (void);
00092 
00093   /*
00094    * Default destructor.
00095    */
00096   virtual ~ACEXML_Svcconf_Handler (void);
00097 
00098   // Methods inherit from ACEXML_ContentHandler.
00099 
00100   /*
00101    * Receive notification of character data.
00102    */
00103   virtual void characters (const ACEXML_Char *ch,
00104                            int start,
00105                            int length ACEXML_ENV_ARG_DECL)
00106     ;
00107 
00108   /*
00109    * Receive notification of the end of a document.
00110    */
00111   virtual void endDocument (ACEXML_ENV_SINGLE_ARG_DECL)
00112     ;
00113 
00114   /*
00115    * Receive notification of the end of an element.
00116    */
00117   virtual void endElement (const ACEXML_Char *namespaceURI,
00118                            const ACEXML_Char *localName,
00119                            const ACEXML_Char *qName ACEXML_ENV_ARG_DECL)
00120     ;
00121 
00122   /*
00123    * End the scope of a prefix-URI mapping.
00124    */
00125   virtual void endPrefixMapping (const ACEXML_Char *prefix ACEXML_ENV_ARG_DECL)
00126     ;
00127 
00128   /*
00129    * Receive notification of ignorable whitespace in element content.
00130    */
00131   virtual void ignorableWhitespace (const ACEXML_Char *ch,
00132                                     int start,
00133                                     int length ACEXML_ENV_ARG_DECL)
00134     ;
00135 
00136   /*
00137    * Receive notification of a processing instruction.
00138    */
00139   virtual void processingInstruction (const ACEXML_Char *target,
00140                                       const ACEXML_Char *data ACEXML_ENV_ARG_DECL)
00141     ;
00142 
00143   /*
00144    * Receive an object for locating the origin of SAX document events.
00145    */
00146   virtual void setDocumentLocator (ACEXML_Locator *locator) ;
00147 
00148   /*
00149    * Receive notification of a skipped entity.
00150    */
00151   virtual void skippedEntity (const ACEXML_Char *name ACEXML_ENV_ARG_DECL)
00152     ;
00153 
00154   /*
00155    * Receive notification of the beginning of a document.
00156    */
00157   virtual void startDocument (ACEXML_ENV_SINGLE_ARG_DECL)
00158     ;
00159 
00160   /*
00161    * Receive notification of the beginning of an element.
00162    */
00163   virtual void startElement (const ACEXML_Char *namespaceURI,
00164                              const ACEXML_Char *localName,
00165                              const ACEXML_Char *qName,
00166                              ACEXML_Attributes *atts ACEXML_ENV_ARG_DECL)
00167     ;
00168 
00169   /*
00170    * Begin the scope of a prefix-URI Namespace mapping.
00171    */
00172   virtual void startPrefixMapping (const ACEXML_Char *prefix,
00173                                    const ACEXML_Char *uri ACEXML_ENV_ARG_DECL)
00174     ;
00175 
00176   // *** Methods inherit from ACEXML_DTDHandler.
00177 
00178   /*
00179    * Receive notification of a notation declaration event.
00180    */
00181   virtual void notationDecl (const ACEXML_Char *name,
00182                              const ACEXML_Char *publicId,
00183                              const ACEXML_Char *systemId ACEXML_ENV_ARG_DECL)
00184     ;
00185 
00186   /*
00187    * Receive notification of an unparsed entity declaration event.
00188    */
00189   virtual void unparsedEntityDecl (const ACEXML_Char *name,
00190                                    const ACEXML_Char *publicId,
00191                                    const ACEXML_Char *systemId,
00192                                    const ACEXML_Char *notationName ACEXML_ENV_ARG_DECL)
00193     ;
00194 
00195   // Methods inherit from ACEXML_EnitityResolver.
00196 
00197   /*
00198    * Allow the application to resolve external entities.
00199    */
00200   virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId,
00201                                              const ACEXML_Char *systemId ACEXML_ENV_ARG_DECL)
00202     ;
00203 
00204   // Methods inherit from ACEXML_ErrorHandler.
00205 
00206   /*
00207    * Receive notification of a recoverable error.
00208    */
00209   virtual void error (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL)
00210     ;
00211 
00212   /*
00213    * Receive notification of a non-recoverable error.
00214    */
00215   virtual void fatalError (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL)
00216     ;
00217 
00218   /*
00219    * Receive notification of a warning.
00220    */
00221   virtual void warning (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL)
00222     ;
00223 
00224 protected:
00225   /**
00226    * Get the only attribute in <stream> or <streamdef>.
00227    */
00228   int get_stream_id (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL);
00229 
00230   /**
00231    * Get the only attribute in <resume>, <suspend>, <remove>
00232    */
00233   int get_id (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL);
00234 
00235   /**
00236    * Get the dynamic tag attributes.
00237    */
00238   int get_dynamic_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL);
00239 
00240   /**
00241    * Get the initializer tag attributes.
00242    */
00243   int get_initializer_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL);
00244 
00245   /**
00246    * Get the static tag attributes.
00247    */
00248   int get_static_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL);
00249 
00250 private:
00251   /// We are parsing a stream definition
00252   int in_stream_def_;
00253 
00254   /// We are defining a steam module
00255   int in_module_;
00256 
00257   /// @a stream_ holds the actually Stream_Type object managed by @a stream_svc_type_.
00258   ACE_Service_Type *stream_svc_type_;
00259   ACE_Stream_Type *stream_;
00260 
00261   //ACE_SHLIB_HANDLE dll_handle_;
00262 
00263   ACE_Parsed_Info parsed_info_;
00264 
00265   ACE_Parsed_Info stream_info_;
00266 
00267   ACEXML_Locator* locator_;
00268 };
00269 
00270 #if defined (__ACEXML_INLINE__)
00271 # include "Svcconf_Handler.inl"
00272 #endif /* __ACEXML_INLINE__ */
00273 
00274 #endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */
00275 
00276 #endif /* ACEXML_SVCCONF_HANDLER_H */

Generated on Sun Jan 27 13:04:15 2008 for ACEXML by doxygen 1.3.6