|
|
|||
Warning, file /include/opencascade/DE_ConfigurationNode.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // Copyright (c) 2022 OPEN CASCADE SAS 0002 // 0003 // This file is part of Open CASCADE Technology software library. 0004 // 0005 // This library is free software; you can redistribute it and/or modify it under 0006 // the terms of the GNU Lesser General Public License version 2.1 as published 0007 // by the Free Software Foundation, with special exception defined in the file 0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0009 // distribution for complete text of the license and disclaimer of any warranty. 0010 // 0011 // Alternatively, this file may be used under the terms of Open CASCADE 0012 // commercial license or contractual agreement. 0013 0014 #ifndef _DE_ConfigurationNode_HeaderFile 0015 #define _DE_ConfigurationNode_HeaderFile 0016 0017 #include <TColStd_ListOfAsciiString.hxx> 0018 0019 class DE_ConfigurationContext; 0020 class DE_Provider; 0021 class NCollection_Buffer; 0022 0023 //! Base class to work with CAD transfer properties. 0024 //! Stores the necessary settings for a single Provider type. 0025 //! Configures and creates special provider to transfer CAD files. 0026 //! 0027 //! Nodes are grouped by Vendor's name and Format type. 0028 //! The Vendor name is not defined by default. 0029 //! The Format type is not defined by default. 0030 //! The supported CAD extensions are not defined by default. 0031 //! The import process is not supported. 0032 //! The export process is not supported. 0033 //! 0034 //! The algorithm for standalone transfer operation: 0035 //! 1) Create new empty Node object 0036 //! 2) Configure the current Node 0037 //! 2.1) Use the external resource file to configure (::Load) 0038 //! 2.2) Change the internal parameters directly: 0039 //! 2.2.1) Change field values of "GlobalParameters" 0040 //! 2.2.2) Change field values of "InternalParameters" 0041 //! 3) Create one-time transfer provider (::BuildProvider) 0042 //! 4) Initiate the transfer process: 0043 //! 4.1) Import (if "::IsImportSupported: returns TRUE) 0044 //! 4.1.1) Validate the support of input format (::CheckContent or ::CheckExtension) 0045 //! 4.1.2) Use created provider's "::Read" method 0046 //! 4.2) Export (if "::IsExportSupported: returns TRUE) 0047 //! 4.2.1) Use created provider's "::Write" method 0048 //! 5) Check the provider's output 0049 class DE_ConfigurationNode : public Standard_Transient 0050 { 0051 DEFINE_STANDARD_RTTIEXT(DE_ConfigurationNode, Standard_Transient) 0052 public: 0053 0054 //! Initializes all field by default 0055 Standard_EXPORT DE_ConfigurationNode(); 0056 0057 //! Copies values of all fields 0058 //! @param[in] theConfigurationNode object to copy 0059 Standard_EXPORT DE_ConfigurationNode(const Handle(DE_ConfigurationNode)& theConfigurationNode); 0060 0061 //! Updates values according the resource file 0062 //! @param[in] theResourcePath file path to resource 0063 //! @return True if Load was successful 0064 Standard_EXPORT virtual bool Load(const TCollection_AsciiString& theResourcePath = ""); 0065 0066 //! Updates values according the resource 0067 //! @param[in] theResource input resource to use 0068 //! @return True if Load was successful 0069 Standard_EXPORT virtual bool Load(const Handle(DE_ConfigurationContext)& theResource) = 0; 0070 0071 //! Writes configuration to the resource file 0072 //! @param[in] theResourcePath file path to resource 0073 //! @return True if Save was successful 0074 Standard_EXPORT bool Save(const TCollection_AsciiString& theResourcePath) const; 0075 0076 //! Writes configuration to the string 0077 //! @return result resource string 0078 Standard_EXPORT virtual TCollection_AsciiString Save() const = 0; 0079 0080 //! Creates new provider for the own format 0081 //! @return new created provider 0082 Standard_EXPORT virtual Handle(DE_Provider) BuildProvider() = 0; 0083 0084 //! Copies values of all fields 0085 //! @return new object with the same field values 0086 Standard_EXPORT virtual Handle(DE_ConfigurationNode) Copy() const = 0; 0087 0088 //! Update loading status. Checking for the ability to read and write. 0089 //! @param[in] theToImport flag to updates for import. Standard_True-import, Standard_False-export 0090 //! @param[in] theToKeep flag to save update result 0091 //! @return Standard_True, if node can be used 0092 Standard_EXPORT virtual bool UpdateLoad(const Standard_Boolean theToImport, 0093 const Standard_Boolean theToKeep); 0094 0095 public: 0096 0097 //! Checks the import supporting 0098 //! @return Standard_True if import is support 0099 Standard_EXPORT virtual bool IsImportSupported() const; 0100 0101 //! Checks the export supporting 0102 //! @return Standard_True if export is support 0103 Standard_EXPORT virtual bool IsExportSupported() const; 0104 0105 //! Gets CAD format name of associated provider 0106 //! @return provider CAD format 0107 Standard_EXPORT virtual TCollection_AsciiString GetFormat() const = 0; 0108 0109 //! Gets provider's vendor name of associated provider 0110 //! @return provider's vendor name 0111 Standard_EXPORT virtual TCollection_AsciiString GetVendor() const = 0; 0112 0113 //! Gets list of supported file extensions 0114 //! @return list of extensions 0115 Standard_EXPORT virtual TColStd_ListOfAsciiString GetExtensions() const = 0; 0116 0117 //! Checks the file extension to verify a format 0118 //! @param[in] theExtension input file extension 0119 //! @return Standard_True if file is supported by a current provider 0120 Standard_EXPORT virtual bool CheckExtension(const TCollection_AsciiString& theExtension) const; 0121 0122 //! Checks the file content to verify a format 0123 //! @param[in] theBuffer read stream buffer to check content 0124 //! @return Standard_True if file is supported by a current provider 0125 Standard_EXPORT virtual bool CheckContent(const Handle(NCollection_Buffer)& theBuffer) const; 0126 0127 public: 0128 0129 //! Gets the provider loading status 0130 //! @return Standard_True if the load is correct 0131 Standard_Boolean IsEnabled() const 0132 { 0133 return myIsEnabled; 0134 } 0135 0136 //! Sets the provider loading status 0137 //! @param[in] theIsLoaded input load status 0138 void SetEnabled(const Standard_Boolean theIsLoaded) 0139 { 0140 myIsEnabled = theIsLoaded; 0141 } 0142 0143 public: 0144 0145 //!< Internal parameters for transfer process 0146 struct DE_SectionGlobal 0147 { 0148 Standard_Real LengthUnit = 1.0; //!< Scale length unit value from MM, default 1.0 (MM) 0149 } GlobalParameters; 0150 0151 private: 0152 0153 Standard_Boolean myIsEnabled; //!< Flag to use a current provider for Read or Write process via DE_Wrapper 0154 0155 }; 0156 0157 #endif // _DE_ConfigurationNode_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|