FDO API Reference Feature Data Objects

CharDataHandler.h

Go to the documentation of this file.
00001 #ifndef FDO_XML_CHARDATAHANDLER_H
00002 #define FDO_XML_CHARDATAHANDLER_H
00003 // 
00004 
00005 //
00006 // Copyright (C) 2004-2006  Autodesk, Inc.
00007 // 
00008 // This library is free software; you can redistribute it and/or
00009 // modify it under the terms of version 2.1 of the GNU Lesser
00010 // General Public License as published by the Free Software Foundation.
00011 // 
00012 // This library is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 // Lesser General Public License for more details.
00016 // 
00017 // You should have received a copy of the GNU Lesser General Public
00018 // License along with this library; if not, write to the Free Software
00019 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 //
00021 
00022 #include <FdoCommon.h>
00023 
00024 /// \brief
00025 /// FdoXmlCharDataHandler is convenience class for reading XML element content.
00026 /// When FdoXmlReader encounters the start of an element with simple content, an object
00027 /// of this class can be constructed and pushed onto the FdoXmlReader's SAX handler 
00028 /// stack. When the end of the element is reached, the object will contain all of
00029 /// the element's content.
00030 class FdoXmlCharDataHandler :
00031     public FdoDisposable,
00032     public FdoXmlSaxHandler
00033 {
00034 public:
00035     /// \brief
00036     /// Constructs a Char Data Handler.
00037     /// 
00038     /// \return
00039     /// Returns FdoXmlCharDataHandler
00040     /// 
00041     FDO_API_COMMON static FdoXmlCharDataHandler* Create(void);
00042 
00043     /// \brief
00044     /// Gets the element content that has been read sofar. When the end of the
00045     /// element is reached, this will contain all of the element content.
00046     /// 
00047     /// \return
00048     /// Returns the element content.
00049     /// 
00050     FDO_API_COMMON const FdoString* GetString()
00051     {
00052         return(mString);
00053     }
00054 
00055 protected:
00056 /// \cond DOXYGEN-IGNORE
00057     FdoXmlCharDataHandler(void);
00058     virtual ~FdoXmlCharDataHandler(void);
00059 
00060     /// Overridden Sax Callback. Receives the next chunk of element content.
00061     virtual void XmlCharacters(FdoXmlSaxContext*, FdoString *chars);
00062 /// \endcond
00063 
00064 private:
00065     /// The element content read sofar
00066     FdoStringP mString;
00067 
00068 };
00069 
00070 /// \brief
00071 /// FdoXmlCharDataHandlerP is a FdoPtr on FdoXmlCharDataHandler, provided for convenience.
00072 typedef FdoPtr<FdoXmlCharDataHandler> FdoXmlCharDataHandlerP;
00073 
00074 #endif
00075 
00076 

Comments or suggestions? Send us feedback.