From d8f887aa563fe6cb1736aff00c889424d51dcaf2 Mon Sep 17 00:00:00 2001 From: Klaus Kaempf Date: Fri, 27 Jan 2006 11:37:33 +0000 Subject: [PATCH] add name() --- zypp/Source.cc | 4 ++++ zypp/Source.h | 3 +++ zypp/source/SourceImpl.cc | 4 +++- zypp/source/SourceImpl.h | 9 ++++++++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/zypp/Source.cc b/zypp/Source.cc index 9e6ceaa..2450e9f 100644 --- a/zypp/Source.cc +++ b/zypp/Source.cc @@ -87,6 +87,10 @@ namespace zypp void Source::disable() { _pimpl->disable(); } + string name (void) const + { _pimpl->name(); } + + ///////////////////////////////////////////////////////////////// } // namespace zypp /////////////////////////////////////////////////////////////////// diff --git a/zypp/Source.h b/zypp/Source.h index 81a98c1..fece11f 100644 --- a/zypp/Source.h +++ b/zypp/Source.h @@ -13,6 +13,7 @@ #define ZYPP_SOURCE_H #include +#include #include "zypp/base/PtrTypes.h" @@ -84,6 +85,8 @@ namespace zypp void enable(); void disable(); + + std::string name (void) const; }; /////////////////////////////////////////////////////////////////// diff --git a/zypp/source/SourceImpl.cc b/zypp/source/SourceImpl.cc index 6704a4f..9ca58b0 100644 --- a/zypp/source/SourceImpl.cc +++ b/zypp/source/SourceImpl.cc @@ -42,11 +42,13 @@ namespace zypp // METHOD TYPE : Ctor // SourceImpl::SourceImpl(media::MediaAccess::Ptr & media_r, - const Pathname & path_r) + const Pathname & path_r, + const std::string & name_r) : _media(media_r) , _path(path_r) , _enabled(true) , _res_store_initialized(false) + , _name (name_r) {} /////////////////////////////////////////////////////////////////// diff --git a/zypp/source/SourceImpl.h b/zypp/source/SourceImpl.h index ce7f36f..2019695 100644 --- a/zypp/source/SourceImpl.h +++ b/zypp/source/SourceImpl.h @@ -13,6 +13,7 @@ #define ZYPP_SOURCE_SOURCEIMPL_H #include +#include #include "zypp/base/ReferenceCounted.h" #include "zypp/base/NonCopyable.h" @@ -52,7 +53,8 @@ namespace zypp {} /** Ctor. */ SourceImpl(media::MediaAccess::Ptr & media_r, - const Pathname & path_r = "/"); + const Pathname & path_r = "/", + const std::string & name = ""); /** Dtor. */ virtual ~SourceImpl(); @@ -92,6 +94,9 @@ namespace zypp void disable() { _enabled = false; } + std::string name (void) const + { return _name; } + /** Overload to realize stream output. */ virtual std::ostream & dumpOn( std::ostream & str ) const { return str << "SourceImpl"; } @@ -105,6 +110,8 @@ namespace zypp Pathname _path; /** The source is enabled */ bool _enabled; + /** (user defined) name of the source */ + std::string _name; private: /** Null implementation */ static SourceImpl_Ptr _nullimpl; -- 2.7.4