00001 // 00002 // Copyright (C) 2007 Refractions Research, Inc. 00003 // 00004 // This library is free software; you can redistribute it and/or 00005 // modify it under the terms of version 2.1 of the GNU Lesser 00006 // General Public License as published by the Free Software Foundation. 00007 // 00008 // This library is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 // Lesser General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU Lesser General Public 00014 // License along with this library; if not, write to the Free Software 00015 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00016 // 00017 #ifndef FDOPOSTGIS_CLASSDEFINITION_H_INCLUDED 00018 #define FDOPOSTGIS_CLASSDEFINITION_H_INCLUDED 00019 00020 #include "PropertyDefinitionCollection.h" 00021 00022 namespace fdo { namespace postgis { namespace ov { 00023 00024 /// \todo To be documented 00025 class ClassDefinition : public FdoPhysicalClassMapping 00026 { 00027 public: 00028 00029 /// Type of FDO smart pointer for the class. 00030 typedef FdoPtr<ClassDefinition> Ptr; 00031 00032 // 00033 // FdoPhysicalClassMapping interface 00034 // 00035 FDOPOSTGIS_API static ClassDefinition* Create(); 00036 00037 FDOPOSTGIS_API PropertyDefinitionCollection* GetProperties() const; 00038 00039 // 00040 // FdoPhysicalElementMapping interface 00041 // 00042 00043 /// Initializes this class from its XML attributes. 00044 FDOPOSTGIS_API virtual void InitFromXml(FdoXmlSaxContext* xmlContext, 00045 FdoXmlAttributeCollection* xmlAttrs); 00046 00047 /// Writes this class to XML. 00048 FDOPOSTGIS_API virtual void _writeXml(FdoXmlWriter* xmlWriter, 00049 FdoXmlFlags const* xmlFlags); 00050 00051 // 00052 // FdoXmlSaxHandler interface 00053 // 00054 00055 /// SAX callback called when the FdoXmlReader reads the start tag for 00056 /// an XML element in the document. 00057 FDOPOSTGIS_API virtual FdoXmlSaxHandler* XmlStartElement(FdoXmlSaxContext *saxContext, 00058 FdoString* uri, FdoString* name, FdoString* qname, 00059 FdoXmlAttributeCollection* xmlAtts); 00060 00061 /// SAX callback called when the FdoXmlReader reads the end tag for 00062 /// an XML element in the document. 00063 FDOPOSTGIS_API virtual FdoBoolean XmlEndElement(FdoXmlSaxContext* saxContext, 00064 FdoString* uri, FdoString* name, FdoString* qname); 00065 00066 // 00067 // ClassDefinition custom interface 00068 // 00069 00070 /// Set schema name (physical schame of postgres). 00071 FDOPOSTGIS_API void SetSchemaName(FdoString* value); 00072 00073 /// Get name of schema (FDO datastore). 00074 /// The name is NOT wrapped with quotes here. 00075 FDOPOSTGIS_API FdoStringP GetSchemaName() const; 00076 00077 /// Get name of table. 00078 /// The name is NOT wrapped with quotes here. 00079 FDOPOSTGIS_API FdoStringP GetTableName() const; 00080 00081 /// Get fully qualified table path in following format "schema"."table" . 00082 /// Both names are wrapped with double quotes automatically 00083 /// according to the <strong>always quote</strong> strategy. 00084 /// 00085 /// \return String with full path of table. 00086 /// 00087 /// For more details about quoting SQL identifiers in PostgreSQL database, 00088 /// see following chapter from the manual: 00089 /// <a href="http://www.postgresql.org/docs/8.2/interactive/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS">4.1.1. Identifiers and Key Words</a>. 00090 /// 00091 FDOPOSTGIS_API FdoStringP GetTablePath() const; 00092 00093 protected: 00094 00095 /// Default constructor. 00096 ClassDefinition(); 00097 00098 /// Destructor. 00099 virtual ~ClassDefinition(); 00100 00101 // 00102 // FdoIDisposable 00103 // 00104 00105 void Dispose(); 00106 00107 private: 00108 00109 typedef FdoPhysicalClassMapping BaseType; 00110 00111 /// The schema of this element 00112 FdoStringP m_schema; 00113 00114 PropertyDefinitionCollection::Ptr mProperties; 00115 }; 00116 00117 }}} // namespace fdo::postgis::ov 00118 00119 #endif // FDOPOSTGIS_CLASSDEFINITION_H_INCLUDED