ScriptModule
|
The File class is used to represent an actual image file on disk. Files can be instantiated in the scripting environment or retrieved in an InputPort object. More...
#include <FileInterface.h>
Public Slots | |
File & | setPath (const String &path) |
Specify absolute path of this image file. Name of file can not be changed if there is an open stream. More... | |
String | path () const |
Retrieve file path. More... | |
File & | setExtension (const String &ext) |
Change extension for file name. Extension won't change if there is an open stream. More... | |
String | extension () const |
Retrieve file extension. More... | |
bool | exists () const |
Verify if file exists on disk. More... | |
bool | remove () |
Stream Manipulation | |
bool | isOpen () const |
Check if file is opened. More... | |
bool | isClose () const |
Check if file is closed. More... | |
bool | open (int m=int(IO::WRITE_ONLY)) |
Open file stream for read/write. More... | |
bool | close () |
Close file stream. More... | |
void | write (const String &text) |
Write string in current stream. More... | |
void | writeLine (const String &text) |
Write string line in current stream. More... | |
void | writeFile (File file) |
Write entire content of parameter file in current stream. More... | |
String | read () |
Read entire content of stream. More... | |
String | readLine () |
Read single line of stream. More... | |
File management | |
bool | move (File dest) |
bool | copy (File dest) |
Public Member Functions | |
File () | |
Create a new File. More... | |
File (String path) | |
Create a new File. More... | |
The File class is used to represent an actual image file on disk. Files can be instantiated in the scripting environment or retrieved in an InputPort object.
You can use it in both the Script Editor and scriptModule.
In a script, there are two possible constructor: the PermanentFile or TemporaryFile. The PermanentFile takes the name of a file as an argument. Example:
The TemporaryFile takes an extension as an argument, an returns a temporary file with that extension. The temporary file and its containing directory will be deleted on exit. Example:
File::File | ( | ) |
Create a new File.
|
slot |
Close file stream.
|
slot |
|
slot |
Verify if file exists on disk.
|
slot |
Retrieve file extension.
|
slot |
Check if file is closed.
|
slot |
Check if file is opened.
|
slot |
|
slot |
Open file stream for read/write.
m | IO stream descriptor |
|
slot |
Retrieve file path.
|
slot |
Read entire content of stream.
|
slot |
Read single line of stream.
|
slot |
Remove physical file manually. Cannot remove file if there is an open stream.
|
slot |
Change extension for file name. Extension won't change if there is an open stream.
ext | Extension String of image file |
|
slot |
Specify absolute path of this image file. Name of file can not be changed if there is an open stream.
path | Absolute path String of image file |
|
slot |
Write string in current stream.
text | Text to write |
|
slot |
Write entire content of parameter file in current stream.
file | File object |
|
slot |
Write string line in current stream.
text | Text to write |