Subversion Repositories DevTools

Rev

Rev 2263 | Blame | Compare with Previous | Last modification | View Log | RSS feed

//---------------------------------------------------------------------------

#ifndef TXMLSchemaH
#define TXMLSchemaH
//---------------------------------------------------------------------------
#include <SysUtils.hpp>
#include <Controls.hpp>
#include <Classes.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>

namespace XMLSchema {
class IXmlSchemaWrapperElement;
class IXmlSchemaWrapperFactory;
class IXmlSchemaWrapperQualification;
class IXmlSchemaWrapperSchema;
}

#include <string>
#include <vector>

#include "time.h"
#include "ISerialise.h"
#include "ISchemaElement.h"
#include "FieldDatatype.h"
#include "XmlSchemaWrapper.h"

//---------------------------------------------------------------------------
class PACKAGE TXMLSchema : public TComponent
{
private:
    void __fastcall SetDLL_Location(AnsiString Value);

    // Property Attributes
        bool            m_active;
        AnsiString              m_profile;
        AnsiString              m_moduleName;
        AnsiString              m_moduleVersion;

        // XML Schema Wrapper attributes
        AnsiString                                                              m_xmlSchemaWrapperLibrary;
        HINSTANCE                                                               m_xmlSchemaWrapper;
        getXmlSchemaWrapperFactory_t                    m_getXmlSchemaWrapperFactory;
        XMLSchema::IXmlSchemaWrapperFactory *   m_xmlSchemaWrapperFactory;
        XMLSchema::IXmlSchemaWrapperSchema *    m_xmlSchema;

private:
        static AnsiString & __fastcall prependMassConfig( AnsiString & string, const AnsiString & filename );
        void __fastcall TXMLSchema::readProfile();

protected:

public:
        __fastcall TXMLSchema(TComponent* Owner);
        void __fastcall SetActive(bool Value);
        void __fastcall setProfile( const AnsiString & profile );

        bool __fastcall GetSchemas(std::vector<std::string> &schemas);
        bool __fastcall GetAttributes(const std::string& handle, std::vector<std::string> &attributes, bool specificationOnly = false);
    bool __fastcall GetAttributeProperty(const std::string &handle, const std::string &property_name, std::string &value);
        bool __fastcall Create (const char *structure_name, unsigned short version, std::string &handle, const char *qualifier);
        bool __fastcall Create (const char *schema, const char *structure_name, unsigned short version, std::string &handle, const char *qualifier);
    bool __fastcall Destroy(std::string& handle);
    bool __fastcall Copy (const std::string &src_handle, const std::string &dest_handle, const XMLSchema::XMLSchemaCopyArgs &copyargs);
    bool __fastcall Validate (const std::string &src_handle);

        bool __fastcall Deserialise(const std::string& handle, const std::string& streamtype, const std::string& stream_args, int &required_alignment, const char *buffer, unsigned int bufsize, XMLSchema::StreamCallback callbackfn = 0);
        bool __fastcall Serialise (const std::string &handle, const std::string& streamtype, const std::string& stream_args, void *&stream, unsigned int& stream_size, XMLSchema::IXmlSchemaWrapperQualification * qualifier, const char *serialise_qualifier, unsigned char required_alignment);

    bool __fastcall SetUDTArgs(const char *udtName, int argc, const char** argv);

    bool __fastcall GetAttributeValue(const std::string &handle, const std::string& attribute_path, std::string &value);
    bool __fastcall GetAttributeValue(const std::string &handle, const std::string& attribute_path, AnsiString &value);
    bool __fastcall GetAttributeValue(const std::string &handle, const std::string& attribute_path, int &value);

        bool __fastcall SetAttributeValue (const std::string &handle, const std::string& attribute_path, const char *value);
    bool __fastcall SetAttributeValue (const std::string &handle, const std::string& attribute_path, const AnsiString &value);
    bool __fastcall SetAttributeValue (const std::string &handle, const std::string& attribute_path, const int &value);
    bool __fastcall SetAttributeValue (const std::string &handle, const std::string& attribute_path, void *value, unsigned int len);

        bool __fastcall GetEnumerationValues (const std::string &handle, const char *enumeration, std::vector<std::string> &values);
        bool __fastcall GetEnumerationIdValue (const std::string &handle, const char *enumeration, const char *id, std::string &value);
    bool __fastcall AddRepeatEntry (const std::string &handle, const unsigned int entry);
    bool __fastcall RemoveRepeatEntry (const std::string &handle, const unsigned int entry);
        bool __fastcall Sort(const std::string &handle, const std::string &repeat_name, std::vector<std::string> &sort_fields );
    bool __fastcall Refresh();
        void __fastcall GetVersionInfo(AnsiString &module_name, AnsiString &module_version);

        XMLSchema::IXmlSchemaWrapperFactory * GetSchemaWrapperFactory( void );
        XMLSchema::IXmlSchemaWrapperSchema * GetSchema( void );
        XMLSchema::IXmlSchemaWrapperElement * CreateSchemaElementAccess( const std::string & handle, const std::string & attribute_path ) const;
        void DestroySchemaElementAccess( const XMLSchema::IXmlSchemaWrapperElement& instance ) const;

__published:
        __property bool Active = {read=m_active, write=SetActive, default=0};
        __property AnsiString Profile = {read=m_profile, default=0};
        __property AnsiString ModuleName = {read=m_moduleName, default=0};
        __property AnsiString ModuleVersion = {read=m_moduleVersion, default=0};
};

//---------------------------------------------------------------------------
#endif