Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Static Public Member Functions
DE_ValidationUtils Class Reference

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 Public Member Functions

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.
 

Detailed Description

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.

Member Function Documentation

◆ CreateContentBuffer() [1/2]

static bool DE_ValidationUtils::CreateContentBuffer ( const TCollection_AsciiString & thePath,
occ::handle< NCollection_Buffer > & theBuffer )
static

Creates buffer by reading from file stream for content checking.

Parameters
[in]thePathfile path for reading
[out]theBufferoutput buffer with file content
Returns
true if successful, false otherwise

◆ CreateContentBuffer() [2/2]

static bool DE_ValidationUtils::CreateContentBuffer ( std::istream & theStream,
occ::handle< NCollection_Buffer > & theBuffer )
static

Creates buffer by reading from input stream for content checking.

Parameters
[in,out]theStreaminput stream to read from (position will be restored)
[out]theBufferoutput buffer with stream content
Returns
true if successful, false otherwise

◆ ValidateConfigurationNode()

static bool DE_ValidationUtils::ValidateConfigurationNode ( const occ::handle< DE_ConfigurationNode > & theNode,
const occ::handle< Standard_Type > & theExpectedType,
const TCollection_AsciiString & theContext,
const bool theIsVerbose = true )
static

Validates that configuration node is not null and matches expected type.

Parameters
[in]theNodeconfiguration node to validate
[in]theExpectedTypeexpected RTTI type
[in]theContextcontext string for error messages
[in]theIsVerboseif true, sends detailed error messages via Message::SendFail
Returns
true if node is valid, false otherwise

◆ ValidateDocument()

static bool DE_ValidationUtils::ValidateDocument ( const occ::handle< TDocStd_Document > & theDocument,
const TCollection_AsciiString & theContext,
const bool theIsVerbose = true )
static

Validates that TDocStd_Document handle is not null.

Parameters
[in]theDocumentdocument to validate
[in]theContextcontext string for error messages
[in]theIsVerboseif true, sends detailed error messages via Message::SendFail
Returns
true if document is not null, false otherwise

◆ ValidateFileForReading()

static bool DE_ValidationUtils::ValidateFileForReading ( const TCollection_AsciiString & thePath,
const TCollection_AsciiString & theContext,
const bool theIsVerbose = true )
static

Checks if file exists and is readable.

Parameters
[in]thePathfile path to check
[in]theContextcontext string for error messages
[in]theIsVerboseif true, sends detailed error messages via Message::SendFail
Returns
true if file exists and is readable, false otherwise

◆ ValidateFileForWriting()

static bool DE_ValidationUtils::ValidateFileForWriting ( const TCollection_AsciiString & thePath,
const TCollection_AsciiString & theContext,
const bool theIsVerbose = true )
static

Checks if file location is writable (file may or may not exist)

Parameters
[in]thePathfile path to check
[in]theContextcontext string for error messages
[in]theIsVerboseif true, sends detailed error messages via Message::SendFail
Returns
true if location is writable, false otherwise

◆ ValidateReadStreamList()

static bool DE_ValidationUtils::ValidateReadStreamList ( const DE_Provider::ReadStreamList & theStreams,
const TCollection_AsciiString & theContext,
const bool theIsVerbose = true )
static

Validates read stream list, warns if multiple streams.

Parameters
[in]theStreamsread stream list to validate
[in]theContextcontext string for error messages
[in]theIsVerboseif true, sends detailed error/warning messages
Returns
true if stream list is valid, false otherwise

◆ ValidateWriteStreamList()

static bool DE_ValidationUtils::ValidateWriteStreamList ( DE_Provider::WriteStreamList & theStreams,
const TCollection_AsciiString & theContext,
const bool theIsVerbose = true )
static

Validates write stream list, warns if multiple streams.

Parameters
[in]theStreamswrite stream list to validate
[in]theContextcontext string for error messages
[in]theIsVerboseif true, sends detailed error/warning messages
Returns
true if stream list is valid, false otherwise

◆ WarnLengthUnitNotSupported()

static 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]theLengthUnitlength unit value to check
[in]theContextcontext string for warning messages
[in]theIsVerboseif 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: