From 6cc679d81cae13ac4af2a05125afaa0d9ee2feae Mon Sep 17 00:00:00 2001 From: dpasukhi Date: Tue, 29 Nov 2022 14:38:48 +0000 Subject: [PATCH] 0033230: Data Exchange, DE Wrapper - Update API to find CAD provider Moved FindProvider method to public section Made FindProvider as virtual to make it possible to overwrite. --- src/DE/DE_Wrapper.cxx | 20 ++++++++++---------- src/DE/DE_Wrapper.hxx | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/DE/DE_Wrapper.cxx b/src/DE/DE_Wrapper.cxx index 59ce5cb0d6..33bbfc8f9d 100644 --- a/src/DE/DE_Wrapper.cxx +++ b/src/DE/DE_Wrapper.cxx @@ -94,7 +94,7 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath, return Read(thePath, theDocument, theProgress); } Handle(DE_Provider) aProvider; - if (!findProvider(thePath, Standard_True, aProvider)) + if (!FindProvider(thePath, Standard_True, aProvider)) { return Standard_False; } @@ -119,7 +119,7 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath, return Write(thePath, theDocument, theProgress); } Handle(DE_Provider) aProvider; - if (!findProvider(thePath, Standard_False, aProvider)) + if (!FindProvider(thePath, Standard_False, aProvider)) { return Standard_False; } @@ -139,7 +139,7 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath, return Standard_False; } Handle(DE_Provider) aProvider; - if (!findProvider(thePath, Standard_True, aProvider)) + if (!FindProvider(thePath, Standard_True, aProvider)) { return Standard_False; } @@ -159,7 +159,7 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath, return Standard_False; } Handle(DE_Provider) aProvider; - if (!findProvider(thePath, Standard_False, aProvider)) + if (!FindProvider(thePath, Standard_False, aProvider)) { return Standard_False; } @@ -180,7 +180,7 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath, return Read(thePath, theShape, theProgress); } Handle(DE_Provider) aProvider; - if (!findProvider(thePath, Standard_True, aProvider)) + if (!FindProvider(thePath, Standard_True, aProvider)) { return Standard_False; } @@ -201,7 +201,7 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath, return Write(thePath, theShape, theProgress); } Handle(DE_Provider) aProvider; - if (!findProvider(thePath, Standard_False, aProvider)) + if (!FindProvider(thePath, Standard_False, aProvider)) { return Standard_False; } @@ -218,7 +218,7 @@ Standard_Boolean DE_Wrapper::Read(const TCollection_AsciiString& thePath, { Handle(DE_Provider) aProvider; - if (!findProvider(thePath, Standard_True, aProvider)) + if (!FindProvider(thePath, Standard_True, aProvider)) { return Standard_False; } @@ -234,7 +234,7 @@ Standard_Boolean DE_Wrapper::Write(const TCollection_AsciiString& thePath, const Message_ProgressRange& theProgress) { Handle(DE_Provider) aProvider; - if (!findProvider(thePath, Standard_False, aProvider)) + if (!FindProvider(thePath, Standard_False, aProvider)) { return Standard_False; } @@ -482,10 +482,10 @@ Handle(DE_Wrapper) DE_Wrapper::Copy() const } //======================================================================= -// function : findProvider +// function : FindProvider // purpose : //======================================================================= -Standard_Boolean DE_Wrapper::findProvider(const TCollection_AsciiString& thePath, +Standard_Boolean DE_Wrapper::FindProvider(const TCollection_AsciiString& thePath, const Standard_Boolean theToImport, Handle(DE_Provider)& theProvider) const { diff --git a/src/DE/DE_Wrapper.hxx b/src/DE/DE_Wrapper.hxx index b0e4471871..de57c83051 100644 --- a/src/DE/DE_Wrapper.hxx +++ b/src/DE/DE_Wrapper.hxx @@ -211,6 +211,16 @@ public: Standard_EXPORT void ChangePriority(const TColStd_ListOfAsciiString& theVendorPriority, const Standard_Boolean theToDisable = Standard_False); + //! Find available provider from the configuration. + //! If there are several providers, choose the one with the highest priority. + //! @param[in] thePath path to the CAD file + //! @param[in] theToImport flag to finds for import. Standard_True-import, Standard_False-export + //! @param[out] theProvider created new provider + //! @return Standard_True if provider found and created + Standard_EXPORT virtual Standard_Boolean FindProvider(const TCollection_AsciiString& thePath, + const Standard_Boolean theToImport, + Handle(DE_Provider)& theProvider) const; + //! Gets format map, contains vendor map with nodes //! @return internal map of formats Standard_EXPORT const DE_ConfigurationFormatMap& Nodes() const; @@ -227,16 +237,6 @@ protected: //! @param[in] theResource resource to get priority void sort(const Handle(DE_ConfigurationContext)& theResource); - //! Find available provider from the configuration. - //! If there are several providers, choose the one with the highest priority. - //! @param[in] thePath path to the CAD file - //! @param[in] theToImport flag to finds for import. Standard_True-import, Standard_False-export - //! @param[out] theProvider created new provider - //! @return Standard_True if provider found and created - Standard_Boolean findProvider(const TCollection_AsciiString& thePath, - const Standard_Boolean theToImport, - Handle(DE_Provider)& theProvider) const; - public: DE_ConfigurationNode::DE_SectionGlobal GlobalParameters; //!< Internal parameters for the all translators