Pyro higlevel API
Classes | Public Member Functions | List of all members
os::FileReference Class Reference

Semi persistent reference to a file. More...

Classes

class  Private
 

Public Member Functions

 FileReference ()
 
 FileReference (const String &cPath, bool bFollowLinks=false)
 
 FileReference (const Directory &cDir, const String &cName, bool bFollowLinks=false)
 
 FileReference (const FileReference &cRef)
 
virtual ~FileReference ()
 
status_t SetTo (const String &cPath, bool bFollowLinks=false)
 
status_t SetTo (const Directory &cDir, const String &cName, bool bFollowLinks=false)
 
status_t SetTo (const FileReference &cRef)
 
void Unset ()
 
bool IsValid () const
 
String GetName () const
 
status_t GetPath (String *pcPath) const
 
int Rename (const String &cNewName)
 
status_t Delete ()
 
WindowRenameDialog (const Messenger &cMsgTarget, Message *pcChangeMsg)
 Create a dialog which can be used to rename a directory or file. More...
 
WindowInfoDialog (const Messenger &cMsgTarget, Message *pcChangeMsg)
 Create a dialog which shows information about a file or directory. More...
 
status_t GetStat (struct stat *psStat) const
 
const DirectoryGetDirectory () const
 

Detailed Description

Description:
FileReference's serve much the same functionality as a plain path. It uniquely identifies a file within the filesystem. The main advantage of a FileReference is that it can partly "track" the file it reference. While moving a file to another directory or renaming the directory it lives in or any of it's subdirectories whould break a path, it will not affect a FileReference. Renaming the file itself however from outside the FileReference (ie. not using the FileReference::Rename() member) will break a FileReference aswell.
See Also
Author
Kurt Skauen (kurt@.nosp@m.athe.nosp@m.os.cx)

Constructor & Destructor Documentation

FileReference::FileReference ( )
FileReference::FileReference ( const String cPath,
bool  bFollowLinks = false 
)
FileReference::FileReference ( const Directory cDir,
const String cName,
bool  bFollowLinks = false 
)
FileReference::FileReference ( const FileReference cRef)
FileReference::~FileReference ( )
virtual

Member Function Documentation

status_t FileReference::Delete ( )

References os::String::c_str(), and GetPath().

const Directory & FileReference::GetDirectory ( ) const
String FileReference::GetName ( ) const
status_t FileReference::GetPath ( String pcPath) const
status_t FileReference::GetStat ( struct stat *  psStat) const
Window * FileReference::InfoDialog ( const Messenger cMsgTarget,
Message pcChangeMsg 
)
Description:
This dialog will show information about a file like its name, size and type. It is also possible to change the file type. If any changes have been made, then a message will be sent to the supplied message target.
Note:
Don’t forget to place the window at the right position and show it.
Parameters
cMsgTarget- The target that will receive the message.
pcMsg- The message that will be sent.
Author
Arno Klenke (arno_.nosp@m.klen.nosp@m.ke@ya.nosp@m.hoo..nosp@m.de)

References GetPath().

bool FileReference::IsValid ( void  ) const
status_t FileReference::Rename ( const String cNewName)
Window * FileReference::RenameDialog ( const Messenger cMsgTarget,
Message pcMsg 
)
Description:
The created window contains an input field where the user can type the new name of the directory/file. A message will be sent to the supplied message target if the file/directory has been renamed.
Note:
Don’t forget to place the window at the right position and show it.
Parameters
cMsgTarget- The target that will receive the message.
pcMsg- The message that will be sent.
Author
Arno Klenke (arno_.nosp@m.klen.nosp@m.ke@ya.nosp@m.hoo..nosp@m.de)

References GetPath().

int FileReference::SetTo ( const String cPath,
bool  bFollowLinks = false 
)
int FileReference::SetTo ( const Directory cDir,
const String cName,
bool  bFollowLinks = false 
)
status_t FileReference::SetTo ( const FileReference cRef)
void FileReference::Unset ( )