56 UTCTime(
unsigned int loadAddress,
unsigned int execAddress);
63 std::string
text()
const;
64 std::string
text(
const std::string &format)
const;
118 bool operator==(
const PathInfo &other);
119 bool operator!=(
const PathInfo &other);
121 bool read(
const Path &path);
122 bool read_raw(
const Path &path,
bool calc_file_type);
150 const std::string &
name()
const {
return _name;}
155 bool exists()
const {
return (_object_type != NOT_FOUND);}
157 bool file()
const {
return (_object_type == FILE);}
159 bool directory()
const {
return (_object_type == DIRECTORY);}
161 bool image_file()
const {
return (_object_type == IMAGE_FILE);}
164 bool has_file_type()
const;
165 int file_type()
const;
166 int raw_file_type()
const;
170 bool has_load_address()
const;
171 unsigned int load_address()
const;
172 unsigned int exec_address()
const;
176 int attributes()
const;
187 Iterator(
const std::string &dirName,
const char *wildCard);
196 bool operator==(
const Iterator &other);
197 bool operator!=(
const Iterator &other);
217 IterBlock(
const std::string &dirName,
const char *wildCard);
218 ~
IterBlock() {
delete _dirName;
delete _wildCard;}
236 void release() {
if (--_ref == 0)
delete this;}
243 enum {_readSize = 2048};
244 char _readData[_readSize];
274 Path(
const std::string &name);
275 Path(
const char *name);
277 Path(
const Path &other,
const std::string &child);
278 Path(
const Path &other,
const char *name);
286 Path &
set(
const Path &other,
const std::string &child);
294 const std::string &
name()
const {
return _name;}
296 operator const std::string&()
const;
297 operator const char *()
const;
299 Path child(
const std::string &child)
const;
302 Path &down(
const std::string &child);
304 void leaf_name(
const std::string &child);
305 std::string leaf_name()
const;
308 bool path_info(
PathInfo &info)
const;
309 bool raw_path_info(
PathInfo &info,
bool calc_file_type)
const;
313 bool directory()
const;
314 bool image_file()
const;
317 int file_type()
const;
318 bool file_type(
int type);
319 static int file_type(
const std::string &file_name);
320 static bool file_type(
const std::string &file_name,
int type);
321 int raw_file_type()
const;
323 int attributes()
const;
324 bool attributes(
int new_attributes);
331 void create_file(
int type)
const;
332 void create_directory()
const;
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);
362 char *load_file(
int *length = 0)
const;
363 void save_file(
const char *data,
int length,
int file_type)
const;
365 bool set_current_directory()
const;
368 static std::string canonicalise(
const std::string &path);
369 bool canonical_equals(
const tbx::Path &compare_to)
const;
370 bool canonical_equals(
const std::string &compare_to)
const;
372 static Path temporary(
const char *prefix = 0);
384 Iterator(
const std::string &dirName,
const char *wildCard);
389 ~
Iterator() {
if (_iterBlock) _iterBlock->release();}
393 bool operator==(
const Iterator &other);
394 bool operator!=(
const Iterator &other);
426 IterBlock(
const std::string &dirName,
const char *wildCard);
427 ~
IterBlock() {
delete _dirName;
delete _wildCard;}
447 void release() {
if (--_ref == 0)
delete this;}
454 enum {_readSize = 2048};
455 char _readData[_readSize];
A library for creating RISC OS toolbox applications.
Definition: abouttobeshownlistener.cc:34
unsigned char * buffer()
Pointer to start of time in memory.
Definition: path.h:90
const std::string & name() const
Get file name of path.
Definition: path.h:294
UTCTime()
Construct UTC time for Midnight, 1st Jan 1990.
Definition: path.cc:1078
PathInfo * _info
Definition: path.h:209
bool directory() const
Definition: path.h:159
Iterator used to iterate through a directory.
Definition: path.h:184
int _attributes
Definition: path.h:263
bool exists() const
Definition: path.h:155
void release()
Decrease reference count on this block.
Definition: path.h:236
Class to manipulate RISC OS file and directory path names.
Definition: path.h:270
UTCTime & operator=(const UTCTime &other)
Assign to value fo another UTCTime.
Definition: path.cc:1121
int _length
Definition: path.h:262
Iterator to step through files in a folder.
Definition: path.h:381
int _ref
Definition: path.h:450
Low level class to deal with the file iteration kernel calls.
Definition: path.h:214
CopyOption
Enumeration to options for copy method.
Definition: path.h:345
ObjectType
Definition: path.h:126
const char * next_name() const
Get next name.
Definition: path.h:436
int _toRead
Definition: path.h:456
const std::string & name() const
Get the leaf name of the object the information if for.
Definition: path.h:150
char * _nextRecord
Definition: path.h:246
void release()
Decrease reference count on this block.
Definition: path.h:447
Attribute
Definition: path.h:135
std::string text() const
Get time/date as text in standard format.
Definition: path.cc:1155
Low level class to deal with the file iteration kernel calls.
Definition: path.h:423
char * _wildCard
Definition: path.h:242
void add_ref()
Increase reference count on this block.
Definition: path.h:441
char * _dirName
Definition: path.h:241
int _toRead
Definition: path.h:245
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
int _file_type
Definition: path.h:264
char * _nextName
Definition: path.h:457
const char * next_record() const
Return next record from iteration block.
Definition: path.h:224
unsigned int _exec_address
Definition: path.h:261
char * _wildCard
Definition: path.h:453
bool file() const
Definition: path.h:157
const int FILE_TYPE_DIRECTORY
Special file type returned for a directory.
Definition: path.h:37
_kernel_swi_regs _regs
Definition: path.h:451
Class to handle the 5 byte times.
Definition: path.h:51
ObjectType _object_type
Definition: path.h:259
long long _centiseconds
Number of centiseconds since Midnight Jan 1st 1900.
Definition: path.h:102
void add_ref()
Increase reference count on this block.
Definition: path.h:230
std::string _name
Variable for current file name.
Definition: path.h:418
std::string _name
File name this path refers to.
Definition: path.h:469
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
long long centiseconds() const
Get the UTC time as centiseconds.
Definition: path.h:84
static UTCTime now()
Get a UTCTime representing the current time.
Definition: path.cc:1133
int _ref
Definition: path.h:239
char * _dirName
Definition: path.h:452
std::string _name
Definition: path.h:258
unsigned int low_word() const
Get the low 4 bytes of the UTC time.
Definition: path.h:71
std::string & operator*()
Get file name for current iterator.
Definition: path.h:404
unsigned char high_byte() const
Get the high byte of the UTC time.
Definition: path.h:77
std::string * operator->()
Get file name for current iterator.
Definition: path.h:410
bool image_file() const
Definition: path.h:161
_kernel_swi_regs _regs
Definition: path.h:240
Class to hold the catalogue information for a file.
Definition: path.h:111