namespace sat
{ /////////////////////////////////////////////////////////////////
+ const std::string & Pool::systemRepoName()
+ {
+ static const std::string _val( "@System" );
+ return _val;
+ }
+
::_Pool * Pool::get() const
{ return myPool().getPool(); }
return Repo();
}
- void Pool::reposErase( const std::string & name_r )
- {
- reposFind( name_r ).eraseFromPool();
- }
-
Repo Pool::addRepoSolv( const Pathname & file_r, const std::string & name_r )
{
// Using a temporay repo! (The additional parenthesis are required.)
return tmprepo;
}
- Repo Pool::addRepoSolv( const Pathname & file_r )
- {
- return addRepoSolv( file_r, file_r.basename() );
- }
-
/******************************************************************
**
** FUNCTION NAME : operator<<
#include <iosfwd>
#include "zypp/sat/detail/PoolMember.h"
+#include "zypp/sat/Repo.h"
///////////////////////////////////////////////////////////////////
namespace zypp
/** Remove a \ref Repo named \c name_r.
* \see \ref Repo::eraseFromPool
*/
- void reposErase( const std::string & name_r );
+ void reposErase( const std::string & name_r )
+ { reposFind( name_r ).eraseFromPool(); }
+
+ public:
+ /** Reserved system repo name \c @System. */
+ static const std::string & systemRepoName();
+
+ /** Return the system repo. */
+ Repo systemRepo()
+ { return reposInsert( systemRepoName() ); }
public:
/** Load \ref Solvables from a solv-file into a \ref Repo named \c name_r.
*/
Repo addRepoSolv( const Pathname & file_r, const std::string & name_r );
/** \overload Using the files basename as \ref Repo name. */
- Repo addRepoSolv( const Pathname & file_r );
+ Repo addRepoSolv( const Pathname & file_r )
+ { return addRepoSolv( file_r, file_r.basename() ); }
public:
/** Whether \ref Pool contains solvables. */
#include "zypp/sat/detail/PoolImpl.h"
#include "zypp/sat/Repo.h"
-#include "zypp/sat/Solvable.h"
+#include "zypp/sat/Pool.h"
using std::endl;
::_Repo * _repo( get() ); \
if ( ! _repo ) ZYPP_THROW( VAL )
+ bool Repo::isSystemRepo() const
+ {
+ NO_REPO_RETURN( false );
+ return( Pool::systemRepoName() == _repo->name );
+ }
+
std::string Repo::name() const
{
NO_REPO_RETURN( std::string() );
/** Evaluate \ref Repo in a boolean context (\c != \c norepo). */
using base::SafeBool<Repo>::operator bool_type;
+ /** Return whether this is the system repo. */
+ bool isSystemRepo() const;
+
public:
/** The repos name (alias?). */
std::string name() const;
return nosolvable;
}
+ bool Solvable::isSystem() const
+ { return repo().isSystemRepo(); }
+
NameId Solvable::name() const
{
NO_SOLVABLE_RETURN( NameId() );
if ( ! obj )
return str << "sat::solvable()";
- return str << "sat::solvable(" << obj.id() << "|" << obj.name() << '-' << obj.evr() << '.' << obj.arch() << "){"
+ return str << "sat::solvable(" << obj.id() << "|"
+ << obj.name() << '-' << obj.evr() << '.' << obj.arch() << "){"
<< obj.repo().name() << "}";
}
/** Evaluate \ref Solvable in a boolean context (\c != \c nosolvable). */
using base::SafeBool<Solvable>::operator bool_type;
+ /** Return whether this \ref Solvable belongs to the system repo. */
+ bool isSystem() const;
+
public:
NameId name() const;
EvrId evr() const;
ArchId arch() const;
VendorId vendor() const;
+ public:
Repo repo() const;
public: