VCOM:VectorWorks:Filing:IStdFile

From Vectorworks Developer
Revision as of 17:21, 16 December 2015 by Pchang (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

.SDK|SDK ..SDK:Types|SDK Types ..VCOM:VCOM (Vectorworks Component Object Model)|VCOM Basics ..VCOM:Class Reference|VCOM Class Reference

Description

namespace VectorWorks::Filing

Allows working with files in higher level than IRawOSFile

Provides functionality of reading different sizes of integers and reading of strings and string lines.

Interface

// ----------------------------------------------------------------------------------------------------
// {B88D157C-3796-11DB-9C35-00508D5E9851}
static const VWIID IID_StdFile = { 0xB88D157C, 0x3796, 0x11DB, { 0x9C, 0x35, 0x00, 0x50, 0x8D, 0x5E, 0x98, 0x51 } };

class IStdFile : public IVWUnknown
{
public:
  virtual VCOMError VCOM_CALLTYPE OpenRead(IFileIdentifier* pFileID, bool bRandomAccess) = 0;
  virtual VCOMError VCOM_CALLTYPE OpenReadWrite(IFileIdentifier* pFileID, bool bRandomAccess, bool bTruncateExisting) = 0;
  virtual VCOMError VCOM_CALLTYPE OpenNewWrite(IFileIdentifier* pFileID) = 0;
  virtual VCOMError VCOM_CALLTYPE Close() = 0;
  virtual VCOMError VCOM_CALLTYPE SetProgressListener(IStdFileProgressListener* pListener) = 0;
  virtual VCOMError VCOM_CALLTYPE GetFileSize(Uint64& outSize) = 0;
  virtual VCOMError VCOM_CALLTYPE GetPosition(Uint64& outPosition) = 0;
  virtual VCOMError VCOM_CALLTYPE SetPosition(Uint64 position) = 0;
  virtual VCOMError VCOM_CALLTYPE SeekForward(Uint64 offset) = 0;
  virtual VCOMError VCOM_CALLTYPE SeekBackward(Uint64 offset) = 0;
  virtual VCOMError VCOM_CALLTYPE GetBytesLeft(Uint64& outValue) = 0;
  virtual VCOMError VCOM_CALLTYPE IsAtEndOfFile(bool& outValue) = 0;
  virtual VCOMError VCOM_CALLTYPE Read(Uint64& inoutBytes, void* pBuffer) = 0;
  virtual VCOMError VCOM_CALLTYPE Write(Uint64 bytes, const void* pBuffer) = 0;
  virtual VCOMError VCOM_CALLTYPE Read(Sint64& outValue) = 0;
  virtual VCOMError VCOM_CALLTYPE Write(Sint64 value) = 0;
  virtual VCOMError VCOM_CALLTYPE Read(Uint64& outValue) = 0;
  virtual VCOMError VCOM_CALLTYPE Write(Uint64 value) = 0;
  virtual VCOMError VCOM_CALLTYPE Read(Sint32& outValue) = 0;
  virtual VCOMError VCOM_CALLTYPE Write(Sint32 value) = 0;
  virtual VCOMError VCOM_CALLTYPE Read(Uint32& outValue) = 0;
  virtual VCOMError VCOM_CALLTYPE Write(Uint32 value) = 0;
  virtual VCOMError VCOM_CALLTYPE Read(Sint16& outValue) = 0;
  virtual VCOMError VCOM_CALLTYPE Write(Sint16 value) = 0;
  virtual VCOMError VCOM_CALLTYPE Read(Uint16& outValue) = 0;
  virtual VCOMError VCOM_CALLTYPE Write(Uint16 value) = 0;
  virtual VCOMError VCOM_CALLTYPE Read(Sint8& outValue) = 0;
  virtual VCOMError VCOM_CALLTYPE Write(Sint8 value) = 0;
  virtual VCOMError VCOM_CALLTYPE Read(Uint8& outValue) = 0;
  virtual VCOMError VCOM_CALLTYPE Write(Uint8 value) = 0;
  virtual VCOMError VCOM_CALLTYPE Read(TXString& outValue) = 0; // reads only first line when not given a size_t
  virtual VCOMError VCOM_CALLTYPE Read(TXString& outValue, size_t len) = 0;
  virtual VCOMError VCOM_CALLTYPE Write(const TXString& value, bool bIncludeZero) = 0;
  virtual VCOMError VCOM_CALLTYPE ReadStringLine(TXString& outLine) = 0;
  virtual VCOMError VCOM_CALLTYPE WriteStringLine(const TXString& line) = 0;
  virtual VCOMError VCOM_CALLTYPE SetDefaultNewLine(ELineEndType type) = 0;
  virtual VCOMError VCOM_CALLTYPE WriteNewLine() = 0;
  virtual VCOMError VCOM_CALLTYPE WriteNewLine(ELineEndType type) = 0;

  virtual VCOMError VCOM_CALLTYPE WriteUnicodeMarker() = 0;
  virtual VCOMError VCOM_CALLTYPE ReadStringLineUni(TXUniString& outLine) = 0;
  virtual VCOMError VCOM_CALLTYPE WriteStringLineUni(const TXUniString& line) = 0;
  virtual VCOMError VCOM_CALLTYPE WriteNewLineUni() = 0;
  virtual VCOMError VCOM_CALLTYPE WriteNewLineUni(ELineEndType type) = 0;
};

Members

OpenRead Opens a OS file for reading. File identified by IFileIdentifier
OpenReadWrite Opens a OS file for reading and writing. File identified by IFileIdentifier
OpenNewWrite Creates empty OS file for writing. File identified by IFileIdentifier
Close Close previosly opened file.
SetProgressListener Set progress listener implementator for reporting progress on reading the file.
GetFileSize Return the size of the opened file.
GetPosition Return the current file offset for reading and writing.
SetPosition Set the current file offset for reading and writing.
SeekForward Sets relative offset forward related to the current offset.
SeekBackward Sets relative offset backward related to the current offset.
GetBytesLeft Get bytes left to the end of the file from the current position.
IsAtEndOfFile Determines if the current position is at the end of the file.
Read Reads from previosly opened file for reading.
Write Writes to previosly opened file for writing.
ReadStringLine Read a line of characters. 0x0A and/or 0x0D ending bytes determine the end of the character string.
WriteStringLine Write a character string. At the end of the line write default line ending character.
SetDefaultNewLine Set default line ending character used when writing string lines.
WriteNewLine Writes default new line characters to the file at the current position.
WriteUnicodeMarker Write Unicode marker. This must be called for empty file to mark the header as Unicode text file.
ReadStringLineUni Read a line of Unicode characters. 0x0A and/or 0x0D ending bytes determine the end of the character string.
WriteStringLineUni Write an Unicode character string. At the end of the line write default line ending character.
WriteNewLineUni Writes default new line characters to the file at the current position.

Remarks

There is predefined type for smart VCOM pointer VCOMPtr to IStdFile interface:

typedef VCOMPtr<IStdFile>  IStdFilePtr;

Example

Samples at VCOM:Working with Binary or Text Files.

Version

Available from: VectorWorks 12

See Also

VCOM:VCOMPtr | VCOM:VectorWorks:Filing:IFolderIdentifier | VCOM:VectorWorks:Filing:IFileIdentifier

[[VCOM:VCOMPtr]] | [[VCOM:VectorWorks:Filing:IFolderIdentifier]] | [[VCOM:VectorWorks:Filing:IFileIdentifier]]