VCOM:VectorWorks:Filing:IFileIdentifier

From Vectorworks Developer
Revision as of 15:31, 27 February 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

Instance of this interface represent one file in the OS.

The file is not required to exist for the instance to exist.

Interface

// ----------------------------------------------------------------------------------------------------
// {B4B088B1-3793-11DB-9C35-00508D5E9851}
static const VWIID IID_FileIdentifier = { 0xB4B088B1, 0x3793, 0x11DB, { 0x9C, 0x35, 0x00, 0x50, 0x8D, 0x5E, 0x98, 0x51 } };

class IFileIdentifier : public IVWUnknown
{
public:
  virtual VCOMError VCOM_CALLTYPE Set(const TXString& fullPath) = 0;
  virtual VCOMError VCOM_CALLTYPE Set(EFolderSpecifier folderSpec, bool bUserFolder, const TXString& fileName) = 0;
  virtual VCOMError VCOM_CALLTYPE Set(IFolderIdentifier* pFolderID, const TXString& fileName) = 0;
  virtual VCOMError VCOM_CALLTYPE Clear() = 0;
  virtual VCOMError VCOM_CALLTYPE IsSet() = 0;
  virtual VCOMError VCOM_CALLTYPE ExistsOnDisk(bool& outValue) = 0;
  virtual VCOMError VCOM_CALLTYPE GetFileFullPath(TXString& outPath, ETXStringEncoding txEncoding = eDefaultPathEncoding) = 0;
  virtual VCOMError VCOM_CALLTYPE GetFileName(TXString& outName) = 0;
  virtual VCOMError VCOM_CALLTYPE SetFileName(const TXString& name) = 0;
  virtual VCOMError VCOM_CALLTYPE GetFileExtension(TXString& outExtension) = 0;
  virtual VCOMError VCOM_CALLTYPE SetFileExtension(const TXString& extension) = 0;
  virtual VCOMError VCOM_CALLTYPE GetFileNameWithoutExtension(TXString& outName) = 0;
  virtual VCOMError VCOM_CALLTYPE GetFolder(IFolderIdentifier** ppOutParentFolderID) = 0;
  virtual VCOMError VCOM_CALLTYPE GetAttributes(SAttributes& outAttributes) = 0;
  virtual VCOMError VCOM_CALLTYPE SetAttributes(const SAttributes& attributes) = 0;
  virtual VCOMError VCOM_CALLTYPE DeleteOnDisk() = 0;
  virtual VCOMError VCOM_CALLTYPE RenameOnDisk(const TXString& newName) = 0;
  virtual VCOMError VCOM_CALLTYPE DuplicateOnDisk(IFileIdentifier *pDestFileID, bool bOverwrite) = 0;
  virtual VCOMError VCOM_CALLTYPE LaunchInOS() = 0;
  virtual VCOMError VCOM_CALLTYPE RevealInOS() = 0;
  virtual VCOMError VCOM_CALLTYPE FormatFilename(TXString& formatName, Uint16 maxCharsWithoutSpace) = 0;
};

Members

Set Set file definition.
Clear Clear this file definition so it contains invalid path.
IsSet Determine if this file definition contains valid path.
ExistsOnDisk Determines if this file exist on the disk.
GetFileFullPath Returns the full OS path of the file. In VW 2016, you can specify the encoding of outPath by specifying the optional encoding parameter. The default on Mac is UTF8, on Windows is language-specific Windows encoding. ETXStringEncoding enum class is defined in "GSString.X.h".
GetFileName Returns the file name.
SetFileName Set new name of the file definition.
GetFileExtension Returns the extension of the file.
SetFileExtension Set new extension of the file.
GetFileNameWithoutExtension Return the file name without extension
GetFolder Returns the parent folder of this file.
GetAttributes Returns the OS attributes of this file.
SetAttributes Set new OS attributes of this file.
DeleteOnDisk Delete this file on the disk.
RenameOnDisk Rename the file on the disk.
DuplicateOnDisk Duplicate the file on the disk.
LaunchInOS Launch the file using the OS.
RevealInOS Reveal the file inside OS window.
FormatFilename Format passed file name not to exceed specified amount of characters.
ValidateName <needs info>

Remarks

You should use Set members first to specify the instance's file. There are VectorWorks predefined folders which can be accessed through the enumeration values from EFolderSpecifier provided by the SDK in file 'FolderSpecifiers.h'

The most common used values are:

kApplicationFolder
kExternalsFolder

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

typedef VCOMPtr< IFileIdentifier >  IFileIdentifierPtr;

Example

Create an instance and set it to refer to particular folder inside Plug-ins folder:

using namespace VectorWorks::Filing;

VCOMPtr< IFileIdentifier >  pMyFile ( IID_FileIdentifier );
if ( pMyFile && VCOM_SUCCEEDED( pMyFile->Set( kExternalsFolder, "SubFolder/fileName.txt" ) ) {
   // ...
}

Version

Available from: VectorWorks 12

See Also

VCOM:VCOMPtr | VCOM:VectorWorks:Filing:IFileChooserDialog | VCOM:VectorWorks:Filing:IFolderIdentifier

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