tbx  0.7.6
Public Types | Public Member Functions | List of all members
tbx::FilerAction Class Reference

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...
 

Detailed Description

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).

Member Enumeration Documentation

◆ Options

Options for file operations.

Combine one or more in the options parameter for the operation using "|".

Constructor & Destructor Documentation

◆ FilerAction() [1/3]

INTERNAL 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

◆ FilerAction() [2/3]

tbx::FilerAction::FilerAction ( const std::string &  object_name)

Construct with the object.

Parameters
object_namename of object to operate on
Exceptions
OsErrorif failed to set up filer action

◆ FilerAction() [3/3]

tbx::FilerAction::FilerAction ( const std::string &  dir_name,
const std::string &  objects 
)

Construct with directory and objects to operate on.

Parameters
dir_namedirectory containing objects to operator on
objectsspace separated list of leaf names in the directory to operate on.
Exceptions
OsErrorfailed to setup filer action

Member Function Documentation

◆ add_finished_listener()

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.

Parameters
listenerlistener to add

◆ add_objects()

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.

Parameters
objectsspace separated list of objects to operate upon
Exceptions
std::runtime_errordirectory hasn't been set
OsErrorfailed to set files

◆ copy()

void tbx::FilerAction::copy ( const std::string &  target_dir,
int  options = NONE 
)

Copy object(s) to the target directory.

Parameters
target_dirtarget directory for copy
optionsOptions for the copy
Exceptions
std::runtime_errorif source is not set
OsErrorif failed to start copy

◆ copy_local()

void tbx::FilerAction::copy_local ( const std::string &  leaf_name,
int  options = NONE 
)

Copy file within the source directory.

Parameters
leaf_nametarget leaf name for copy
optionsOptions for the copy
Exceptions
std::runtime_errorif source is not set
OsErrorif failed to start copy

◆ count()

void tbx::FilerAction::count ( int  options = NONE)

Show a count of the selected object(s)

Parameters
optionsOptions for the count
Exceptions
std::runtime_errorif source is not set
OsErrorif failed to start count

◆ directory()

void tbx::FilerAction::directory ( const std::string &  dir_name)

Set the directory containing the object to operate on.

Parameters
dir_namedirectory containing objects to operator on
Exceptions
OsErrorfailed to setup filer action

◆ find()

void tbx::FilerAction::find ( const std::string &  find_object,
int  options = NONE 
)

Find an object and display its location.

Parameters
find_objectobject to find in source locations
optionsOptions for the find
Exceptions
std::runtime_errorif source is not set
OsErrorif failed to start find

◆ move()

void tbx::FilerAction::move ( const std::string &  target_dir,
int  options = NONE 
)

Move object(s) to the target directory by copying first then deleting.

Parameters
target_dirtarget directory for move
optionsOptions for the move
Exceptions
std::runtime_errorif source is not set
OsErrorif failed to start move

◆ remove()

void tbx::FilerAction::remove ( int  options = NONE)

Remove (delete) object(s)

Parameters
optionsOptions for the remove
Exceptions
std::runtime_errorif source is not set
OsErrorif failed to start remove

◆ rename()

void tbx::FilerAction::rename ( const std::string &  target_dir,
int  options = NONE 
)

Move object(s) to the target directory by renaming.

Parameters
target_dirtarget directory for move
optionsOptions for the move
Exceptions
std::runtime_errorif source is not set
OsErrorif failed to start move

◆ set_access()

void tbx::FilerAction::set_access ( int  set,
int  leave,
int  options = NONE 
)

Set access for object(s)

Parameters
setaccess bits to set
leaveaccess bits to be left alone
optionsOptions for the set access
Exceptions
std::runtime_errorif source is not set
OsErrorif failed to start set access

◆ set_file_type()

void tbx::FilerAction::set_file_type ( int  type,
int  options = NONE 
)

Set file type for object(s)

Parameters
typenew file type
optionsOptions for the file type
Exceptions
std::runtime_errorif source is not set
OsErrorif failed to start setting file type

◆ set_object()

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.

Parameters
object_namename of object to operate upon
Exceptions
OsErrorfailed to set up filer action

◆ stamp()

void tbx::FilerAction::stamp ( int  options = NONE)

Stamp the object(s) with the current time and date.

Parameters
optionsOptions for the stamp
Exceptions
std::runtime_errorif source is not set
OsErrorif failed to start stamp

◆ task_handle()

int tbx::FilerAction::task_handle ( ) const
inline

Return the handle of the filer action task.

This will be 0 until one of the action methods is called

Returns
WIMP task handle for filer action task

◆ verbose()

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

Parameters
ontrue to turn verbose mode on

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