Rhino C++ API  8.14
Static Public Member Functions | List of all members
ON_FileStream Class Reference

#include <opennurbs_file_utilities.h>

Static Public Member Functions

static int Close (FILE *fp)
 
static ON__INT64 CurrentPosition (FILE *fp)
 
static bool Flush (FILE *fp)
 
static bool GetFileInformation (const char *file_name, ON__UINT64 *file_size, ON__UINT64 *file_metadata_last_modified_time, ON__UINT64 *file_contents_last_modified_time)
 
static bool GetFileInformation (const wchar_t *file_name, ON__UINT64 *file_size, ON__UINT64 *file_metadata_last_modified_time, ON__UINT64 *file_contents_last_modified_time)
 
static bool GetFileInformation (FILE *fp, ON__UINT64 *file_size, ON__UINT64 *file_metadata_last_modified_time, ON__UINT64 *file_contents_last_modified_time)
 
static bool Is3dmFile (const char *file_path, bool bAllow3dmbakExtension)
 
static bool Is3dmFile (const wchar_t *file_path, bool bAllow3dmbakExtension)
 
static FILE * Open (const char *filename, const char *mode)
 
static FILE * Open (const wchar_t *filename, const wchar_t *mode)
 
static FILE * Open3dmToRead (const char *file_path)
 
static FILE * Open3dmToRead (const wchar_t *file_path)
 
static ON__UINT64 Read (FILE *fp, ON__UINT64 count, void *buffer)
 
static bool Seek (FILE *fp, ON__INT64 offset, int orgin)
 
static bool SeekFromCurrentPosition (FILE *fp, ON__INT64 offset)
 
static bool SeekFromEnd (FILE *fp, ON__INT64 offset)
 
static bool SeekFromStart (FILE *fp, ON__INT64 offset)
 
static ON__UINT64 Write (FILE *fp, ON__UINT64 count, const void *buffer)
 

Member Function Documentation

◆ Close()

static int ON_FileStream::Close ( FILE *  fp)
static

Description: Portable wrapper for C runtime fclose(). Parameters: fp - [in] FILE pointer returned by ON_FileStream::Open(). Returns: 0: successful -1: null fp parameter != 0: fclose() failure code

◆ CurrentPosition()

static ON__INT64 ON_FileStream::CurrentPosition ( FILE *  fp)
static

Description: Portable wrapper for C runtime ftell(). Parameters: fp - [in] FILE pointer returned by ON_FileStream::Open(). Returns: >= 0: current file position -1: an error occurred

◆ Flush()

static bool ON_FileStream::Flush ( FILE *  fp)
static

Description: Portable wrapper for C runtime fflush(fp). Parameters: fp - [in] FILE pointer returned by ON_FileStream::Open(). Returns: true if flush was successful. False if an error occurred.

◆ GetFileInformation() [1/3]

static bool ON_FileStream::GetFileInformation ( const char *  file_name,
ON__UINT64 file_size,
ON__UINT64 file_metadata_last_modified_time,
ON__UINT64 file_contents_last_modified_time 
)
static

◆ GetFileInformation() [2/3]

static bool ON_FileStream::GetFileInformation ( const wchar_t *  file_name,
ON__UINT64 file_size,
ON__UINT64 file_metadata_last_modified_time,
ON__UINT64 file_contents_last_modified_time 
)
static

◆ GetFileInformation() [3/3]

static bool ON_FileStream::GetFileInformation ( FILE *  fp,
ON__UINT64 file_size,
ON__UINT64 file_metadata_last_modified_time,
ON__UINT64 file_contents_last_modified_time 
)
static

Description: Portable wrapper for C runtime fstat(). Parameters: fp - [in] FILE pointer returned by ON_FileStream::Open(). file_size - [out] If file_size is not null, the the size of the file in bytes returned here file_metadata_last_modified_time - [out] If file_metadata_last_modified_time is not null, then the time the file's metadata (owner, permissions, ...) were last modified is returned here as the number of seconds since midnight January 1, 1970. file_contents_last_modified_time - [out] If file_contents_last_modified_time is not null, then the time the file's contents were last modified is returned here as the number of seconds since midnight January 1, 1970. Returns: true if the query was successful. False if an error occurred.

◆ Is3dmFile() [1/2]

static bool ON_FileStream::Is3dmFile ( const char *  file_path,
bool  bAllow3dmbakExtension 
)
static

Returns: True if the file is a 3dm archive.

◆ Is3dmFile() [2/2]

static bool ON_FileStream::Is3dmFile ( const wchar_t *  file_path,
bool  bAllow3dmbakExtension 
)
static

Returns: True if the file is a 3dm archive.

◆ Open() [1/2]

static FILE* ON_FileStream::Open ( const char *  filename,
const char *  mode 
)
static

Description: Portable wrapper for C runtime fopen(). Parameters: filename - [in] mode - [in] Remarks: Use the ON_FileStream static functions for reading, writing, seeking, position finding with the FILE pointer returned by this function.

◆ Open() [2/2]

static FILE* ON_FileStream::Open ( const wchar_t *  filename,
const wchar_t *  mode 
)
static

Description: Portable wrapper for C runtime fopen(). Parameters: filename - [in] mode - [in] Remarks: Use the ON_FileStream static functions for reading, writing, seeking, position finding with the FILE pointer returned by this function.

◆ Open3dmToRead() [1/2]

static FILE* ON_FileStream::Open3dmToRead ( const char *  file_path)
static

Description: Open the file and seek to the location where the 3dm archive information begins. Returns: A file stream with the current position at the beginning of the 3dm archive. nullptr if the file is not a 3dm archive.

◆ Open3dmToRead() [2/2]

static FILE* ON_FileStream::Open3dmToRead ( const wchar_t *  file_path)
static

Description: Open the file and seek to the location where the 3dm archive information begins. Returns: A file stream with the current position at the beginning of the 3dm archive. nullptr if the file is not a 3dm archive.

◆ Read()

static ON__UINT64 ON_FileStream::Read ( FILE *  fp,
ON__UINT64  count,
void *  buffer 
)
static

Description: Portable wrapper for C runtime fread(buffer,1,count,fp). Parameters: fp - [in] FILE pointer returned by ON_FileStream::Open() count - [in] number of bytes to read. buffer - [out] read bytes are stored in this buffer Returns: number of bytes read

◆ Seek()

static bool ON_FileStream::Seek ( FILE *  fp,
ON__INT64  offset,
int  orgin 
)
static

Description: Portable wrapper for C runtime fseek(fp,offset,origin). Parameters: fp - [in] FILE pointer returned by ON_FileStream::Open(). offset - [in] origin - [in] SEEK_SET (0): seek from beginning of file.
SEEK_CUR (1): seek from current position of file pointer. SEEK_END (2): seek from end of file.

◆ SeekFromCurrentPosition()

static bool ON_FileStream::SeekFromCurrentPosition ( FILE *  fp,
ON__INT64  offset 
)
static

Description: Portable wrapper for C runtime fseek(fp,offset,SEEK_CUR). Parameters: fp - [in] FILE pointer returned by ON_FileStream::Open(). offset - [in]

◆ SeekFromEnd()

static bool ON_FileStream::SeekFromEnd ( FILE *  fp,
ON__INT64  offset 
)
static

Description: Portable wrapper for C runtime fseek(fp,offset,SEEK_END). Parameters: fp - [in] FILE pointer returned by ON_FileStream::Open(). offset - [in]

◆ SeekFromStart()

static bool ON_FileStream::SeekFromStart ( FILE *  fp,
ON__INT64  offset 
)
static

Description: Portable wrapper for C runtime fseek(fp,offset,SEEK_SET). Parameters: fp - [in] FILE pointer returned by ON_FileStream::Open(). offset - [in]

◆ Write()

static ON__UINT64 ON_FileStream::Write ( FILE *  fp,
ON__UINT64  count,
const void *  buffer 
)
static

Description: Portable wrapper for C runtime fwrite(buffer,1,count,fp). Parameters: fp - [in] FILE pointer returned by ON_FileStream::Open() count - [in] number of bytes to write buffer - [in] data to be written Returns: number of bytes written.