FC++  v0.7.2-1128
FileCatalyst Fast File Transfers - C++ Library
fc::Remote Class Reference

The class fc::Remote is used to encapsulate remote directories or files. More...

#include <FCPath.hpp>

Inheritance diagram for fc::Remote:
Collaboration diagram for fc::Remote:

Public Member Functions

virtual ~Remote (void)
 
 Remote (const std::string &n)
 
virtual void setDefaultDir (const std::string &dir) const
 Set the default directory. Will ensure it is terminated by a slash or backslash. More...
 
virtual const std::string & defaultDir (void) const
 Get the default directory. This is guaranteed to be terminated by a slash or backslash. More...
 
virtual const std::string & separator (void) const
 Return the usual path separator, such as slash or backslash. More...
 
virtual Remote operator+ (const std::string &name) const
 
virtual bool empty (void) const
 
virtual const char * c_str (void) const
 
virtual operator const char * (void) const
 
virtual operator const std::string & (void) const
 
virtual const std::string & str (void) const
 
virtual Nameoperator+= (const std::string &rhs)
 Append a filename to an existing Local or Remote object. More...
 
virtual bool isAbsolute (void) const
 Original name is absolute, such as /tmp/test.txt or C:\Files. More...
 
virtual bool isRelative (void) const
 Original name is relative, such as test.txt or ..\test.txt. More...
 
virtual const std::string & name (void) const
 The original name specified when this object was first instantiated. More...
 
virtual std::string create_temporary_filename (const fc::Options &options) const
 Create a temporary filename to use based on the prefix and suffix in the given options. More...
 
virtual const std::string & parentDir (void) const
 Get the parent directory if known, or a blank string if unknown. More...
 
virtual const std::string & filename (void) const
 Get the last component in full() which normally would be the filename. More...
 
virtual const std::string & full (void) const
 Get the full name. More...
 

Protected Member Functions

std::string findSeparator (void) const
 Logic to extract the directory separator from the default directory or the explicit name. More...
 
virtual NameclearCache (void)
 Clear the mutable cache items. More...
 

Protected Attributes

std::string explicitName
 The name used when the object was instantiated. More...
 
std::string fileName
 the last component from full() More...
 
std::string parentDirectory
 the parent directory including the terminating slash More...
 
std::string fullDirAndName
 the name combined with the default directory More...
 

Static Protected Attributes

static std::string defaultRemoteDirectory
 
static std::string defaultRemoteSeparator
 
virtual Namesimplify (void)
 Attempt to simplify the path by removing double slashes and things like "../". More...
 
static std::string simplify (std::string &path)
 Attempt to simplify the path by removing double slashes and things like "../". More...
 

Detailed Description

The class fc::Remote is used to encapsulate remote directories or files.

Constructor & Destructor Documentation

◆ ~Remote()

fc::Remote::~Remote ( void  )
virtual

◆ Remote()

fc::Remote::Remote ( const std::string &  n)
explicit

Member Function Documentation

◆ setDefaultDir()

void fc::Remote::setDefaultDir ( const std::string &  dir) const
virtual

Set the default directory. Will ensure it is terminated by a slash or backslash.

See also
fc::Name::defaultDir()

Implements fc::Name.

References defaultRemoteDirectory, defaultRemoteSeparator, fc::Name::findSeparator(), and fc::Name::simplify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ defaultDir()

const std::string & fc::Remote::defaultDir ( void  ) const
virtual

Get the default directory. This is guaranteed to be terminated by a slash or backslash.

See also
fc::Name::setDefaultDir()

Implements fc::Name.

References defaultRemoteDirectory, and setDefaultDir().

Here is the call graph for this function:

◆ separator()

const std::string & fc::Remote::separator ( void  ) const
virtual

Return the usual path separator, such as slash or backslash.

See also
fc::Name::defaultDir()

Implements fc::Name.

References defaultRemoteSeparator, and fc::Name::findSeparator().

Here is the call graph for this function:

◆ operator+()

fc::Remote fc::Remote::operator+ ( const std::string &  name) const
virtual

References fc::Name::simplify().

Here is the call graph for this function:

◆ empty()

virtual bool fc::Name::empty ( void  ) const
inlinevirtualinherited

References fc::Name::name().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ c_str()

virtual const char* fc::Name::c_str ( void  ) const
inlinevirtualinherited

References fc::Name::full().

Here is the call graph for this function:

◆ operator const char *()

virtual fc::Name::operator const char * ( void  ) const
inlinevirtualinherited

References fc::Name::full().

Here is the call graph for this function:

◆ operator const std::string &()

virtual fc::Name::operator const std::string & ( void  ) const
inlinevirtualinherited

References fc::Name::full().

Here is the call graph for this function:

◆ str()

virtual const std::string& fc::Name::str ( void  ) const
inlinevirtualinherited

◆ simplify() [1/2]

fc::Name & fc::Name::simplify ( void  )
virtualinherited

Attempt to simplify the path by removing double slashes and things like "../".

References fc::Name::explicitName.

Here is the caller graph for this function:

◆ simplify() [2/2]

std::string fc::Name::simplify ( std::string &  path)
staticinherited

Attempt to simplify the path by removing double slashes and things like "../".

◆ operator+=()

fc::Name & fc::Name::operator+= ( const std::string &  rhs)
virtualinherited

Append a filename to an existing Local or Remote object.

References fc::Name::clearCache(), fc::Name::explicitName, fc::Name::separator(), and fc::Name::simplify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isAbsolute()

bool fc::Name::isAbsolute ( void  ) const
virtualinherited

Original name is absolute, such as /tmp/test.txt or C:\Files.

See also
fc::Name::isRelative()

References fc::Name::empty(), and fc::Name::explicitName.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isRelative()

bool fc::Name::isRelative ( void  ) const
virtualinherited

Original name is relative, such as test.txt or ..\test.txt.

See also
fc::Name::isAbsolute()

References fc::Name::empty(), and fc::Name::isAbsolute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ name()

const std::string & fc::Name::name ( void  ) const
virtualinherited

The original name specified when this object was first instantiated.

References fc::Name::explicitName.

Here is the caller graph for this function:

◆ create_temporary_filename()

std::string fc::Name::create_temporary_filename ( const fc::Options options) const
virtualinherited

Create a temporary filename to use based on the prefix and suffix in the given options.

This is intended for internal use by FC++ to generate a usable temporary name, and likely doesn't need to be called directly.

See also
fc::Options::setTmpFilenames()

References fc::Name::filename(), and fc::Name::parentDir().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parentDir()

const std::string & fc::Name::parentDir ( void  ) const
virtualinherited

Get the parent directory if known, or a blank string if unknown.

The directory name (if not empty) will always be terminated with / or \. For example:

Original Name parentDir()
test.txt
../test.txt ../
/tmp/foo/bar/name.txt /tmp/foo/bar/
/testing/123/ /testing/
/ /

References fc::Name::full(), fc::Name::parentDirectory, and fc::Name::separator().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ filename()

const std::string & fc::Name::filename ( void  ) const
virtualinherited

Get the last component in full() which normally would be the filename.

References fc::Name::fileName, fc::Name::full(), and fc::Name::separator().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ full()

const std::string & fc::Name::full ( void  ) const
virtualinherited

Get the full name.

  • If name is absolute, then this returns the name.
  • If name is relative, then this returns the name combined with the default directory.

Most of the time, this is the method you'll want to call to generate a path or filename.

Examples when the default directory is set to /tmp/:

Directory Name full()
/test.txt /test.txt
test.txt /tmp/test.txt
../test.txt /tmp/../test.txt
C:\MyFiles\test.txt C:\MyFiles\test.txt
Returns
the full name, combined with the default directory when appropriate

References fc::Name::defaultDir(), fc::Name::fullDirAndName, fc::Name::name(), fc::Name::separator(), and fc::Name::simplify().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findSeparator()

std::string fc::Name::findSeparator ( void  ) const
protectedinherited

Logic to extract the directory separator from the default directory or the explicit name.

References fc::Name::defaultDir(), and fc::Name::explicitName.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearCache()

fc::Name & fc::Name::clearCache ( void  )
protectedvirtualinherited

Clear the mutable cache items.

References fc::Name::fileName, fc::Name::fullDirAndName, and fc::Name::parentDirectory.

Here is the caller graph for this function:

Member Data Documentation

◆ defaultRemoteDirectory

std::string fc::Remote::defaultRemoteDirectory
staticprotected

◆ defaultRemoteSeparator

std::string fc::Remote::defaultRemoteSeparator
staticprotected

◆ explicitName

std::string fc::Name::explicitName
protectedinherited

The name used when the object was instantiated.

◆ fileName

std::string fc::Name::fileName
mutableprotectedinherited

the last component from full()

◆ parentDirectory

std::string fc::Name::parentDirectory
mutableprotectedinherited

the parent directory including the terminating slash

◆ fullDirAndName

std::string fc::Name::fullDirAndName
mutableprotectedinherited

the name combined with the default directory


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