56 UTCTime(
unsigned int loadAddress,
unsigned int execAddress);
63 std::string
text()
const;
64 std::string
text(
const std::string &format)
const;
187 Iterator(
const std::string &dirName,
const char *wildCard);
217 IterBlock(
const std::string &dirName,
const char *wildCard);
243 enum {_readSize = 2048};
296 operator const std::string&()
const;
297 operator const char *()
const;
319 static int file_type(
const std::string &file_name);
320 static bool file_type(
const std::string &file_name,
int type);
338 void rename(
const std::string &new_name);
348 COPY_ALLOW_PRINT = 0x100u,
349 COPY_NO_ATTRIBUTES = 0x200u,
351 COPY_STRUCTURE = 0x800u,
352 COPY_NEWER = 0x1000u,
356 void copy(
const std::string ©to,
unsigned int options = 0);
357 void copy(
const std::string ©to,
unsigned int options,
void *buffer,
unsigned int size);
358 void move(
const std::string ©to,
unsigned int options = 0);
359 void move(
const std::string ©to,
unsigned int options,
void *buffer,
unsigned int size);
368 static std::string
canonicalise(
const std::string &path);
384 Iterator(
const std::string &dirName,
const char *wildCard);
426 IterBlock(
const std::string &dirName,
const char *wildCard);
454 enum {_readSize = 2048};
std::string * operator->()
Get file name for current iterator.
Definition: path.h:410
int _attributes
Definition: path.h:263
char * _nextName
Definition: path.h:457
bool exists() const
Check if path exists on the file system.
Definition: path.cc:318
const int FILE_TYPE_DIRECTORY
Special file type returned for a directory.
Definition: path.h:37
std::string text() const
Get time/date as text in standard format.
Definition: path.cc:1155
bool has_file_type() const
Check if this path info has file type information.
Definition: path.cc:1401
A library for creating RISC OS toolbox applications.
Definition: abouttobeshownlistener.cc:35
std::string _name
Definition: path.h:258
bool operator==(const Iterator &other)
Check if this iterator is the same as another.
Definition: path.cc:944
unsigned int exec_address() const
Get the executable address for this PathInfo.
Definition: path.cc:1480
Path & operator=(const Path &other)
Assign to another path.
Definition: path.cc:117
IterBlock(const std::string &dirName, const char *wildCard)
Constructe Iterator block for given directory and file name.
Definition: path.cc:1705
char * _wildCard
Definition: path.h:453
Class to handle the 5 byte times.
Definition: path.h:52
UTCTime & operator=(const UTCTime &other)
Assign to value fo another UTCTime.
Definition: path.cc:1121
const std::string & name() const
Get file name of path.
Definition: path.h:294
Class to hold the catalogue information for a file.
Definition: path.h:112
bool operator==(const PathInfo &other)
Checks if this path info is identical to another.
Definition: path.cc:1275
void create_directory() const
Create a directory at the given path.
Definition: path.cc:525
bool file() const
Check if path is a file on the file system.
Definition: path.cc:329
bool operator!=(const Iterator &other)
Check if this iterator is different from another.
Definition: path.cc:955
bool canonical_equals(const tbx::Path &compare_to) const
Compare this path with another to see if their canonical names are the same using a case insensitive ...
Definition: path.cc:793
Iterator & operator++()
Move iterator to next item.
Definition: path.cc:1635
int attributes() const
Return the objects file attributes.
Definition: path.cc:460
void remove() const
Remove this file or directory from the file system.
Definition: path.cc:543
UTCTime()
Construct UTC time for Midnight, 1st Jan 1990.
Definition: path.cc:1078
@ NOT_FOUND
Definition: path.h:128
PathInfo * _info
Definition: path.h:209
bool directory() const
Definition: path.h:159
void release()
Decrease reference count on this block.
Definition: path.h:236
char * _wildCard
Definition: path.h:242
int _ref
Definition: path.h:450
void next()
Moves iterator on to the next item.
Definition: path.cc:986
static PathInfo::Iterator end()
Get iterator for checking end of iteration of a path.
Definition: path.cc:1540
CopyOption
Enumeration to options for copy method.
Definition: path.h:345
int _toRead
Definition: path.h:456
int _toRead
Definition: path.h:245
Path::Iterator end()
End iterator.
Definition: path.cc:879
static PathInfo::Iterator begin(const Path &path, const std::string &wildCard)
Returns an iterator for the given path that will return the PathInfo information for each object matc...
Definition: path.cc:1517
PathInfo & operator*()
Get the PathInfo for the iterator.
Definition: path.cc:1683
void rename(const std::string &new_name)
Rename file.
Definition: path.cc:561
unsigned int _exec_address
Definition: path.h:261
@ OTHER_READ
Definition: path.h:140
@ OWNER_LOCKED
Definition: path.h:139
Low level class to deal with the file iteration kernel calls.
Definition: path.h:424
bool file() const
Definition: path.h:157
ObjectType _object_type
Definition: path.h:259
UTCTime modified_time() const
Return the modified time from the file in the path.
Definition: path.cc:445
unsigned char * buffer()
Pointer to start of time in memory.
Definition: path.h:90
bool directory() const
Check if path is a directory on the file system.
Definition: path.cc:341
PathInfo()
Construct and empty PathInfo not referring to any file.
Definition: path.cc:1221
Iterator & operator=(const Iterator &other)
Assign this iterator to another.
Definition: path.cc:1599
void release()
Decrease reference count on this block.
Definition: path.h:447
unsigned int load_address() const
Get the load address for this PathInfo.
Definition: path.cc:1468
int raw_file_type() const
Return the file type from the load/exec address.
Definition: path.cc:431
char * _nextRecord
Definition: path.h:246
void save_file(const char *data, int length, int file_type) const
Save an array of characters to a file.
Definition: path.cc:735
const char * next_record() const
Return next record from iteration block.
Definition: path.h:224
Iterator & operator++()
Move iterator to next item.
Definition: path.cc:965
Iterator & operator=(const Iterator &other)
Assign this iterator as the value of another.
Definition: path.cc:929
bool raw_path_info(PathInfo &info, bool calc_file_type) const
Read catalogue information for the given path always returning the raw load/exec address.
Definition: path.cc:308
int attributes() const
Return the objects file attributes.
Definition: path.cc:1503
int file_type() const
Get the file type of the object.
Definition: path.cc:1415
bool operator!=(const PathInfo &other)
Checks if this path info is different to another.
Definition: path.cc:1294
char * _dirName
Definition: path.h:452
unsigned int low_word() const
Get the low 4 bytes of the UTC time.
Definition: path.h:71
bool path_info(PathInfo &info) const
Read the catalogue information for this path.
Definition: path.cc:292
static UTCTime now()
Get a UTCTime representing the current time.
Definition: path.cc:1133
int _file_type
Definition: path.h:264
@ OTHER_WRITE
Definition: path.h:141
const std::string & name() const
Get the leaf name of the object the information if for.
Definition: path.h:150
Attribute
Definition: path.h:136
bool operator==(const Iterator &other)
Check if this iterator is the same as another.
Definition: path.cc:1614
bool next()
Move to next record returned from OS.
Definition: path.cc:1736
PathInfo & operator=(const PathInfo &other)
Assign to the value of another PathInfo.
Definition: path.cc:1254
PathInfo::ObjectType object_type() const
Check the File system to determine the type of this object this path refers to.
Definition: path.cc:279
int file_type() const
Read the file type for this path.
Definition: path.cc:365
Path & up()
Updates this path to it's parent.
Definition: path.cc:222
bool read(const Path &path)
Read catalogue information for the given path.
Definition: path.cc:1311
char _readData[_readSize]
Definition: path.h:244
@ OWNER_WRITE
Definition: path.h:138
ObjectType
Definition: path.h:127
Low level class to deal with the file iteration kernel calls.
Definition: path.h:215
Path::Iterator begin()
Create an iterator to scan the whole directory.
Definition: path.cc:869
bool set_current_directory() const
Set the OS current directory to this path.
Definition: path.cc:814
ObjectType object_type() const
Return the object type read for this path.
Definition: path.cc:1391
int raw_file_type() const
Return the file type from the load/exec address.
Definition: path.cc:1434
Path parent() const
Get parent of this path.
Definition: path.cc:197
void move(const std::string ©to, unsigned int options=0)
Move a file to a new location.
Definition: path.cc:637
long long _centiseconds
Number of centiseconds since Midnight Jan 1st 1900.
Definition: path.h:102
unsigned char * buffer() const
Pointer to start of time in memory This is used for calls to the OS that pass a UTC.
Definition: path.h:96
char * _dirName
Definition: path.h:241
const char * next_name() const
Get next name.
Definition: path.h:436
bool operator!=(const Iterator &other)
Check if this iterator and another are different.
Definition: path.cc:1625
unsigned char high_byte() const
Get the high byte of the UTC time.
Definition: path.h:77
void add_ref()
Increase reference count on this block.
Definition: path.h:230
Class to manipulate RISC OS file and directory path names.
Definition: path.h:271
virtual ~Path()
Path destructor.
Definition: path.cc:106
const int FILE_TYPE_APPLICATION
Special file type returned for an application directory.
Definition: path.h:42
unsigned int _load_address
Definition: path.h:260
Path & down(const std::string &child)
Updates path to the given child.
Definition: path.cc:209
_kernel_swi_regs _regs
Definition: path.h:451
void canonicalise()
Canonicalise the path name.
Definition: path.cc:752
PathInfo * operator->()
Get the PathInfo for the iterator.
Definition: path.cc:1693
Path & set(const Path &other, const std::string &child)
Set path to a child of another path.
Definition: path.cc:152
std::string _name
File name this path refers to.
Definition: path.h:469
@ FILE
Definition: path.h:129
char * load_file(int *length=0) const
Load this file into a character array.
Definition: path.cc:696
int length() const
Get the length of this object on the file system.
Definition: path.cc:1490
void add_ref()
Increase reference count on this block.
Definition: path.h:441
std::string leaf_name() const
Get the leaf name part of the path.
Definition: path.cc:262
bool has_load_address() const
Check if path info has a load address and executable address.
Definition: path.cc:1456
std::string & operator*()
Get file name for current iterator.
Definition: path.h:404
int _ref
Definition: path.h:239
bool image_file() const
Definition: path.h:161
bool exists() const
Definition: path.h:155
bool image_file() const
Check if path is a image file system on the file system.
Definition: path.cc:353
UTCTime modified_time() const
Return the modification time of the file if it has it.
Definition: path.cc:1444
@ IMAGE_FILE
Definition: path.h:131
Path child(const std::string &child) const
Get path object for given child name.
Definition: path.cc:187
void copy(const std::string ©to, unsigned int options=0)
Copy the object.
Definition: path.cc:579
void create_file(int type) const
Create an empty file of the given file type.
Definition: path.cc:505
@ DIRECTORY
Definition: path.h:130
bool info(PathInfo &info)
Get path information for iterator block.
Definition: path.cc:1772
char _readData[_readSize]
Definition: path.h:455
long long centiseconds() const
Get the UTC time as centiseconds.
Definition: path.h:84
IterBlock(const std::string &dirName, const char *wildCard)
Construct internal iterator block.
Definition: path.cc:1014
_kernel_swi_regs _regs
Definition: path.h:240
@ OTHER_LOCKED
Definition: path.h:142
void next()
Move iterator to next item.
Definition: path.cc:1656
std::string _name
Variable for current file name.
Definition: path.h:418
static Path temporary(const char *prefix=0)
Return a Path for a temporary file.
Definition: path.cc:835
bool next()
Move to next record in iterator block.
Definition: path.cc:1045
Iterator used to iterate through a directory.
Definition: path.h:185
bool read_raw(const Path &path, bool calc_file_type)
Read catalogue information for the given path always returning the raw load/exec address.
Definition: path.cc:1349
int _length
Definition: path.h:262
Path()
Construct an empty path object.
Definition: path.cc:42
Iterator to step through files in a folder.
Definition: path.h:382