ScriptModule
Public Slots | Public Member Functions | List of all members
TemporaryFile Class Reference

The TemporaryFile class is used to represent an actual image file on disk which will be deleted after script execution. Temporary files can be instantiated in the scripting environment or retrieved in an InputPort object. More...

#include <FileInterface.h>

Inheritance diagram for TemporaryFile:
Inheritance graph
[legend]
Collaboration diagram for TemporaryFile:
Collaboration graph
[legend]

Public Slots

TemporaryFilesetExtension (const String &ext)
 Change extension from automatically generated file name. Extension won't change if there is an open stream.
 
- Public Slots inherited from File
FilesetPath (const String &path)
 Specify absolute path of this image file. Name of file can be changed only if there is an open stream.
 
String path () const
 Retrieve file path.
 
String extension () const
 Retrieve file extension.
 
bool exists () const
 Verify if file exists on disk.
 
bool isOpen () const
 Check if file is opened.
 
bool isClose () const
 Check if file is closed.
 
bool open (int m=int(IO::WRITE_ONLY))
 Open file stream for read/write.
 
bool close ()
 Close file stream.
 
void write (const String &text)
 Write string in current stream.
 
void writeLine (const String &text)
 Write string line in current stream.
 
void write (File file)
 Write entire content of parameter file in current stream.
 
String read ()
 Read entire content of stream.
 
String readLine ()
 Read single line of stream.
 
bool move (File dest)
 
bool copy (File dest)
 

Public Member Functions

 TemporaryFile ()
 Create a new TemporaryFile.
 
 TemporaryFile (String extension)
 Create a new TemporaryFile.
 

Detailed Description

The TemporaryFile class is used to represent an actual image file on disk which will be deleted after script execution. Temporary files can be instantiated in the scripting environment or retrieved in an InputPort object.

You can use it in both Script Editor and scriptModule.

file = new TemporaryFile( "txt" );
file.open( IO.WRITE_ONLY ); // open with write only stream
file.writeLine( "Hello World!" ); // write line to file
file.close(); // close file

Constructor & Destructor Documentation

TemporaryFile::TemporaryFile ( )

Create a new TemporaryFile.

TemporaryFile::TemporaryFile ( String  extension)

Create a new TemporaryFile.

Parameters
extensionExtension of new TemporaryFile

Member Function Documentation

TemporaryFile& TemporaryFile::setExtension ( const String &  ext)
slot

Change extension from automatically generated file name. Extension won't change if there is an open stream.

Parameters
extExtension String of image file
Returns
TemporaryFile reference

The documentation for this class was generated from the following file: