Rhino C++ API  7.21
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
ON_CheckSum Class Reference

#include <opennurbs_string.h>

Public Member Functions

 ON_CheckSum ()
 
 ~ON_CheckSum ()
 
bool CheckBuffer (size_t size, const void *buffer) const
 
bool CheckFile (const wchar_t *filename, bool bSkipTimeCheck=false) const
 
bool CheckFile (FILE *fp, bool bSkipTimeCheck=false) const
 
void Dump (class ON_TextLog &) const
 
bool IsSet () const
 
bool Read (class ON_BinaryArchive &)
 
bool SetBufferCheckSum (size_t size, const void *buffer, time_t time)
 
bool SetFileCheckSum (const wchar_t *filename)
 
bool SetFileCheckSum (FILE *fp)
 
bool Write (class ON_BinaryArchive &) const
 
void Zero ()
 zeros all fields. More...
 

Public Attributes

ON__UINT32 m_crc [8]
 crc's More...
 
size_t m_size
 bytes in the file. More...
 
time_t m_time
 last modified time in seconds since Jan 1, 1970, UCT More...
 

Static Public Attributes

static const ON_CheckSum UnsetCheckSum
 

Detailed Description

This class is intended to be used to determine if a file's contents have changed.

Constructor & Destructor Documentation

◆ ON_CheckSum()

ON_CheckSum::ON_CheckSum ( )

◆ ~ON_CheckSum()

ON_CheckSum::~ON_CheckSum ( )

Member Function Documentation

◆ CheckBuffer()

bool ON_CheckSum::CheckBuffer ( size_t  size,
const void *  buffer 
) const

Description: Test buffer to see if it has a matching checksum. Paramters: size - [in] size in bytes buffer - [in] Returns: True if the buffer has a matching checksum.

◆ CheckFile() [1/2]

bool ON_CheckSum::CheckFile ( const wchar_t *  filename,
bool  bSkipTimeCheck = false 
) const

Description: Test buffer to see if it has a matching checksum. Paramters: filename - [in] bSkipTimeCheck - [in] if true, the time of last modification is not checked. Returns: True if the file has a matching checksum.

◆ CheckFile() [2/2]

bool ON_CheckSum::CheckFile ( FILE *  fp,
bool  bSkipTimeCheck = false 
) const

Description: Test buffer to see if it has a matching checksum. Paramters: fp - [in] pointer to file opened with ON::OpenFile(...,"rb") bSkipTimeCheck - [in] if true, the time of last modification is not checked. Returns: True if the file has a matching checksum.

◆ Dump()

void ON_CheckSum::Dump ( class ON_TextLog ) const

◆ IsSet()

bool ON_CheckSum::IsSet ( ) const

Returns: True if checksum is set.

◆ Read()

bool ON_CheckSum::Read ( class ON_BinaryArchive )

◆ SetBufferCheckSum()

bool ON_CheckSum::SetBufferCheckSum ( size_t  size,
const void *  buffer,
time_t  time 
)

C++ default operator=, operator==, and copy constructor work fine. Descripton: Set check sum values for a buffer Parameters: size - [in] number of bytes in buffer buffer - [in]
time - [in] last modified time in seconds since Jan 1, 1970, UCT Returns: True if checksum is set.

◆ SetFileCheckSum() [1/2]

bool ON_CheckSum::SetFileCheckSum ( const wchar_t *  filename)

Descripton: Set check sum values for a file. Parameters: filename - [in] name of file. Returns: True if checksum is set.

◆ SetFileCheckSum() [2/2]

bool ON_CheckSum::SetFileCheckSum ( FILE *  fp)

Descripton: Set check sum values for a file. Parameters: fp - [in] pointer to a file opened with ON:FileOpen(...,"rb") Returns: True if checksum is set.

◆ Write()

bool ON_CheckSum::Write ( class ON_BinaryArchive ) const

◆ Zero()

void ON_CheckSum::Zero ( )

zeros all fields.

Member Data Documentation

◆ m_crc

ON__UINT32 ON_CheckSum::m_crc[8]

crc's

◆ m_size

size_t ON_CheckSum::m_size

bytes in the file.

◆ m_time

time_t ON_CheckSum::m_time

last modified time in seconds since Jan 1, 1970, UCT

◆ UnsetCheckSum

const ON_CheckSum ON_CheckSum::UnsetCheckSum
static