Utility class providing static methods for common validation operations used across DataExchange providers. Includes validation for configuration nodes, file paths, streams, and other common scenarios with optional verbose error reporting.
More...
#include <DE_ValidationUtils.hxx>
|
| static bool | ValidateConfigurationNode (const occ::handle< DE_ConfigurationNode > &theNode, const occ::handle< Standard_Type > &theExpectedType, const TCollection_AsciiString &theContext, const bool theIsVerbose=true) |
| | Validates that configuration node is not null and matches expected type.
|
| static bool | ValidateFileForReading (const TCollection_AsciiString &thePath, const TCollection_AsciiString &theContext, const bool theIsVerbose=true) |
| | Checks if file exists and is readable.
|
| static bool | ValidateFileForWriting (const TCollection_AsciiString &thePath, const TCollection_AsciiString &theContext, const bool theIsVerbose=true) |
| | Checks if file location is writable (file may or may not exist).
|
| static bool | ValidateReadStreamList (const DE_Provider::ReadStreamList &theStreams, const TCollection_AsciiString &theContext, const bool theIsVerbose=true) |
| | Validates read stream list, warns if multiple streams.
|
| static bool | ValidateWriteStreamList (DE_Provider::WriteStreamList &theStreams, const TCollection_AsciiString &theContext, const bool theIsVerbose=true) |
| | Validates write stream list, warns if multiple streams.
|
| static bool | ValidateDocument (const occ::handle< TDocStd_Document > &theDocument, const TCollection_AsciiString &theContext, const bool theIsVerbose=true) |
| | Validates that TDocStd_Document handle is not null.
|
| static bool | WarnLengthUnitNotSupported (const double theLengthUnit, const TCollection_AsciiString &theContext, const bool theIsVerbose=true) |
| | Sends warning when format doesn't support length unit scaling.
|
| static bool | CreateContentBuffer (const TCollection_AsciiString &thePath, occ::handle< NCollection_Buffer > &theBuffer) |
| | Creates buffer by reading from file stream for content checking.
|
| static bool | CreateContentBuffer (std::istream &theStream, occ::handle< NCollection_Buffer > &theBuffer) |
| | Creates buffer by reading from input stream for content checking.
|
Utility class providing static methods for common validation operations used across DataExchange providers. Includes validation for configuration nodes, file paths, streams, and other common scenarios with optional verbose error reporting.
◆ CreateContentBuffer() [1/2]
Creates buffer by reading from file stream for content checking.
- Parameters
-
| [in] | thePath | file path for reading |
| [out] | theBuffer | output buffer with file content |
- Returns
- true if successful, false otherwise
◆ CreateContentBuffer() [2/2]
Creates buffer by reading from input stream for content checking.
- Parameters
-
| [in,out] | theStream | input stream to read from (position will be restored) |
| [out] | theBuffer | output buffer with stream content |
- Returns
- true if successful, false otherwise
◆ ValidateConfigurationNode()
Validates that configuration node is not null and matches expected type.
- Parameters
-
| [in] | theNode | configuration node to validate |
| [in] | theExpectedType | expected RTTI type |
| [in] | theContext | context string for error messages |
| [in] | theIsVerbose | if true, sends detailed error messages via Message::SendFail |
- Returns
- true if node is valid, false otherwise
◆ ValidateDocument()
Validates that TDocStd_Document handle is not null.
- Parameters
-
| [in] | theDocument | document to validate |
| [in] | theContext | context string for error messages |
| [in] | theIsVerbose | if true, sends detailed error messages via Message::SendFail |
- Returns
- true if document is not null, false otherwise
◆ ValidateFileForReading()
Checks if file exists and is readable.
- Parameters
-
| [in] | thePath | file path to check |
| [in] | theContext | context string for error messages |
| [in] | theIsVerbose | if true, sends detailed error messages via Message::SendFail |
- Returns
- true if file exists and is readable, false otherwise
◆ ValidateFileForWriting()
Checks if file location is writable (file may or may not exist).
- Parameters
-
| [in] | thePath | file path to check |
| [in] | theContext | context string for error messages |
| [in] | theIsVerbose | if true, sends detailed error messages via Message::SendFail |
- Returns
- true if location is writable, false otherwise
◆ ValidateReadStreamList()
Validates read stream list, warns if multiple streams.
- Parameters
-
| [in] | theStreams | read stream list to validate |
| [in] | theContext | context string for error messages |
| [in] | theIsVerbose | if true, sends detailed error/warning messages |
- Returns
- true if stream list is valid, false otherwise
◆ ValidateWriteStreamList()
Validates write stream list, warns if multiple streams.
- Parameters
-
| [in] | theStreams | write stream list to validate |
| [in] | theContext | context string for error messages |
| [in] | theIsVerbose | if true, sends detailed error/warning messages |
- Returns
- true if stream list is valid, false otherwise
◆ WarnLengthUnitNotSupported()
| bool DE_ValidationUtils::WarnLengthUnitNotSupported |
( |
const double | theLengthUnit, |
|
|
const TCollection_AsciiString & | theContext, |
|
|
const bool | theIsVerbose = true ) |
|
static |
Sends warning when format doesn't support length unit scaling.
- Parameters
-
| [in] | theLengthUnit | length unit value to check |
| [in] | theContext | context string for warning messages |
| [in] | theIsVerbose | if true, sends warning messages via Message::SendWarning |
- Returns
- true always (this is just a warning)
The documentation for this class was generated from the following file: