tbx
0.7.3
|
Class to use the RISC OS desktop filer to perform multi-tasking file operations. More...
#include <fileraction.h>
Public Types | |
enum | Options { NONE = 0, VERBOSE = 1, CONFIRM = 2, FORCE = 4, NEWER = 8, RECURSE = 16 } |
Options for file operations. More... | |
Public Member Functions | |
FilerAction () | |
Constructor with no parameters. More... | |
FilerAction (const std::string &object_name) | |
Construct with the object. More... | |
FilerAction (const std::string &dir_name, const std::string &objects) | |
Construct with directory and objects to operate on. More... | |
int | task_handle () const |
Return the handle of the filer action task. More... | |
void | directory (const std::string &dir_name) |
Set the directory containing the object to operate on. More... | |
void | add_objects (const std::string &objects) |
Set the objects to operate upon. More... | |
void | set_object (const std::string &object_name) |
Set the filer action to operate on a single file system object e.g. More... | |
void | copy (const std::string &target_dir, int options=NONE) |
Copy object(s) to the target directory. More... | |
void | rename (const std::string &target_dir, int options=NONE) |
Move object(s) to the target directory by renaming. More... | |
void | remove (int options=NONE) |
Remove (delete) object(s) More... | |
void | set_access (int set, int leave, int options=NONE) |
Set access for object(s) More... | |
void | set_file_type (int type, int options=NONE) |
Set file type for object(s) More... | |
void | count (int options=NONE) |
Show a count of the selected object(s) More... | |
void | move (const std::string &target_dir, int options=NONE) |
Move object(s) to the target directory by copying first then deleting. More... | |
void | copy_local (const std::string &leaf_name, int options=NONE) |
Copy file within the source directory. More... | |
void | stamp (int options=NONE) |
Stamp the object(s) with the current time and date. More... | |
void | find (const std::string &find_object, int options=NONE) |
Find an object and display its location. More... | |
void | verbose (bool on) |
Turn on or off verbose window while filer action is running. More... | |
void | add_finished_listener (FilerActionFinishedListener *listener) |
Add a listener for when the filer action has finished. More... | |
Class to use the RISC OS desktop filer to perform multi-tasking file operations.
The actions are set to execute and then returns immediately. The results of the operations are not returned.
To use set the directory and objects to work upon then call one of the action methods (e.g. copy, move etc).
Options for file operations.
Combine one or more in the options parameter for the operation using "|".
tbx::FilerAction::FilerAction | ( | ) |
Constructor with no parameters.
You must call directory and add_objects or set_object to specify what to work on before running an operation
tbx::FilerAction::FilerAction | ( | const std::string & | object_name | ) |
Construct with the object.
object_name | name of object to operate on |
OsError | if failed to set up filer action |
tbx::FilerAction::FilerAction | ( | const std::string & | dir_name, |
const std::string & | objects | ||
) |
Construct with directory and objects to operate on.
dir_name | directory containing objects to operator on |
objects | space separated list of leaf names in the directory to operate on. |
OsError | failed to setup filer action |
void tbx::FilerAction::add_finished_listener | ( | FilerActionFinishedListener * | listener | ) |
Add a listener for when the filer action has finished.
This listener must be added after the action has been run or it will be ignored.
listener | listener to add |
void tbx::FilerAction::add_objects | ( | const std::string & | objects | ) |
Set the objects to operate upon.
The directory should have been set first using the directory methods.
objects | space separated list of objects to operate upon |
std::runtime_error | directory hasn't been set |
OsError | failed to set files |
void tbx::FilerAction::copy | ( | const std::string & | target_dir, |
int | options = NONE |
||
) |
Copy object(s) to the target directory.
target_dir | target directory for copy |
options | Options for the copy |
std::runtime_error | if source is not set |
OsError | if failed to start copy |
void tbx::FilerAction::copy_local | ( | const std::string & | leaf_name, |
int | options = NONE |
||
) |
Copy file within the source directory.
leaf_name | target leaf name for copy |
options | Options for the copy |
std::runtime_error | if source is not set |
OsError | if failed to start copy |
void tbx::FilerAction::count | ( | int | options = NONE | ) |
Show a count of the selected object(s)
options | Options for the count |
std::runtime_error | if source is not set |
OsError | if failed to start count |
void tbx::FilerAction::directory | ( | const std::string & | dir_name | ) |
Set the directory containing the object to operate on.
dir_name | directory containing objects to operator on |
OsError | failed to setup filer action |
void tbx::FilerAction::find | ( | const std::string & | find_object, |
int | options = NONE |
||
) |
Find an object and display its location.
find_object | object to find in source locations |
options | Options for the find |
std::runtime_error | if source is not set |
OsError | if failed to start find |
void tbx::FilerAction::move | ( | const std::string & | target_dir, |
int | options = NONE |
||
) |
Move object(s) to the target directory by copying first then deleting.
target_dir | target directory for move |
options | Options for the move |
std::runtime_error | if source is not set |
OsError | if failed to start move |
void tbx::FilerAction::remove | ( | int | options = NONE | ) |
Remove (delete) object(s)
options | Options for the remove |
std::runtime_error | if source is not set |
OsError | if failed to start remove |
void tbx::FilerAction::rename | ( | const std::string & | target_dir, |
int | options = NONE |
||
) |
Move object(s) to the target directory by renaming.
target_dir | target directory for move |
options | Options for the move |
std::runtime_error | if source is not set |
OsError | if failed to start move |
void tbx::FilerAction::set_access | ( | int | set, |
int | leave, | ||
int | options = NONE |
||
) |
Set access for object(s)
set | access bits to set |
leave | access bits to be left alone |
options | Options for the set access |
std::runtime_error | if source is not set |
OsError | if failed to start set access |
void tbx::FilerAction::set_file_type | ( | int | type, |
int | options = NONE |
||
) |
Set file type for object(s)
type | new file type |
options | Options for the file type |
std::runtime_error | if source is not set |
OsError | if failed to start setting file type |
void tbx::FilerAction::set_object | ( | const std::string & | object_name | ) |
Set the filer action to operate on a single file system object e.g.
a directory or file.
object_name | name of object to operate upon |
OsError | failed to set up filer action |
void tbx::FilerAction::stamp | ( | int | options = NONE | ) |
Stamp the object(s) with the current time and date.
options | Options for the stamp |
std::runtime_error | if source is not set |
OsError | if failed to start stamp |
|
inline |
Return the handle of the filer action task.
This will be 0 until one of the action methods is called
void tbx::FilerAction::verbose | ( | bool | on | ) |
Turn on or off verbose window while filer action is running.
Does nothing if filer action is not running
on | true to turn verbose mode on |