FDO API Reference Feature Data Objects

FeaturePropertyWriter.h

Go to the documentation of this file.
00001 #ifndef FDO_XML_FEATUREPROPERTYWRITER_H_
00002 #define FDO_XML_FEATUREPROPERTYWRITER_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 /// \brief
00028 /// FdoXmlFeaturePropertyWriter writes features in GML format. It is similar to 
00029 /// FdoXmlFeatureWriter, except that it provides better performance. However, the 
00030 /// caller is responsible for ensuring that properties are written in proper order. 
00031 class FdoXmlFeaturePropertyWriter : public FdoIDisposable
00032 {
00033 public:
00034     /// \brief
00035     /// Creates a Feature Property Writer for writing FDO features to XML.
00036     /// 
00037     /// \param writer 
00038     /// Input XML document writer. Specifies the XML document that the features will be
00039     /// written to.
00040     /// \param flags 
00041     /// Input options for controlling the writing of the features. If NULL then the 
00042     /// default flags are used.
00043     /// 
00044     /// \return
00045     /// Returns FdoXmlFeaturePropertyWriter
00046     /// 
00047     FDO_API static FdoXmlFeaturePropertyWriter * Create( 
00048         FdoXmlWriter*               writer,
00049         FdoXmlFlags*                flags = NULL
00050     );
00051 
00052     /// \brief
00053     /// Gets the underlying XML writer.
00054     /// 
00055     /// \return
00056     /// Returns the underlying XML writer.
00057     /// 
00058     FDO_API FdoXmlWriter* GetXmlWriter();
00059 
00060     /// \brief
00061     /// Gets the class definition for the current feature being written.
00062     /// 
00063     /// \return
00064     /// Returns FdoClassDefinition
00065     /// 
00066     FDO_API FdoClassDefinition* GetClassDefinition();
00067 
00068     /// \brief
00069     /// Sets the class definition for the current feature being written.
00070     /// 
00071     /// \param classDefinition 
00072     /// Input the class definition
00073     /// 
00074     /// \return
00075     /// Returns nothing
00076     /// 
00077     FDO_API void SetClassDefinition(FdoClassDefinition* classDefinition);
00078 
00079     /// \brief
00080     /// Writes the start of a feature to XML. The start tags for the feature member 
00081     /// element and the feature's actual element are written. The feature element name
00082     /// is derived from the feature's class and schema names.
00083     /// 
00084     /// \param stargTag 
00085     /// The start tag for the feature element. If it is null, the
00086     /// feature's class name used.
00087     /// 
00088     /// \return
00089     /// Returns nothing
00090     /// 
00091     FDO_API void WriteFeatureStart(FdoString* startTag);
00092 
00093     /// \brief
00094     /// Closes the current feature by writing the feature element and feature member 
00095     /// element end tags.
00096     /// 
00097     /// \return
00098     /// Returns nothing
00099     /// 
00100     FDO_API void WriteFeatureEnd();
00101 
00102     /// \brief
00103     /// Writes a feature property to XML.
00104     /// 
00105     /// \param value 
00106     /// Input the property name
00107     /// \param value 
00108     /// Input the property value as an FDO property
00109     /// \param valueOnly 
00110     /// false: wrap the property value in a property element
00111     /// true: just write the property value
00112     /// 
00113     /// \return
00114     /// Returns nothing
00115     /// 
00116     FDO_API void WriteProperty( FdoString* name, FdoPropertyValue* value, FdoBoolean valueOnly = false );
00117 
00118     /// \brief
00119     /// Writes a feature property to XML.
00120     /// 
00121     /// \param value 
00122     /// Input the property name
00123     /// \param value 
00124     /// Input the property value as a string
00125     /// \param valueOnly 
00126     /// false: wrap the property value in a property element
00127     /// true: just write the property value
00128     /// 
00129 /// \return
00130 /// Returns nothing
00131     FDO_API void WriteProperty(FdoString* name, FdoString* value, FdoBoolean valueOnly = false );
00132 
00133 //TBD: do we need functions for other basic types or make the caller do the
00134 //conversion to string. 
00135 
00136     /// \brief
00137     /// Writes a raster property to XML.
00138     /// 
00139     /// \param value 
00140     /// Input the property name
00141     /// \param value 
00142     /// Input the raster property value
00143     /// \param valueOnly 
00144     /// false: wrap the property value in a property element
00145     /// true: just write the property value
00146     /// 
00147     /// \return
00148     /// Returns nothing
00149     /// 
00150     FDO_API void WriteProperty(FdoString* name, FdoIRaster* value, FdoBoolean valueOnly = false );
00151 
00152     /// \brief
00153     /// Writes a lob property to XML.
00154     /// 
00155     /// \param value 
00156     /// Input the property name
00157     /// \param value 
00158     /// Input the lob property value
00159     /// \param valueOnly 
00160     /// false: wrap the property value in a property element
00161     /// true: just write the property value
00162     /// 
00163     /// \return
00164     /// Returns nothing
00165     /// 
00166     FDO_API void WriteProperty(FdoString* name, FdoLOBValue* value, FdoBoolean valueOnly = false );
00167 
00168     /// \brief
00169     /// Writes a LOB feature property from a stream reader to XML.
00170     /// 
00171     /// \param name 
00172     /// Input the property name
00173     /// \param lobReader 
00174     /// Input the reader for retrieving the lob
00175     /// \param valueOnly 
00176     /// false: wrap the property value in a property element
00177     /// true: just write the property value
00178     /// 
00179     /// \return
00180     /// Returns nothing
00181     /// 
00182     FDO_API void WriteProperty(FdoString* name, FdoIStreamReader* lobReader, FdoBoolean valueOnly = false );
00183 
00184     /// \brief
00185     /// Writes a geometric property to XML.
00186     /// 
00187     /// \param name 
00188     /// Input the property name
00189     /// \param value 
00190     /// Input the property value as an array of bytes
00191     /// \param count 
00192     /// Input the number of bytes in the byte array
00193     /// \param valueOnly 
00194     /// false: wrap the property value in a property element
00195     /// true: just write the property value
00196     /// 
00197     /// \return
00198     /// Returns nothing
00199     /// 
00200     FDO_API void WriteGeometricProperty(
00201         FdoString* name, 
00202         FdoByte* value, 
00203         FdoInt32 count, 
00204         FdoBoolean valueOnly = false 
00205     );
00206 
00207     /// \brief
00208     /// Writes start tag for an object property. The object property sub-properties
00209     /// can be written by subsequent calls to this class's Write functions.
00210     /// 
00211     /// \param name 
00212     /// Input the object property name
00213     /// 
00214     /// \return
00215     /// Returns nothing
00216     /// 
00217     FDO_API void WriteObjectPropertyStart(FdoString* name);
00218 
00219     /// \brief
00220     /// Closes the current object property by writing its end tag.
00221     /// 
00222     /// \return
00223     /// Returns nothing
00224     /// 
00225     FDO_API void WriteObjectPropertyEnd();
00226 
00227 
00228 protected:
00229     FdoXmlFeaturePropertyWriter();
00230     FdoXmlFeaturePropertyWriter(FdoXmlWriter* writer, FdoXmlFlags* flags);
00231     virtual ~FdoXmlFeaturePropertyWriter();
00232     virtual void Dispose();
00233 
00234 private:
00235     FdoPtr<FdoXmlWriter> m_writer;
00236     FdoPtr<FdoXmlFlags> m_flags;
00237     FdoPtr<FdoClassDefinition> m_classDef;
00238 
00239 
00240 };
00241 
00242 /// \brief
00243 /// FdoXmlFeaturePropertyReaderP is a FdoPtr on FdoXmlFeaturePropertyReader, provided for convenience.
00244 typedef FdoPtr<FdoXmlFeaturePropertyWriter> FdoXmlFeaturePropertyWriterP;
00245 
00246 
00247 #endif
00248 
00249 

Comments or suggestions? Send us feedback.