0033230: Data Exchange, DE Wrapper - Update API to find CAD provider
authordpasukhi <dpasukhi@opencascade.com>
Tue, 29 Nov 2022 14:38:48 +0000 (14:38 +0000)
committersmoskvin <smoskvin@opencascade.com>
Sun, 4 Dec 2022 10:46:38 +0000 (13:46 +0300)
Moved FindProvider method to public section
Made FindProvider as virtual to make it possible to overwrite.

src/DE/DE_Wrapper.cxx
src/DE/DE_Wrapper.hxx

index 59ce5cb..33bbfc8 100644 (file)
@@ -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
 {
index b0e4471..de57c83 100644 (file)
@@ -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