FDO API Reference Feature Data Objects

NameCollectionHandler.h

Go to the documentation of this file.
00001 #ifndef FDO_XML_NAMECOLLECTIONHANDLER_H
00002 #define FDO_XML_NAMECOLLECTIONHANDLER_H
00003 
00004 // 
00005 //  Copyright (C) 2004-2006  Autodesk, Inc.
00006 //  
00007 //  This library is free software; you can redistribute it and/or
00008 //  modify it under the terms of version 2.1 of the GNU Lesser
00009 //  General Public License as published by the Free Software Foundation.
00010 //  
00011 //  This library is distributed in the hope that it will be useful,
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 //  Lesser General Public License for more details.
00015 //  
00016 //  You should have received a copy of the GNU Lesser General Public
00017 //  License along with this library; if not, write to the Free Software
00018 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019 
00020 #include <FdoStd.h>
00021 #include <FdoCommon.h>
00022 
00023 class FdoXmlFlags;
00024 
00025 /// \brief
00026 /// FdoXmlNameCollectionHandler is a class for serializing and 
00027 /// deserializing fdo:NameCollectionType elements.
00028 class FdoXmlNameCollectionHandler :
00029     public FdoDisposable,
00030     public FdoXmlSaxHandler
00031 {
00032 public:
00033     /// \brief
00034     /// Constructs an Fdo XML Name Collection Handler.
00035     /// 
00036     /// \param pNames 
00037     /// Input the collection of names. Any names deserialized
00038     /// will be added to this collection. If NULL then an internal empty
00039     /// name collection is created.
00040     /// 
00041     /// \return
00042     /// Returns FdoXmlNameCollectionHandler
00043     /// 
00044     FDO_API static FdoXmlNameCollectionHandler* Create(FdoStringCollection* pNames = NULL);
00045 
00046     /// \brief
00047     /// Gets the collection of names
00048     /// 
00049     /// \return
00050     /// Returns the element content.
00051     /// 
00052     FDO_API FdoStringCollection* GetNames();
00053 
00054     /// XML Serialization functions, not part of supported API.
00055 
00056     /// _writeXml serializes each name in the collection as a 
00057     /// [Name] element.
00058     virtual void _writeXml(FdoXmlWriter* xmlWriter, const FdoXmlFlags* flags);
00059 
00060     virtual FdoXmlSaxHandler* XmlStartElement(
00061         FdoXmlSaxContext* context, 
00062         FdoString* uri, 
00063         FdoString* name, 
00064         FdoString* qname, 
00065         FdoXmlAttributeCollection* atts
00066     );
00067 
00068     virtual FdoBoolean XmlEndElement(
00069         FdoXmlSaxContext* context, 
00070         FdoString* uri, 
00071         FdoString* name, 
00072         FdoString* qname
00073     );
00074 
00075 protected:
00076     FdoXmlNameCollectionHandler();
00077     FdoXmlNameCollectionHandler(FdoStringCollection* pNames);
00078     virtual ~FdoXmlNameCollectionHandler(void);
00079 
00080 private:
00081     /// The names in the name collection
00082     FdoStringsP                 mNames;
00083 
00084     /// SAX Handler for deserializing a single name.
00085     FdoXmlCharDataHandlerP      mNameHandler;
00086     /// SAX Handler for skipping elements
00087     FdoXmlSkipElementHandlerP   mXmlSkipper;
00088 };
00089 
00090 /// \brief
00091 /// FdoXmlNameCollectionHandlerP is a FdoPtr on FdoXmlNameCollectionHandler, provided for convenience.
00092 typedef FdoPtr<FdoXmlNameCollectionHandler> FdoXmlNameCollectionHandlerP;
00093 
00094 #endif
00095 
00096 

Comments or suggestions? Send us feedback.