zypp::filesystem::Pathname Class Reference

Pathname. More...

#include <Pathname.h>

List of all members.

Public Member Functions

 Pathname ()
 Default ctor: an empty path.
 Pathname (const std::string &name_tv)
 Ctor from string.
 Pathname (const char *name_tv)
 Ctor from char*.
Pathnameoperator= (const Pathname &path_tv)
 Assign.
Pathnameoperator/= (const Pathname &path_tv)
 Concatenate and assing.
Pathnameoperator+= (const Pathname &path_tv)
 Concatenate and assing.
const std::string & asString () const
 String representation.
bool empty () const
 Test for an empty path.
bool absolute () const
 Test for an absolute path.
bool relative () const
 Test for a relative path.
Pathname dirname () const
 Return all but the last component od this path.
std::string basename () const
 Return the last component of this path.
Pathname absolutename () const
 Return this path, adding a leading '/' if relative.
Pathname relativename () const
 Return this path, removing a leading '/' if absolute.
Pathname cat (const Pathname &r) const
 Concatenation of pathnames.
Pathname extend (const std::string &r) const
 Append string r to the last component of the path.

Static Public Member Functions

static Pathname dirname (const Pathname &name_tv)
static std::string basename (const Pathname &name_tv)
static Pathname absolutename (const Pathname &name_tv)
static Pathname relativename (const Pathname &name_tv)
static Pathname cat (const Pathname &l, const Pathname &r)
static Pathname extend (const Pathname &l, const std::string &r)

Private Member Functions

void _assign (const std::string &name_tv)

Private Attributes

std::string::size_type prfx_i
std::string name_t

Related Functions

(Note that these are not member functions.)

bool operator== (const Pathname &l, const Pathname &r)
bool operator!= (const Pathname &l, const Pathname &r)
Pathname operator/ (const Pathname &l, const Pathname &r)
Pathname operator+ (const Pathname &l, const Pathname &r)
std::ostream & operator<< (std::ostream &str, const Pathname &obj)


Detailed Description

Pathname.

Note:
For convenience Pathname is available as zypp::Pathname too.
Always stores normalized paths (no inner '.' or '..' components and no consecutive '/'es). Concatenation automatically adds the path separator '/'.

Todo:
Add support for handling extensions incl. stripping extensions from basename (basename("/path/foo.baa", ".baa") ==> "foo")

Review. Maybe use COW pimpl, ckeck storage.

EXPLICIT ctors.

Definition at line 42 of file Pathname.h.


Constructor & Destructor Documentation

zypp::filesystem::Pathname::Pathname  )  [inline]
 

Default ctor: an empty path.

Definition at line 46 of file Pathname.h.

zypp::filesystem::Pathname::Pathname const std::string &  name_tv  )  [inline]
 

Ctor from string.

Definition at line 51 of file Pathname.h.

References _assign().

zypp::filesystem::Pathname::Pathname const char *  name_tv  )  [inline]
 

Ctor from char*.

Definition at line 55 of file Pathname.h.

References _assign().


Member Function Documentation

Pathname& zypp::filesystem::Pathname::operator= const Pathname path_tv  )  [inline]
 

Assign.

Definition at line 59 of file Pathname.h.

References name_t, and prfx_i.

Pathname& zypp::filesystem::Pathname::operator/= const Pathname path_tv  )  [inline]
 

Concatenate and assing.

See also:
cat

Definition at line 67 of file Pathname.h.

References cat().

Pathname& zypp::filesystem::Pathname::operator+= const Pathname path_tv  )  [inline]
 

Concatenate and assing.

See also:
cat
Deprecated:
: use /=

Definition at line 73 of file Pathname.h.

References cat().

const std::string& zypp::filesystem::Pathname::asString  )  const [inline]
 

String representation.

Definition at line 77 of file Pathname.h.

References name_t.

Referenced by zypp::filesystem::assert_dir(), zypp::filesystem::PathInfo::asString(), basename(), cat(), zypp::source::yum::YUMSourceImpl::checkCheckSum(), zypp::source::yum::YUMSourceImpl::checkMetadataChecksums(), zypp::filesystem::chmod(), zypp::source::susetags::SelectionTagFileParser::consume(), zypp::source::susetags::PackagesLangParser::consume(), zypp::source::SourceImpl::copyLocalMetadata(), zypp::target::rpm::librpmDb::D::D(), zypp::KeyRing::Impl::deleteKey(), zypp::storage::XMLFilesBackend::deleteSource(), zypp::media::MediaAccess::dirInfo(), zypp::source::yum::YUMScriptImpl::do_script(), zypp::media::MediaCurl::doGetFileCopy(), zypp::target::rpm::RpmDb::doInstallPackage(), zypp::source::yum::YUMSourceImpl::downloadMetadata(), zypp::source::susetags::SuseTagsImpl::downloadMetadata(), zypp::source::yum::YUMSourceImpl::downloadNeeded(), zypp::dumpFile(), zypp::KeyRing::Impl::dumpPublicKey(), zypp::KeyRing::Impl::exportKey(), zypp::ExternalProgram::ExternalProgram(), zypp::base::Fd::Fd(), zypp::media::MediaAccess::FileProvider::FileProvider(), zypp::base::logger::FileWriter::FileWriter(), zypp::media::MediaAccess::getFile(), zypp::media::getShare(), zypp::filesystem::hardlink(), zypp::KeyRing::Impl::importKey(), zypp::target::rpm::RpmDb::importPubkey(), zypp::storage::XMLFilesBackend::initBackend(), zypp::source::susetags::SuseTagsImpl::initCacheDir(), zypp::target::rpm::internal_convertV3toV4(), zypp::filesystem::is_empty_dir(), zypp::source::SourceImpl::Verifier::isDesiredMedia(), zypp::media::MediaManager::isUseableAttachPoint(), zypp::filesystem::md5sum(), zypp::media::MediaCurl::MediaCurl(), zypp::media::MediaHandler::MediaHandler(), zypp::filesystem::mkdir(), zypp::ZYppGlobalLock::openLockFile(), operator!=(), zypp::SourceFactory::ProductEntry::operator<(), operator<<(), operator==(), zypp::source::susetags::ProductMetadataParser::parse(), zypp::source::susetags::MediaPatchesMetadataParser::parse(), zypp::source::susetags::MediaMetadataParser::parse(), zypp::parser::tagfile::TagFileParser::parse(), zypp::source::susetags::parsePackagesLang(), zypp::media::MediaAccess::provideDir(), zypp::media::MediaAccess::provideDirTree(), zypp::source::SourceImpl::provideFile(), zypp::media::MediaAccess::provideFile(), zypp::source::SourceImpl::providePackage(), zypp::source::susetags::SuseTagsImpl::providePatterns(), zypp::source::susetags::SuseTagsImpl::provideSelections(), zypp::target::rpm::RpmDb::pubkeys(), zypp::KeyRing::Impl::publicKeys(), zypp::base::sysconfig::read(), zypp::source::susetags::SuseTagsImpl::readMediaFile(), zypp::KeyRing::Impl::readPublicKey(), zypp::KeyRing::Impl::readSignatureKeyId(), zypp::filesystem::rename(), zypp::target::rpm::RpmDb::run_rpm(), zypp::SourceFactory::scanProductsFile(), zypp::filesystem::sha1sum(), zypp::storage::XMLFilesBackend::storedSources(), zypp::storage::XMLFilesBackend::storeSource(), zypp::SourceCache::storeSource(), zypp::target::rpm::librpmDb::stringPath(), zypp::media::stripShare(), zypp::filesystem::symlink(), zypp::source::yum::YUMScriptImpl::undo_script(), zypp::source::susetags::SuseTagsImpl::verifyFile(), zypp::KeyRing::Impl::verifyFile(), zypp::media::MediaDISK::verifyIfDiskVolume(), and zypp::filesystem::zipType().

bool zypp::filesystem::Pathname::empty  )  const [inline]
 

Test for an empty path.

Definition at line 81 of file Pathname.h.

References name_t.

Referenced by absolute(), zypp::filesystem::assert_dir(), basename(), cat(), zypp::media::MediaHandler::checkAttachPoint(), zypp::media::MediaHandler::createAttachPoint(), dirname(), zypp::source::SourceImpl::dumpOn(), zypp::media::AttachPoint::empty(), zypp::ExternalProgram::ExternalProgram(), zypp::source::yum::YUMSourceImpl::factoryInit(), zypp::source::susetags::SuseTagsImpl::factoryInit(), zypp::media::MediaAccess::FileProvider::FileProvider(), zypp::media::getShare(), zypp::zypp_detail::ZYppImpl::homePath(), zypp::target::rpm::librpmDb::DbDirInfo::illegalArgs(), zypp::target::rpm::RpmDb::initDatabase(), zypp::target::rpm::RpmDb::initialized(), zypp::media::MediaManager::isUseableAttachPoint(), zypp::media::MediaHandler::localPath(), zypp::base::logger::LogControlImpl::logfile(), zypp::target::rpm::RpmDb::makePackageFromHeader(), zypp::media::MediaHandler::MediaHandler(), zypp::media::MediaISO::MediaISO(), zypp::source::yum::YUMSourceImpl::metadataRoot(), zypp::source::susetags::SuseTagsImpl::metadataRoot(), zypp::filesystem::PathInfo::operator()(), zypp::source::SourceImpl::refresh(), relative(), zypp::media::MediaHandler::setAttachPrefix(), zypp::source::yum::YUMSourceImpl::storeMetadata(), zypp::source::susetags::SuseTagsImpl::storeMetadata(), zypp::media::stripShare(), zypp::target::rpm::librpmDb::DbDirInfo::usableArgs(), zypp::KeyRing::Impl::verifyFileSignatureWorkflow(), zypp::media::MediaDISK::verifyIfDiskVolume(), and zypp::filesystem::TmpPath::Impl::~Impl().

bool zypp::filesystem::Pathname::absolute  )  const [inline]
 

Test for an absolute path.

Definition at line 83 of file Pathname.h.

References empty(), name_t, and prfx_i.

Referenced by zypp::media::MediaHandler::checkAttachPoint(), zypp::media::MediaHandler::createAttachPoint(), zypp::target::rpm::librpmDb::dbAccess(), zypp::target::rpm::librpmDb::DbDirInfo::DbDirInfo(), zypp::media::MediaCurl::doGetFileCopy(), zypp::target::rpm::RpmDb::initDatabase(), zypp::target::rpm::librpmDb::newLibrpmDb(), and relativename().

bool zypp::filesystem::Pathname::relative  )  const [inline]
 

Test for a relative path.

Definition at line 85 of file Pathname.h.

References empty(), name_t, and prfx_i.

Referenced by absolutename(), zypp::filesystem::assert_dir(), and zypp::media::ProxyInfoSysconfig::ProxyInfoSysconfig().

Pathname zypp::filesystem::Pathname::dirname  )  const [inline]
 

Return all but the last component od this path.

Definition at line 88 of file Pathname.h.

Referenced by zypp::media::MediaAccess::getFile(), and zypp::source::susetags::SuseTagsImpl::initCacheDir().

Pathname zypp::filesystem::Pathname::dirname const Pathname name_tv  )  [static]
 

Definition at line 187 of file Pathname.cc.

References empty(), name_t, and prfx_i.

std::string zypp::filesystem::Pathname::basename  )  const [inline]
 

Return the last component of this path.

Definition at line 92 of file Pathname.h.

Referenced by zypp::media::MediaAccess::getFile().

string zypp::filesystem::Pathname::basename const Pathname name_tv  )  [static]
 

Definition at line 213 of file Pathname.cc.

References asString(), empty(), and prfx_i.

Pathname zypp::filesystem::Pathname::absolutename  )  const [inline]
 

Return this path, adding a leading '/' if relative.

Definition at line 96 of file Pathname.h.

Referenced by zypp::media::getShare(), zypp::media::MediaHandler::localPath(), and zypp::media::stripShare().

static Pathname zypp::filesystem::Pathname::absolutename const Pathname name_tv  )  [inline, static]
 

Definition at line 97 of file Pathname.h.

References cat(), and relative().

Pathname zypp::filesystem::Pathname::relativename  )  const [inline]
 

Return this path, removing a leading '/' if absolute.

Definition at line 101 of file Pathname.h.

static Pathname zypp::filesystem::Pathname::relativename const Pathname name_tv  )  [inline, static]
 

Definition at line 102 of file Pathname.h.

References absolute(), and cat().

Pathname zypp::filesystem::Pathname::cat const Pathname r  )  const [inline]
 

Concatenation of pathnames.

   "foo"  / "baa"  ==> "foo/baa"
   "foo/" / "baa"  ==> "foo/baa"
   "foo"  / "/baa" ==> "foo/baa"
   "foo/" / "/baa" ==> "foo/baa"

Definition at line 113 of file Pathname.h.

Referenced by absolutename(), operator+(), operator+=(), operator/(), operator/=(), and relativename().

Pathname zypp::filesystem::Pathname::cat const Pathname l,
const Pathname r
[static]
 

Definition at line 233 of file Pathname.cc.

References asString(), and empty().

Pathname zypp::filesystem::Pathname::extend const std::string &  r  )  const [inline]
 

Append string r to the last component of the path.

   "foo/baa".extend( ".h" ) ==> "foo/baa.h"

Definition at line 121 of file Pathname.h.

Referenced by zypp::target::rpm::RpmDb::doRebuildDatabase().

static Pathname zypp::filesystem::Pathname::extend const Pathname l,
const std::string &  r
[static]
 

void zypp::filesystem::Pathname::_assign const std::string &  name_tv  )  [private]
 

Referenced by Pathname().


Friends And Related Function Documentation

bool operator== const Pathname l,
const Pathname r
[related]
 

Definition at line 133 of file Pathname.h.

References asString().

bool operator!= const Pathname l,
const Pathname r
[related]
 

Definition at line 137 of file Pathname.h.

References asString().

Pathname operator/ const Pathname l,
const Pathname r
[related]
 

Concatenate two Pathname.

Definition at line 141 of file Pathname.h.

References cat().

Pathname operator+ const Pathname l,
const Pathname r
[related]
 

Concatenate two Pathname.

Deprecated:
: use /

Definition at line 147 of file Pathname.h.

References cat().

std::ostream & operator<< std::ostream &  str,
const Pathname obj
[related]
 

Stream output

Definition at line 153 of file Pathname.h.

References asString().


Member Data Documentation

std::string::size_type zypp::filesystem::Pathname::prfx_i [private]
 

Definition at line 125 of file Pathname.h.

Referenced by absolute(), basename(), dirname(), operator=(), and relative().

std::string zypp::filesystem::Pathname::name_t [private]
 

Definition at line 126 of file Pathname.h.

Referenced by absolute(), asString(), dirname(), empty(), operator=(), and relative().


The documentation for this class was generated from the following files:
Generated on Thu Jul 6 00:07:32 2006 for zypp by  doxygen 1.4.6