- Main Page
- Related Pages
- Modules
- Classes
- Files

# SchemaAttributeDictionary.h

Go to the documentation of this file.

    00001 #ifndef _SCHEMAATTRIBUTEDICTIONARY_H_
    00002 #define _SCHEMAATTRIBUTEDICTIONARY_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
    00021 #ifdef _WIN32
    00022 #pragma once
    00023 #endif
    00024
    00025 #include <FdoStd.h>
    00026
    00027 class FdoSchemaElement;
    00028 class FdoSchemaXmlContext;
    00029
    00030 /// \brief
    00031 /// The FdoSchemaAttributeDictionary class maintains a dictionary of named
    00032 /// attributes that provide a generic extensibility mechanism for objects
    00033 /// in the feature schema. This mechanism can be used to dynamically extend
    00034 /// schema elements in either an application- or provider-specific manner.
    00035 class FdoSchemaAttributeDictionary :
    00036     public FdoIDisposable,
    00037     public virtual FdoXmlSaxHandler
    00038 {
    00039     friend class FdoSchemaElement;
    00040
    00041 /// \cond DOXYGEN-IGNORE
    00042 protected:
    00043     FdoSchemaAttributeDictionary()
    00044     {
    00045     }
    00046     FdoSchemaAttributeDictionary(FdoSchemaElement& parent);
    00047
    00048     virtual ~FdoSchemaAttributeDictionary();
    00049
    00050     virtual void Dispose();
    00051
    00052     /// Write this SAD to XML.
    00053     virtual void _writeXml( FdoSchemaXmlContext* pContext );
    00054 /// \endcond
    00055
    00056 public:
    00057     /// \brief
    00058     /// Gets the number of attributes in the dictionary.
    00059     ///
    00060     /// \return
    00061     /// Returns the number of attributes in the dictionary
    00062     ///
    00063     FDO_API FdoInt32 GetCount();
    00064
    00065     /// \brief
    00066     /// Gets an array containing all of the attribute names in the dictionary.
    00067     ///
    00068     /// \param length
    00069     /// Output number of attribute names
    00070     ///
    00071     /// \return
    00072     /// Returns an array containing all of the attribute names in the dictionary
    00073     ///
    00074     FDO_API FdoString** GetAttributeNames(FdoInt32& length);
    00075
    00076     /// \brief
    00077     /// Gets the value of the specified attribute.
    00078     ///
    00079     /// \param name
    00080     /// Input attribute name
    00081     ///
    00082     /// \return
    00083     /// Returns the value of the specified attribute
    00084     ///
    00085     FDO_API FdoString* GetAttributeValue(FdoString* name);
    00086
    00087     /// \brief
    00088     /// Sets the value of the specified attribute.
    00089     ///
    00090     /// \param name
    00091     /// Input name
    00092     /// \param value
    00093     /// Input value
    00094     ///
    00095     /// \return
    00096     /// Returns nothing
    00097     ///
    00098     FDO_API void SetAttributeValue(FdoString* name, FdoString* value);
    00099
    00100     /// \brief
    00101     /// Returns true if the dictionary contains the specified attribute.
    00102     ///
    00103     /// \param name
    00104     /// Input attribute name
    00105     ///
    00106     /// \return
    00107     /// Returns true if the dictionary contains the specified attribute
    00108     ///
    00109     FDO_API bool ContainsAttribute(FdoString* name);
    00110
    00111     /// \brief
    00112     /// Adds the specified attribute with the specified value to the dictionary.
    00113     ///
    00114     /// \param name
    00115     /// Input name
    00116     /// \param value
    00117     /// Input value
    00118     ///
    00119     /// \return
    00120     /// Returns nothing
    00121     ///
    00122     FDO_API void Add(FdoString* name, FdoString* value);
    00123
    00124     /// \brief
    00125     /// Removes the specified attribute and its value from the dictionary.
    00126     ///
    00127     /// \param name
    00128     /// Input name
    00129     ///
    00130     /// \return
    00131     /// Returns nothing
    00132     ///
    00133     FDO_API void Remove(FdoString* name);
    00134
    00135     /// \brief
    00136     /// Clears all attributes and values from the dictionary.
    00137     ///
    00138     /// \return
    00139     /// Returns nothing
    00140     ///
    00141     FDO_API void Clear();
    00142
    00143 /// \cond DOXYGEN-IGNORE
    00144
    00145     /// Public non-API functions for XML support
    00146
    00147     /// Handle the start of a dictionary element
    00148     virtual FdoXmlSaxHandler* XmlStartElement(
    00149         FdoXmlSaxContext* context,
    00150         FdoString* uri,
    00151         FdoString* name,
    00152         FdoString* qname,
    00153         FdoXmlAttributeCollection* atts
    00154     );
    00155
    00156     /// Handle the end of a dictionary element
    00157     virtual FdoBoolean XmlEndElement(
    00158         FdoXmlSaxContext* context,
    00159         FdoString* uri,
    00160         FdoString* name,
    00161         FdoString* qname
    00162     );
    00163
    00164
    00165 private:
    00166     FdoInt32            m_alloc;
    00167     FdoInt32            m_used;
    00168     wchar_t**           m_names;
    00169     wchar_t**           m_values;
    00170     FdoSchemaElement*   m_parent;
    00171
    00172     /// SAX Handler for reading dictionary element values
    00173     FdoXmlCharDataHandlerP        m_XmlContentHandler;
    00174     /// When deserializing from XML, contains the name of the
    00175     /// current SAD item.
    00176     FdoStringP                    m_nextName;
    00177
    00178
    00179 protected:
    00180     /// FdoFeatureSchema::RejectChanges() support
    00181     virtual void    _StartChanges();
    00182     virtual void    _BeginChangeProcessing();
    00183     virtual void    _AcceptChanges();
    00184     virtual void    _RejectChanges();
    00185     virtual void    _EndChangeProcessing();
    00186     unsigned int        m_changeInfoState;
    00187     FdoInt32            m_allocCHANGED;
    00188     FdoInt32            m_usedCHANGED;
    00189     wchar_t**           m_namesCHANGED;
    00190     wchar_t**           m_valuesCHANGED;
    00191
    00192     /// States stored in the m_changeInfoState bitfield flag
    00193     static const unsigned int   CHANGEINFO_PRESENT      = 0x00000001;
    00194     static const unsigned int   CHANGEINFO_PROCESSING   = 0x00000002;
    00195     static const unsigned int   CHANGEINFO_PROCESSED    = 0x00000004;
    00196 /// \endcond
    00197 };
    00198
    00199 /// \ingroup (typedefs)
    00200 /// \brief
    00201 /// FdoSADP is a FdoPtr on FdoSchemaAttributeDictionary, provided for convenience.
    00202 typedef FdoPtr<FdoSchemaAttributeDictionary> FdoSADP;
    00203
    00204
    00205 #endif
    00206
    00207

Please send us your comment about this page