FDO API Reference Feature Data Objects

Attribute.h

Go to the documentation of this file.
00001 #ifndef FDO_XML_ATTRIBUTE_H
00002 #define FDO_XML_ATTRIBUTE_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 /// FdoXmlAttribute contains the name and value of a single attribute
00026 /// from an XML document.
00027 class FdoXmlAttribute : public FdoDictionaryElement
00028 {
00029 public:
00030     /// \brief
00031     /// Constructs an XML Attribute object
00032     /// 
00033     /// \param name 
00034     /// Input unique attribute name. If the attribute name is namespace qualified
00035     /// the name is {uri}:{localName}. Otherwise, it is {localName}
00036     /// \param value 
00037     /// Input attribute value.
00038     /// \param localName 
00039     /// Input attribute name without namespace qualification.
00040     /// \param uri 
00041     /// Input uri for the attribute namespace. L"" if the attribute
00042     /// name is not namespace qualified.
00043     /// \param prefix 
00044     /// Input prefix for the attribute namespace. L"" if the attribute
00045     /// name is not namespace qualified.
00046     /// \param valueUri 
00047     /// Input uri for the attribute value's namespace. L"" if the attribute
00048     /// value is not namespace qualified.
00049     /// \param localValue 
00050     /// Input attribute value without namespace qualification.
00051     /// \param valuePrefix 
00052     /// Input prefix for the attribute value's namespace. L"" if the attribute
00053     /// value is not namespace qualified.
00054     /// 
00055     /// \return
00056     /// Returns FdoXmlAttribute
00057     /// 
00058     FDO_API_COMMON static FdoXmlAttribute* Create(
00059         FdoString* name, 
00060         FdoString* value, 
00061         FdoString* localName = NULL,
00062         FdoString* uri = NULL,
00063         FdoString* prefix = NULL,
00064         FdoString* valueUri = NULL,
00065         FdoString* localValue = NULL,
00066         FdoString* valuePrefix = NULL
00067     );
00068 
00069     /// \brief
00070     /// Gets the attribute's local name.
00071     /// 
00072     /// \return
00073     /// Returns FdoStringP. Same value is GetName() when attribute name not
00074     /// qualified by namespace
00075     /// 
00076     FdoStringP GetLocalName()
00077     {
00078         return mLocalName;
00079     }
00080 
00081     /// \brief
00082     /// Gets the attribute's namespace URI.
00083     /// 
00084     /// \return
00085     /// Returns FdoStringP. L"" when attribute name not
00086     /// qualified by namespace
00087     /// 
00088     FdoStringP GetUri()
00089     {
00090         return mUri;
00091     }
00092 
00093     /// \brief
00094     /// Gets the attribute's namespace prefix.
00095     /// 
00096     /// \return
00097     /// Returns FdoStringP. L"" when attribute name not
00098     /// qualified by namespace
00099     /// 
00100     FdoStringP GetPrefix()
00101     {
00102         return mPrefix;
00103     }
00104 
00105     /// \brief
00106     /// Gets the attribute value's namespace URI.
00107     /// 
00108     /// \return
00109     /// Returns FdoStringP. L"" when attribute value not
00110     /// qualified by namespace
00111     /// 
00112     FdoStringP GetValueUri()
00113     {
00114         return mValueUri;
00115     }
00116 
00117     /// \brief
00118     /// Gets the attribute's local value.
00119     /// 
00120     /// \return
00121     /// Returns FdoStringP. Same value is GetValue() when attribute value is not
00122     /// qualified by namespace
00123     /// 
00124     FdoStringP GetLocalValue()
00125     {
00126         return mLocalValue;
00127     }
00128 
00129     /// \brief
00130     /// Gets the attribute value's namespace prefix.
00131     /// 
00132     /// \return
00133     /// Returns FdoStringP. L"" when attribute value is not
00134     /// qualified by namespace
00135     /// 
00136     FdoStringP GetValuePrefix()
00137     {
00138         return mValuePrefix;
00139     }
00140 
00141     /// \brief
00142     /// Gets the attribute's qualified name.
00143     /// 
00144     /// \return
00145     /// Returns {prefix}:{localName} when attribute name is qualified by namespace.
00146     /// Otherwise, returns the same value as GetLocalName().
00147     /// 
00148     FdoStringP GetQName()
00149     {
00150         return mPrefix.GetLength() > 0 ?
00151                     mPrefix + L":" + mLocalName :
00152                     mLocalName;
00153     }
00154 
00155 protected:
00156 /// \cond DOXYGEN-IGNORE
00157     FdoXmlAttribute()
00158         : FdoDictionaryElement()
00159     {
00160     }
00161 
00162     FdoXmlAttribute(
00163         FdoString* name, 
00164         FdoString* value, 
00165         FdoString* localName,
00166         FdoString* uri,
00167         FdoString* prefix,
00168         FdoString* valueUri,
00169         FdoString* localValue,
00170         FdoString* valuePrefix
00171     );
00172 
00173 /// \endcond
00174 
00175 private:
00176     FdoStringP mLocalName;
00177     FdoStringP mUri;
00178     FdoStringP mPrefix;
00179     FdoStringP mValueUri;
00180     FdoStringP mLocalValue;
00181     FdoStringP mValuePrefix;
00182 };
00183 
00184 /// \brief
00185 /// FdoXmlAttributeP is a FdoPtr on FdoXmlAttribute, provided for convenience.
00186 typedef FdoPtr<FdoXmlAttribute> FdoXmlAttributeP;
00187 
00188 #endif
00189 
00190 

Comments or suggestions? Send us feedback.