MESSAGE( STATUS "libproxy not found" )
ELSE ( NOT LIBPROXY_FOUND )
INCLUDE_DIRECTORIES( ${LIBPROXY_INCLUDE_DIR} )
- ADD_DEFINITIONS(-D_WITH_LIBPROXY_SUPPORT_)
+ ADD_DEFINITIONS(-DWITH_LIBPROXY_SUPPORT)
ENDIF( NOT LIBPROXY_FOUND )
ENDIF( DISABLE_LIBPROXY )
# See './mkChangelog -h' for help.
#
SET(LIBZYPP_MAJOR "15")
-SET(LIBZYPP_COMPATMINOR "14")
-SET(LIBZYPP_MINOR "18")
+SET(LIBZYPP_COMPATMINOR "19")
+SET(LIBZYPP_MINOR "19")
SET(LIBZYPP_PATCH "0")
#
-# LAST RELEASED: 15.18.0 (14)
+# LAST RELEASED: 15.19.0 (19)
# (The number in parenthesis is LIBZYPP_COMPATMINOR)
#=======
+++ /dev/null
-#include <iostream>
-#include "zypp/base/Logger.h"
-#include "zypp/base/LogTools.h"
-#include "zypp/base/Function.h"
-#include "zypp/base/IOStream.h"
-#include "zypp/base/InputStream.h"
-#include "zypp/ProgressData.h"
-
-#include "zypp/base/Random.h"
-
-#include <boost/thread.hpp>
-
-using std::endl;
-using namespace zypp;
-
-
-void action( int i_r )
-{
- unsigned sec = base::random( 3 );
- sleep( sec );
- MIL << "Action " << i_r << " (" << sec << ")" << endl;
-}
-
-
-int main( int argc, char * argv[] )
-{
- INT << "===[START]==========================================" << endl;
-
- for ( unsigned i = 0; i < 5; ++i )
- {
- new boost::thread( bind( action, i ) );
- }
-
- INT << "===[END]============================================" << endl << endl;
- return ( 0 );
-}
+++ /dev/null
-#include "Tools.h"
-
-#include <zypp/PoolQuery.h>
-#include <zypp/target/rpm/librpmDb.h>
-#include <zypp/parser/ProductFileReader.h>
-
-#include "zypp/sat/WhatObsoletes.h"
-#include "zypp/ExternalProgram.h"
-
-///////////////////////////////////////////////////////////////////
-
-//static const Pathname sysRoot( getenv("SYSROOT") ? getenv("SYSROOT") : "/Local/ROOT" );
-//static const Pathname sysRoot( "/tmp/ToolScanRepos" );
-static const Pathname sysRoot( "/" );
-
-///////////////////////////////////////////////////////////////////
-
-bool solve()
-{
- bool rres = false;
- {
- //zypp::base::LogControl::TmpLineWriter shutUp;
- //getZYpp()->resolver()->setOnlyRequires( true );
- rres = getZYpp()->resolver()->resolvePool();
- }
- if ( ! rres )
- {
- ERR << "resolve " << rres << endl;
- getZYpp()->resolver()->problems();
- return false;
- }
- MIL << "resolve " << rres << endl;
- return true;
-}
-
-bool upgrade()
-{
- bool rres = false;
- {
- //zypp::base::LogControl::TmpLineWriter shutUp;
- Measure x( "Upgrade" );
- rres = getZYpp()->resolver()->doUpgrade();
- }
- if ( ! rres )
- {
- Measure x( "Upgrade Error" );
- ERR << "upgrade " << rres << endl;
- getZYpp()->resolver()->problems();
- return false;
- }
- MIL << "upgrade " << rres << endl;
- return true;
-}
-
-namespace zypp
-{
- namespace target
- {
- void writeUpgradeTestcase();
- }
-}
-
-std::ostream & operator<<( std::ostream & str, const sat::Solvable::SplitIdent & obj )
-{
- str << "{" << obj.ident() << "}{" << obj.kind() << "}{" << obj.name () << "}" << endl;
- return str;
-}
-
-namespace zypp {
-std::ostream & dumpOn( std::ostream & str, const Url & obj )
-{
- str << "{" << obj.getHost() << "}{" << obj.getPort() << "}";
- return str;
-}
-}
-
-int main( int argc, char * argv[] )
-try {
- --argc,++argv;
- zypp::base::LogControl::instance().logToStdErr();
- INT << "===[START]==========================================" << endl;
- ///////////////////////////////////////////////////////////////////
- if ( sysRoot == "/" )
- ::unsetenv( "ZYPP_CONF" );
- ResPool pool( ResPool::instance() );
- sat::Pool satpool( sat::Pool::instance() );
- ///////////////////////////////////////////////////////////////////
- dumpRange( WAR << "satpool.multiversion " , satpool.multiversionBegin(), satpool.multiversionEnd() ) << endl;
- TestSetup::LoadSystemAt( sysRoot, Arch_i586 );
- ///////////////////////////////////////////////////////////////////
-
- char * fix[] = {
- "test"
- };
- argv = fix;
- argc = arraySize(fix);
- for ( ; argc; --argc,++argv )
- {
- ui::Selectable::Ptr p( getSel<Package>( *argv ) );
- if ( p )
- USR << p->setToDelete() << endl;
- else
- ERR << p << endl;
- }
-
- std::set<PoolItem> todel;
- {
- getZYpp()->resolver()->setCleandepsOnRemove( false );
- SEC << "=== Solve noclean:" << endl;
- solve();
- std::copy( make_filter_begin<resfilter::ByTransact>(pool),
- make_filter_end<resfilter::ByTransact>(pool),
- std::inserter( todel, todel.begin() ) );
- WAR << todel << endl;
- }
- {
- getZYpp()->resolver()->setCleandepsOnRemove( true );
- SEC << "=== Solve clean:" << endl;
- solve();
- SEC << "========================================================" << endl;
- for_( it, make_filter_begin<resfilter::ByTransact>(pool), make_filter_end<resfilter::ByTransact>(pool) )
- {
- ( todel.find( *it ) == todel.end() ? INT : USR ) << *it << endl;
- }
- SEC << "========================================================" << endl;
- }
-
-
-
- ///////////////////////////////////////////////////////////////////
- INT << "===[END]============================================" << endl << endl;
- zypp::base::LogControl::instance().logNothing();
- return 0;
-}
-catch ( const Exception & exp )
-{
- INT << exp << endl << exp.historyAsString();
-}
-catch (...)
-{}
-
+++ /dev/null
-#include "Tools.h"
-#include <zypp/ResObjects.h>
-
-#include <zypp/sat/LookupAttr.h>
-#include <zypp/PoolQuery.h>
-#include <zypp/ZYppCallbacks.h>
-
-struct IRR : public zypp::callback::ReceiveReport<zypp::target::rpm::InstallResolvableReport>
-{
- IRR()
- { connect(); }
-#if 0
- enum Action {
- ABORT, // abort and return error
- RETRY, // retry
- IGNORE // ignore the failure
- };
-
- enum Error {
- NO_ERROR,
- NOT_FOUND, // the requested Url was not found
- IO, // IO error
- INVALID // th resolvable is invalid
- };
-
- // the level of RPM pushing
- /** \deprecated We fortunately no longer do 3 attempts. */
- enum RpmLevel {
- RPM,
- RPM_NODEPS,
- RPM_NODEPS_FORCE
- };
-#endif
-
- virtual void reportbegin()
- { SEC << endl; }
- virtual void reportend()
- { SEC << endl; }
-
- virtual void start(Resolvable::constPtr /*resolvable*/)
- { INT << endl; }
-
- virtual bool progress(int /*value*/, Resolvable::constPtr /*resolvable*/)
- {
- static int i = 4;
- if ( --i <= 0 )
- {
- INT << "return abort" << endl;
- return false;
- }
- return true;
- }
-
- virtual Action problem(Resolvable::constPtr /*resolvable*/, Error /*error*/, const std::string &/*description*/, RpmLevel /*level*/)
- {
- INT << "return abort" << endl;
- return ABORT;
- }
-
- virtual void finish(Resolvable::constPtr /*resolvable*/, Error /*error*/, const std::string &/*reason*/, RpmLevel /*level*/)
- { INT << endl; }
-};
-
-struct RRR : public zypp::callback::ReceiveReport<zypp::target::rpm::RemoveResolvableReport>
-{
- RRR()
- { connect(); }
-#if 0
- enum Action {
- ABORT, // abort and return error
- RETRY, // retry
- IGNORE // ignore the failure
- };
-
- enum Error {
- NO_ERROR,
- NOT_FOUND, // the requested Url was not found
- IO, // IO error
- INVALID // th resolvable is invalid
- };
-#endif
-
- virtual void reportbegin()
- { SEC << endl; }
- virtual void reportend()
- { SEC << endl; }
-
- virtual void start( Resolvable::constPtr /*resolvable*/ )
- { INT << endl; }
-
- virtual bool progress(int /*value*/, Resolvable::constPtr /*resolvable*/)
- { INT << endl; return true; }
-
- virtual Action problem( Resolvable::constPtr /*resolvable*/ , Error /*error*/ , const std::string &/*description*/ )
- { INT << endl; return ABORT; }
-
- virtual void finish( Resolvable::constPtr /*resolvable*/ , Error /*error*/ , const std::string &/*reason*/ )
- { INT << endl; }
-};
-
-bool solve()
-{
- static unsigned run = 0;
- USR << "Solve " << run++ << endl;
- bool rres = false;
- {
- zypp::base::LogControl::TmpLineWriter shutUp;
- rres = getZYpp()->resolver()->resolvePool();
- }
- if ( ! rres )
- {
- ERR << "resolve " << rres << endl;
- getZYpp()->resolver()->problems();
- return false;
- }
- return true;
-}
-
-bool install()
-{
- ZYppCommitPolicy pol;
-//pol.dryRun(true);
- pol.rpmInstFlags( pol.rpmInstFlags().setFlag( target::rpm::RPMINST_JUSTDB ) );
- SEC << "START commit..." << endl;
- SEC << getZYpp()->commit( pol ) << endl;
- return true;
-}
-
-/******************************************************************
-**
-** FUNCTION NAME : main
-** FUNCTION TYPE : int
-*/
-int main( int argc, char * argv[] )
-{
- INT << "===[START]==========================================" << endl;
- IRR _irr;
- RRR _rrr;
- Pathname mroot( "/tmp/ToolScanRepos" );
- TestSetup test( mroot, Arch_i586 );
- test.loadTarget();
- test.loadRepos();
-
- ResPool pool( test.pool() );
- ui::Selectable::Ptr sel;
-
- getSel<Package>( "rpm" )->setToInstall();
- vdumpPoolStats( USR << "Selected:"<< endl,
- make_filter_begin<resfilter::ByTransact>(pool),
- make_filter_end<resfilter::ByTransact>(pool) ) << endl;
-
- if ( solve() )
- {
- vdumpPoolStats( USR << "Solved:"<< endl,
- make_filter_begin<resfilter::ByTransact>(pool),
- make_filter_end<resfilter::ByTransact>(pool) ) << endl;
-
- install();
- }
-
- INT << "===[END]============================================" << endl << endl;
- return 0;
-}
-
+++ /dev/null
-#include "Tools.h"
-
-#include <zypp/ResObjects.h>
-#include <zypp/sat/WhatObsoletes.h>
-
-
-static std::string appname( __FILE__ );
-static TestSetup test;
-
-///////////////////////////////////////////////////////////////////
-
-#define OUT USR
-#define HEADL SEC << "===> "
-
-inline std::ostream & errmessage( const std::string & msg_r = std::string() )
-{
- cerr << "*** ";
- if ( ! msg_r.empty() )
- cerr << msg_r << endl;
- return cerr;
-}
-
-int usage( const std::string & msg_r = std::string(), int exit_r = 100 )
-{
- if ( ! msg_r.empty() )
- {
- cerr << endl;
- errmessage( msg_r );
- cerr << endl;
- }
- cerr << "Usage: " << appname << " TESTCASE" << endl;
- cerr << " Load and process testcase." << endl;
- return exit_r;
-}
-
-///////////////////////////////////////////////////////////////////
-
-bool upgrade()
-{
- bool rres = false;
- {
- zypp::base::LogControl::TmpLineWriter shutUp;
- rres = getZYpp()->resolver()->doUpgrade();
- }
- if ( ! rres )
- {
- ERR << "upgrade " << rres << endl;
- getZYpp()->resolver()->problems();
- return false;
- }
- MIL << "upgrade " << rres << endl;
- return true;
-}
-
-bool solve()
-{
- static unsigned run = 0;
- USR << "Solve " << run++ << endl;
- bool rres = false;
- {
- zypp::base::LogControl::TmpLineWriter shutUp;
- rres = getZYpp()->resolver()->resolvePool();
- }
- if ( ! rres )
- {
- ERR << "resolve " << rres << endl;
- getZYpp()->resolver()->problems();
- return false;
- }
-
- return true;
-}
-
-///////////////////////////////////////////////////////////////////
-
-/**
-*/
-struct ArgList
-{
- typedef std::vector<std::string>::const_iterator const_iterator;
-
- ArgList()
- {}
-
- ArgList( const std::string & line_r )
- { str::splitEscaped( line_r, std::back_inserter(_argv) ); }
-
- const_iterator begin() const { const_iterator ret =_argv.begin(); for ( unsigned i = _carg; i; --i ) ++ret; return ret; }
- const_iterator end() const { return _argv.end(); }
-
- void clear() { _argv.clear(); _carg = 0; }
- bool empty() const { return _argv.size() == _carg; }
- unsigned size() const { return _argv.size() - _carg; }
-
- std::string & operator[]( int idx ) { return _argv[_carg+idx]; }
- const std::string & operator[]( int idx ) const { return _argv[_carg+idx]; }
-
- std::string at( int idx ) const { return _carg+idx < _argv.size() ? _argv[_carg+idx] : std::string(); }
-
- unsigned carg() const { return _carg; }
- void poparg( int cnt = 1 ) { _carg = arange( _carg + cnt ); }
-
- public:
- std::vector<std::string> & get() { return _argv; }
- const std::vector<std::string> & get() const { return _argv; }
- private:
- unsigned arange( int idx ) const { return idx < 0 ? 0 : std::min( unsigned(idx), _argv.size() ); }
- private:
- DefaultIntegral<unsigned,0> _carg;
- std::vector<std::string> _argv;
-};
-
-std::ostream & operator<<( std::ostream & str, const ArgList & obj )
-{
- for_( it, 0U, obj.get().size() )
- {
- str << ( it == obj.carg() ? " | " : " " ) << obj.get()[it];
- }
- return str;
-}
-
-///////////////////////////////////////////////////////////////////
-#define DELGATE(N,F) if ( argv.at(0) == #N ) { argv.poparg(); F( argv ); return; }
-///////////////////////////////////////////////////////////////////
-
-void exitCmd( ArgList & argv )
-{
- HEADL << argv << endl;
- INT << "===[END]============================================" << endl << endl;
- zypp::base::LogControl::TmpLineWriter shutUp;
- ::exit( 0 );
-}
-
-///////////////////////////////////////////////////////////////////
-
-void helpCmd( ArgList & argv )
-{
- HEADL << argv << endl;
- OUT << "list repos - list repos in pool" << endl;
- OUT << "list NAME... - list solvables named or providing NAME" << endl;
- OUT << "help - this" << endl;
- OUT << "exit - exit" << endl;
-}
-
-///////////////////////////////////////////////////////////////////
-
-void listReposCmd( ArgList & argv )
-{
- HEADL << "list repos" << endl;
-
- sat::Pool satpool( test.satpool() );
- for_( it, satpool.reposBegin(), satpool.reposEnd() )
- {
- OUT << *it << endl;
- }
-}
-
-void listIdent( IdString ident_r )
-{
- HEADL << "list " << ident_r << endl;
-
- ui::Selectable::Ptr sel( ui::Selectable::get( ident_r ) );
- if ( sel )
- {
- OUT << sel->ident()
- << " I" << sel->installedSize()
- << " A" << sel->availableSize()
- << " " << sel->status()
- << endl;
- for_( it, sel->installedBegin(), sel->installedEnd() )
- {
- OUT << "i " << *it << endl;
- }
- PoolItem cand( sel->candidateObj() );
- for_( it, sel->availableBegin(), sel->availableEnd() )
- {
- OUT << (*it == cand ? "* " : " ") << *it << endl;
- }
- }
-
- {
- sat::WhatProvides q( (Capability( ident_r.id() )) );
- bool head = true;
- for_( it, q.begin(), q.end() )
- {
- if ( it->ident() != ident_r )
- {
- if ( head )
- {
- OUT << "provided by:" << endl;
- head = false;
- }
- OUT << " " << PoolItem( *it ) << endl;
- }
- }
- }
-}
-
-
-void listCmd( ArgList & argv )
-{
- DELGATE( repos, listReposCmd );
-
- for_( it, argv.begin(), argv.end() )
- {
- listIdent( IdString(*it) );
- }
-}
-
-///////////////////////////////////////////////////////////////////
-
-void gocmd( ArgList & argv )
-{
- if ( argv.empty() )
- {
- helpCmd( argv );
- return;
- }
-
- switch ( argv[0][0] )
- {
- case 'e':
- DELGATE( exit, exitCmd );
- break;
-
- case 'h':
- DELGATE( help, helpCmd );
- break;
-
- case 'l':
- DELGATE( list, listCmd );
- break;
- }
- // no command fall back to list
- listCmd( argv );
-}
-
-void goprompt()
-{
- std::cin.tie( &std::cout );
-
- do {
- ArgList argv;
- std::cout << "Hallo : ";
- str::splitEscaped( iostr::getline( std::cin ), std::back_inserter(argv.get()) );
- gocmd( argv );
- } while ( true );
-
-}
-
-///////////////////////////////////////////////////////////////////
-
-/******************************************************************
-**
-** FUNCTION NAME : main
-** FUNCTION TYPE : int
-*/
-int main( int argc, char * argv[] )
-{
- INT << "===[START]==========================================" << endl;
- appname = Pathname::basename( argv[0] );
- --argc;
- ++argv;
- ///////////////////////////////////////////////////////////////////
-
- if ( !argc )
- return usage();
-
- Pathname mtest( *argv );
- --argc;
- ++argv;
-
- if ( ! PathInfo( mtest / "solver-test.xml" ).isFile() )
- {
- return usage( "No testcase at " + mtest.asString() );
- }
-
- ///////////////////////////////////////////////////////////////////
-
- test.loadTestcaseRepos( mtest ); // <<< repos
-#define GOCMD(c) { ArgList argv( #c ); gocmd( argv ); }
- GOCMD( tgt );
- GOCMD( iscsitarget );
- goprompt();
-
- INT << "===[END]============================================" << endl << endl;
- zypp::base::LogControl::TmpLineWriter shutUp;
- return 0;
-}
+++ /dev/null
-#include "Tools.h"
-
-#include <zypp/base/PtrTypes.h>
-#include <zypp/base/Exception.h>
-#include <zypp/base/LogTools.h>
-#include <zypp/base/ProvideNumericId.h>
-#include <zypp/AutoDispose.h>
-
-#include "zypp/ZYppFactory.h"
-#include "zypp/ResPoolProxy.h"
-
-#include "zypp/ZYppCallbacks.h"
-#include "zypp/NVRAD.h"
-#include "zypp/ResPool.h"
-#include "zypp/ResFilters.h"
-#include "zypp/Package.h"
-#include "zypp/Pattern.h"
-#include "zypp/Language.h"
-#include "zypp/Digest.h"
-#include "zypp/PackageKeyword.h"
-
-
-#include "zypp/parser/TagParser.h"
-#include "zypp/parser/susetags/PackagesFileReader.h"
-#include "zypp/parser/susetags/PackagesLangFileReader.h"
-#include "zypp/parser/susetags/PatternFileReader.h"
-#include "zypp/parser/susetags/ContentFileReader.h"
-#include "zypp/parser/susetags/RepoIndex.h"
-#include "zypp/parser/susetags/RepoParser.h"
-#include "zypp/cache/CacheStore.h"
-#include "zypp/RepoManager.h"
-#include "zypp/RepoInfo.h"
-
-#include "zypp/ui/PatchContents.h"
-#include "zypp/ResPoolProxy.h"
-
-using namespace std;
-using namespace zypp;
-using namespace zypp::functor;
-using namespace zypp::ui;
-using zypp::parser::TagParser;
-
-///////////////////////////////////////////////////////////////////
-
-static const Pathname sysRoot( "/Local/GTEST" );
-
-///////////////////////////////////////////////////////////////////
-
-struct Xprint
-{
- bool operator()( const PoolItem & obj_r )
- {
-// handle( asKind<Package>( obj_r ) );
-// handle( asKind<Patch>( obj_r ) );
-// handle( asKind<Pattern>( obj_r ) );
-// handle( asKind<Product>( obj_r ) );
- return true;
- }
-
- void handle( const Package_constPtr & p )
- {
- if ( !p )
- return;
- }
-
- void handle( const Patch_constPtr & p )
- {
- if ( !p )
- return;
- }
-
- void handle( const Pattern_constPtr & p )
- {
- if ( !p )
- return;
- }
-
- void handle( const Product_constPtr & p )
- {
- if ( !p )
- return;
- }
-};
-
-///////////////////////////////////////////////////////////////////
-/******************************************************************
-**
-** FUNCTION NAME : main
-** FUNCTION TYPE : int
-*/
-int main( int argc, char * argv[] )
-{
- //zypp::base::LogControl::instance().logfile( "log.restrict" );
- INT << "===[START]==========================================" << endl;
-
- setenv( "ZYPP_CONF", (sysRoot/"zypp.conf").c_str(), 1 );
-
- RepoManager repoManager( makeRepoManager( sysRoot ) );
- RepoInfoList repos = repoManager.knownRepositories();
- SEC << "knownRepositories " << repos << endl;
-
- if ( repos.empty() )
- {
- RepoInfo nrepo;
- nrepo
- .setAlias( "factorytest" )
- .setName( "Test Repo for factory." )
- .setEnabled( true )
- .setAutorefresh( false )
- .addBaseUrl( Url("http://dist.suse.de/install/stable-x86/") );
-
- repoManager.addRepository( nrepo );
- repos = repoManager.knownRepositories();
- }
-
- for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it )
- {
- RepoInfo & nrepo( *it );
- if ( ! nrepo.enabled() )
- continue;
-
- SEC << "refreshMetadata" << endl;
- repoManager.refreshMetadata( nrepo );
-
- if ( ! repoManager.isCached( nrepo ) || 0 )
- {
- if ( repoManager.isCached( nrepo ) )
- {
- SEC << "cleanCache" << endl;
- repoManager.cleanCache( nrepo );
- }
- SEC << "refreshMetadata" << endl;
- repoManager.refreshMetadata( nrepo, RepoManager::RefreshForced );
- SEC << "buildCache" << endl;
- repoManager.buildCache( nrepo );
- }
-
- SEC << nrepo << endl;
- Repository nrep( repoManager.createFromCache( nrepo ) );
- const zypp::ResStore & store( nrep.resolvables() );
- dumpPoolStats( SEC << "Store: " << endl,
- store.begin(), store.end() ) << endl;
- getZYpp()->addResolvables( store );
- }
-
- ResPool pool( getZYpp()->pool() );
- vdumpPoolStats( USR << "Initial pool:" << endl,
- pool.begin(),
- pool.end() ) << endl;
-
- if ( 0 )
- {
- {
- //zypp::base::LogControl::TmpLineWriter shutUp;
- getZYpp()->initTarget( sysRoot );
- }
- MIL << "Added target: " << pool << endl;
- }
-
- std::for_each( pool.begin(), pool.end(), Xprint() );
-
- ///////////////////////////////////////////////////////////////////
- INT << "===[END]============================================" << endl << endl;
- zypp::base::LogControl::instance().logNothing();
- return 0;
-}
+++ /dev/null
-#include <libxml/xmlreader.h>
-
-#include <iostream>
-
-#include <zypp/base/LogControl.h>
-#include <zypp/base/LogTools.h>
-#include <zypp/base/Function.h>
-#include <zypp/base/GzStream.h>
-#include <zypp/parser/yum/YUMParser.h>
-#include <zypp/Pathname.h>
-
-using namespace std;
-using namespace zypp;
-using namespace zypp::parser::yum;
-
-#include "zypp/parser/yum/YUMParser.h"
-
-///////////////////////////////////////////////////////////////////
-
-template<class _Cl>
- void ti( const _Cl & c )
- {
- SEC << __PRETTY_FUNCTION__ << endl;
- }
-///////////////////////////////////////////////////////////////////
-
-template<class _Parser>
- bool consume( const typename _Parser::value_type & node_r )
- {
- //DBG << node_r << endl;
- return true;
- }
-
-template<class _Parser>
- void parseXmlFile( const Pathname & file_r,
- function<bool(const typename _Parser::value_type &)> consume_r
- = consume<_Parser> )
- {
- Measure x( " zparse "+file_r.asString() );
- ifgzstream istr( file_r.asString().c_str() );
- if ( ! istr )
- {
- ZYPP_THROW( Exception( "Bad stream" ) );
- }
-
- for( _Parser parser( istr, "" ); ! parser.atEnd(); ++parser )
- {
- if ( consume_r && ! consume_r( *parser ) )
- {
- DBG << "abort parseXmlFile " << file_r << endl;
- return;
- }
- }
- }
-
-bool consumeRepomd( const YUMRepomdParser::value_type & node_r )
-{
- DBG << node_r << endl;
- return true;
-}
-
-void zparse( const Pathname & repodata_r )
-{
- Measure x( "ZPARSE" );
- parseXmlFile<YUMRepomdParser> ( repodata_r / "repomd.xml", consumeRepomd );
- parseXmlFile<YUMPrimaryParser> ( repodata_r / "primary.xml" );
- parseXmlFile<YUMOtherParser> ( repodata_r / "other.xml" );
- parseXmlFile<YUMFileListParser>( repodata_r / "filelists.xml" );
- //parseXmlFile<YUMPatchesParser> ( repodata_r / "patches.xml" );
-}
-
-///////////////////////////////////////////////////////////////////
-
-/**
- * processNode:
- * @reader: the xmlReader
- *
- * Dump information about the current node
- */
-template<class _ParserValueType>
-static void
-processNode(xmlTextReaderPtr reader, const _ParserValueType & stp ) {
- const xmlChar *name, *value;
-
- name = xmlTextReaderConstName(reader);
- if (name == NULL)
- name = BAD_CAST "--";
-
- value = xmlTextReaderConstValue(reader);
- string t;
- if ( value )
- {
- t = (const char *)value;
- }
- return;
- printf("%d %d %s %d %d",
- xmlTextReaderDepth(reader),
- xmlTextReaderNodeType(reader),
- name,
- xmlTextReaderIsEmptyElement(reader),
- xmlTextReaderHasValue(reader));
- if (value == NULL)
- printf("\n");
- else {
- if (xmlStrlen(value) > 40)
- printf(" %.40s...\n", value);
- else
- printf(" %s\n", value);
- }
-}
-
-
-/**
- * streamFile:
- * @filename: the file name to parse
- *
- * Parse and print information about an XML file.
- */
-template<class _Parser>
-static void
-streamFile(const char *filename) {
- Measure x( string(" lparse ")+filename );
- xmlTextReaderPtr reader;
- int ret;
-
- typename _Parser::value_type stp;
-
- reader = xmlReaderForFile(filename, NULL, 0);
- if (reader != NULL) {
- ret = xmlTextReaderRead(reader);
- while (ret == 1) {
- stp = new typename _Parser::value_type::element_type;
- processNode(reader, stp);
- ret = xmlTextReaderRead(reader);
- }
- xmlFreeTextReader(reader);
- if (ret != 0) {
- ZYPP_THROW( Exception( string("Failed to parse ") + filename ) );
- }
- } else {
- ZYPP_THROW( Exception( string("Unable to open ") + filename ) );
- }
-}
-
-void lparse( const Pathname & repodata_r )
-{
- Measure x( "LPARSE" );
- /*
- * this initialize the library and check potential ABI mismatches
- * between the version it was compiled for and the actual shared
- * library used.
- */
- LIBXML_TEST_VERSION
-
- streamFile<YUMRepomdParser> ( (repodata_r / "repomd.xml").asString().c_str() );
- streamFile<YUMPrimaryParser> ( (repodata_r / "primary.xml").asString().c_str() );
- streamFile<YUMOtherParser> ( (repodata_r / "other.xml").asString().c_str() );
- streamFile<YUMFileListParser>( (repodata_r / "filelists.xml").asString().c_str() );
- //streamFile<YUMPatchesParser> ( (repodata_r / "patches.xml").asString().c_str() );
-
- /*
- * Cleanup function for the XML library.
- */
- xmlCleanupParser();
-
- /*
- * this is to debug memory for regression tests
- */
- xmlMemoryDump();
-}
-
-/******************************************************************
-**
-** FUNCTION NAME : main
-** FUNCTION TYPE : int
-*/
-int main( int argc, char * argv[] )
-{
- INT << "===[START]==========================================" << endl;
-
- Pathname repodata( "/Local/PATCHES/repodata" );
- repodata = "/Local/FACTORY/repodata";
- lparse( repodata );
- zparse( repodata );
-
- INT << "===[END]============================================" << endl << endl;
- return 0;
-}
-
///////////////////////////////////////////////////////////////////
//
- // CLASS NAME : ExplicitMap<_Key, _Tp>
+ // CLASS NAME : ExplicitMap<TKey, Tp>
//
/** A simple lookup map using default value for not existing entries.
*
* \ref TmpUnset and \ref TmpSetDefault are provided to temporarily
* change and automaticlly restore values.
*/
- template<class _Key, class _Tp>
+ template<class TKey, class Tp>
class ExplicitMap
{
public:
- typedef typename boost::call_traits<_Tp>::value_type value_type;
- typedef typename boost::call_traits<_Tp>::reference reference;
- typedef typename boost::call_traits<_Tp>::const_reference const_reference;
- typedef typename boost::call_traits<_Tp>::param_type param_type;
+ typedef typename boost::call_traits<Tp>::value_type value_type;
+ typedef typename boost::call_traits<Tp>::reference reference;
+ typedef typename boost::call_traits<Tp>::const_reference const_reference;
+ typedef typename boost::call_traits<Tp>::param_type param_type;
private:
- typedef typename std::map<_Key,value_type> map_type;
+ typedef typename std::map<TKey,value_type> map_type;
typedef typename map_type::iterator iterator;
public:
: _mapDefault( mapDefault_r )
{}
- template <class _InputIterator>
- ExplicitMap( _InputIterator first_r, _InputIterator last_r )
+ template <class TInputIterator>
+ ExplicitMap( TInputIterator first_r, TInputIterator last_r )
: _map( first_r, last_r )
{}
- template <class _InputIterator>
- ExplicitMap( _InputIterator first_r, _InputIterator last_r,
+ template <class TInputIterator>
+ ExplicitMap( TInputIterator first_r, TInputIterator last_r,
param_type mapDefault_r )
: _map( first_r, last_r )
, _mapDefault( mapDefault_r )
void set( const key_type & key_r, param_type value_r )
{ _map[key_r] = value_r; }
- template <typename _InputIterator>
- void set( _InputIterator first_r, _InputIterator last_r )
+ template <typename TInputIterator>
+ void set( TInputIterator first_r, TInputIterator last_r )
{ _map.insert( first_r, last_r ); }
void unset( const key_type & key_r )
///////////////////////////////////////////////////////////////////
//
- // CLASS NAME : ExplicitMap<_Key, _Tp>::TmpSet
+ // CLASS NAME : ExplicitMap<TKey, Tp>::TmpSet
//
/** Temporarily set a value. */
- template<class _Key, class _Tp>
- class ExplicitMap<_Key, _Tp>::TmpSet
+ template<class TKey, class Tp>
+ class ExplicitMap<TKey, Tp>::TmpSet
{
public:
TmpSet( ExplicitMap & map_r, const key_type & key_r, param_type value_r )
///////////////////////////////////////////////////////////////////
//
- // CLASS NAME : ExplicitMap<_Key, _Tp>::TmpUnset
+ // CLASS NAME : ExplicitMap<TKey, Tp>::TmpUnset
//
/** Temporarily unset a value. */
- template<class _Key, class _Tp>
- class ExplicitMap<_Key, _Tp>::TmpUnset
+ template<class TKey, class Tp>
+ class ExplicitMap<TKey, Tp>::TmpUnset
{
public:
TmpUnset( ExplicitMap & map_r, const key_type & key_r )
///////////////////////////////////////////////////////////////////
//
- // CLASS NAME : ExplicitMap<_Key, _Tp>::TmpSetDefault
+ // CLASS NAME : ExplicitMap<TKey, Tp>::TmpSetDefault
//
/** Temporarily change the default value. */
- template<class _Key, class _Tp>
- class ExplicitMap<_Key, _Tp>::TmpSetDefault
+ template<class TKey, class Tp>
+ class ExplicitMap<TKey, Tp>::TmpSetDefault
{
public:
TmpSetDefault( ExplicitMap & map_r, param_type value_r )
+++ /dev/null
-#include "Tools.h"
-#include "Tools.h"
-
-#include <iostream>
-
-#include <zypp/base/LogControl.h>
-#include <zypp/base/LogTools.h>
-#include <zypp/base/String.h>
-#include <zypp/base/SerialNumber.h>
-#include <zypp/PathInfo.h>
-#include <zypp/TmpPath.h>
-#include "zypp/ResPoolProxy.h"
-
-using namespace std;
-using namespace zypp;
-using namespace zypp::ui;
-
-bool chst( Selectable::Ptr & sel, Status status )
-{
- DBG << "+++ " << sel << endl;
- Status ostatus( sel->status() );
- bool res = sel->set_status( status );
- (res?MIL:WAR) << ostatus << " -> " << status << " ==>(" << res << ") " << sel->status() << endl;
- DBG << "--- " << sel << endl;
- return res;
-}
-
-/******************************************************************
-**
-** FUNCTION NAME : main
-** FUNCTION TYPE : int
-*/
-int main( int argc, char * argv[] )
-{
- INT << "===[START]==========================================" << endl;
-
- const char *const lines[] = {
- "@ package",
- "@ installed",
- "- foo 1 1 i686",
- "@ available",
- "- foo 2 1 i686",
- "@ fin"
- };
-
- debug::addPool( lines, lines+(sizeof(lines)/sizeof(const char *const)) );
-
- ResPool pool( getZYpp()->pool() );
- ResPoolProxy uipool( getZYpp()->poolProxy() );
-
- USR << pool << endl;
- USR << uipool << endl;
-
- //for_each( pool.begin(), pool.end(), Print() );
-
- Selectable::Ptr sel( *uipool.byKindBegin<Package>() );
-
-/* enum Status
- {
- S_Protected, // Keep this unmodified ( have installedObj && S_Protected )
- S_Taboo, // Keep this unmodified ( have no installedObj && S_Taboo)
- // requested by user:
- S_Del, // delete installedObj ( clears S_Protected if set )
- S_Update, // install candidateObj ( have installedObj, clears S_Protected if set )
- S_Install, // install candidateObj ( have no installedObj, clears S_Taboo if set )
- // not requested by user:
- S_AutoDel, // delete installedObj
- S_AutoUpdate, // install candidateObj ( have installedObj )
- S_AutoInstall, // install candidateObj ( have no installedObj )
- // no modification:
- S_KeepInstalled, // no modification ( have installedObj && !S_Protected, clears S_Protected if set )
- S_NoInst, // no modification ( have no installedObj && !S_Taboo, clears S_Taboo if set )
- };
-*/
- MIL << sel << endl;
- chst( sel, ui::S_Update );
- chst( sel, ui::S_Install );
- chst( sel, ui::S_Protected );
- chst( sel, ui::S_KeepInstalled );
-
- INT << "===[END]============================================" << endl
- << endl;
- return 0;
-}
+++ /dev/null
-#if 0
-#define FakePool_h
-
-#include <iostream>
-#include <vector>
-#include <string>
-
-#include "zypp/base/LogTools.h"
-#include "zypp/base/PtrTypes.h"
-#include "zypp/base/Algorithm.h"
-#include "zypp/base/Function.h"
-#include "zypp/base/Functional.h"
-#include "zypp/base/IOStream.h"
-#include "zypp/base/String.h"
-
-#include "zypp/ZYppFactory.h"
-#include "zypp/ResPool.h"
-#include "zypp/ResPoolProxy.h"
-#include "zypp/CapFactory.h"
-
-#include "zypp/Atom.h"
-#include "zypp/Package.h"
-#include "zypp/SrcPackage.h"
-#include "zypp/Selection.h"
-#include "zypp/Pattern.h"
-#include "zypp/Product.h"
-#include "zypp/Patch.h"
-#include "zypp/Script.h"
-#include "zypp/Message.h"
-#include "zypp/Language.h"
-#include "zypp/VendorAttr.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace debug
- { /////////////////////////////////////////////////////////////////
-
- /**
- * \code
- * const char * data[] = {
- * "@ product"
- * ,"@ installed"
- * ,"- prodold 1 1 x86_64"
- * ,"@ available"
- * ,"- prodnew 1 1 x86_64"
- * ,"@ obsoletes"
- * ,"prodold"
- * ,"@ fin"
- * };
- * DataCollect dataCollect;
- * for_each( data, data + ( sizeof(data) / sizeof(const char *) ),
- * function<void(const string &)>( ref( dataCollect ) ) );
- * \endcode
- */
- class DataCollect
- {
- public:
- DataCollect( bool verbose_r = true )
- : _definst( false )
- , _defkind( ResKind::package )
- , _defdep( Dep::PROVIDES )
- , _defdepref( _defkind )
- , _verbose( verbose_r )
- {
- VendorAttr::disableAutoProtect();
- }
-
- bool operator()( const std::string & line_r )
- {
- parseLine( str::trim( line_r ) );
- return true;
- }
-
- const ResStore & installed() const
- { return _installed; }
-
- const ResStore & available() const
- { return _available; }
-
- template<class _Iterator>
- void collect( _Iterator begin_r, _Iterator end_r )
- {
- for_each( begin_r, end_r,
- function<void(const std::string &)>( ref(*this) ) );
- }
-
- private:
- struct Data
- {
- Data( bool inst_r, Resolvable::Kind kind_r, const std::vector<std::string> & words_r )
- : _inst( inst_r )
- , _kind( kind_r )
- , _data( words_r[1], Edition( words_r[2], words_r[3] ), Arch( words_r[4] ) )
- {}
-
- bool _inst;
- Resolvable::Kind _kind;
- NVRAD _data;
- };
-
- private:
- void parseLine( const std::string & line_r )
- {
- if ( line_r.empty() || line_r[0] == '#' )
- return;
-
- std::vector<std::string> words;
- str::split( line_r, std::back_inserter( words ) );
- if ( words.empty() )
- return;
-
- if ( words[0] == "@" )
- {
- if ( words.size() < 2 )
- throw line_r;
- if ( words[1] == "installed" )
- _definst = true;
- else if ( words[1] == "available" )
- _definst = false;
- else if ( words[1] == "fin" )
- finalize();
- else
- {
- try
- {
- _defdep = Dep( words[1] );
- if ( words.size() > 2 )
- _defdepref = Resolvable::Kind( words[2] );
- }
- catch ( ... )
- {
- _defkind = _defdepref = Resolvable::Kind( words[1] );
- }
- return;
- }
- }
- else if ( words[0] == "-" )
- {
- if ( words.size() == 5 )
- {
- finalize();
- _d.reset( new Data( _definst, _defkind, words ) );
- }
- else
- {
- throw words;
- }
- }
- else
- {
- _d->_data[_defdep].insert( CapFactory().parse( _defdepref, line_r ) );
- }
- }
-
- void finalize()
- {
- if ( _d )
- {
- ResObject::Ptr p;
- if ( _d->_kind == ResKind::package )
- p = make<Package>();
- else if ( _d->_kind == ResKind::srcpackage )
- p = make<SrcPackage>();
- else if ( _d->_kind == ResTraits<Selection>::kind )
- p = make<Selection>();
- else if ( _d->_kind == ResKind::pattern )
- p = make<Pattern>();
- else if ( _d->_kind == ResKind::product )
- p = make<Product>();
- else if ( _d->_kind == ResKind::patch )
- p = make<Patch>();
- else if ( _d->_kind == ResTraits<Script>::kind )
- p = make<Script>();
- else if ( _d->_kind == ResTraits<Message>::kind )
- p = make<Message>();
- else if ( _d->_kind == ResTraits<Language>::kind )
- p = make<Language>();
- else if ( _d->_kind == ResTraits<Atom>::kind )
- p = make<Atom>();
- else
- throw _d->_kind;
-
- if ( _verbose )
- {
- _MIL("FakePool") << (_d->_inst?"i":"a") << " " << p << std::endl;
- _DBG("FakePool") << p->deps() << std::endl;
- }
-
- (_d->_inst?_installed:_available).insert( p );
- _d.reset();
- }
- }
-
- template<class _Res>
- ResObject::Ptr make()
- {
- typename detail::ResImplTraits<typename _Res::Impl>::Ptr impl;
- return zypp::detail::makeResolvableAndImpl( _d->_data, impl );
- }
-
- private:
- bool _definst;
- Resolvable::Kind _defkind;
- Dep _defdep;
- Resolvable::Kind _defdepref;
-
- bool _verbose;
-
- shared_ptr<Data> _d;
-
- ResStore _installed;
- ResStore _available;
- };
- ///////////////////////////////////////////////////////////////////
-
- /** \relates DataCollect Stream output. */
- inline std::ostream & operator<<( std::ostream & str, const DataCollect & obj )
- {
- dumpRange( str << "Installed" << endl,
- obj.installed().begin(),
- obj.installed().end() ) << endl;
- dumpRange( str << "Available:" << endl,
- obj.available().begin(),
- obj.available().end() ) << endl;
- return str;
- }
-
- ///////////////////////////////////////////////////////////////////
-
- template<class _Iterator>
- inline void addPool( _Iterator begin_r, _Iterator end_r )
- {
- DataCollect dataCollect;
- dataCollect.collect( begin_r, end_r );
- getZYpp()->addResolvables( dataCollect.installed(), true );
- getZYpp()->addResolvables( dataCollect.available() );
- }
-
- inline void addPool( const Pathname & file_r )
- {
- std::ifstream in( file_r.c_str() );
- DataCollect dataCollect;
- function<bool(const std::string &)> fnc( ref(dataCollect) );
- iostr::forEachLine( in, fnc );
- getZYpp()->addResolvables( dataCollect.installed(), true );
- getZYpp()->addResolvables( dataCollect.available() );
- }
-
- /////////////////////////////////////////////////////////////////
- } // namespace debug
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // FakePool_h
+++ /dev/null
-#include "Tools.h"
-#include <boost/call_traits.hpp>
-
-#include <iostream>
-#include <fstream>
-#include <map>
-
-#include <zypp/base/LogControl.h>
-#include <zypp/base/LogTools.h>
-
-#include "zypp/parser/xml/Reader.h"
-
-using namespace std;
-using namespace zypp;
-
-#include "zypp/base/Exception.h"
-#include "zypp/base/InputStream.h"
-#include "zypp/base/DefaultIntegral.h"
-#include <zypp/base/Function.h>
-#include <zypp/base/Iterator.h>
-#include <zypp/Pathname.h>
-#include <zypp/ExplicitMap.h>
-#include <zypp/Depository.h>
-#include <zypp/Edition.h>
-#include <zypp/CheckSum.h>
-#include <zypp/Date.h>
-
-///////////////////////////////////////////////////////////////////
-
-template<class _Cl>
- void ti( const _Cl & c )
- {
- SEC << __PRETTY_FUNCTION__ << endl;
- }
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{
- namespace parser
- {
- namespace yum
- {
- ///////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- }
- }
-}
-///////////////////////////////////////////////////////////////////
-
-bool nopNode( xml::Reader & reader_r )
-{
- return true;
-}
-
-bool accNode( xml::Reader & reader_r )
-{
- int i;
- xml::XmlString s;
-#define X(m) reader_r->m()
- i=X(readState);
- i=X(lineNumber);
- i=X(columnNumber);
- i=X(depth);
- i=X(nodeType);
- s=X(name);
- s=X(prefix);
- s=X(localName);
- i=X(hasAttributes);
- i=X(attributeCount);
- i=X(hasValue);
- s=X(value);
-#undef X
- return true;
-}
-
-bool dumpNode( xml::Reader & reader_r )
-{
- switch ( reader_r->nodeType() )
- {
- case XML_READER_TYPE_ATTRIBUTE:
- DBG << *reader_r << endl;
- break;
- case XML_READER_TYPE_ELEMENT:
- MIL << *reader_r << endl;
- break;
- default:
- WAR << *reader_r << endl;
- break;
- }
- return true;
-}
-
-bool dumpNode2( xml::Reader & reader_r )
-{
- dumpNode( reader_r );
- return reader_r.foreachNodeAttribute( dumpNode );
-}
-
-bool dumpEd( xml::Reader & reader_r )
-{
- static int num = 5;
- if ( reader_r->nodeType() == XML_READER_TYPE_ELEMENT
- && reader_r->name() == "version" )
- {
- MIL << *reader_r << endl;
- DBG << reader_r->getAttribute( "rel" ) << endl;
- ERR << *reader_r << endl;
- DBG << reader_r->getAttribute( "ver" ) << endl;
- ERR << *reader_r << endl;
- DBG << reader_r->getAttribute( "epoch" ) << endl;
- ERR << *reader_r << endl;
- WAR << Edition( reader_r->getAttribute( "ver" ).asString(),
- reader_r->getAttribute( "rel" ).asString(),
- reader_r->getAttribute( "epoch" ).asString() ) << endl;
- --num;
- }
- return num;
-}
-
-
-///////////////////////////////////////////////////////////////////
-
-namespace parser
-{
- namespace consume
- {
- struct Repomd
- {
- struct Data
- {
- Depository<std::string> _type;
- Depository<CheckSum> _checksum;
- Depository<Date> _timestamp;
- Depository<CheckSum> _openChecksum;
- };
-
- Depository<Data> _data;
- };
- }
-
-
-
-}
-
-namespace data
-{
- struct Repomd
- {
- struct Data
- {
- std::string _type;
- CheckSum _checksum;
- Date _timestamp;
- CheckSum _openChecksum;
- };
-
- std::map<std::string, Data> _data;
- };
-}
-
-///////////////////////////////////////////////////////////////////
-
-
-
-struct Element;
-std::ostream & operator<<( std::ostream & str, const Element & obj );
-
-struct Element : private base::NonCopyable
-{
- Element( xml::Reader & reader_r )
- : _reader( reader_r )
- , _name( _reader->name().asString() )
- , _depth( _reader->depth() )
- {
- MIL << *this << endl;
- //return;
- while( nextElement() )
- {
- Element el( _reader );
- }
- }
-
- ~Element()
- {
- while( nextElement() )
- { ; }
- DBG << *this << endl;
- }
-
- bool atBegin() const
- {
- return ( _reader->depth() == _depth
- && _reader->nodeType() == XML_READER_TYPE_ELEMENT
- && _reader->name().c_str() == _name );
- }
-
- bool atEnd() const
- {
- return ( _reader->depth() == _depth
- && ( _reader->nodeType() == XML_READER_TYPE_END_ELEMENT
- || ( _reader->nodeType() == XML_READER_TYPE_ELEMENT
- && _reader->isEmptyElement() ) )
- && _reader->name().c_str() == _name );
- }
-
- bool nextElement()
- {
- while ( ! atEnd() )
- {
- if ( ! _reader.nextNode() )
- return false;
- if ( _reader->nodeType() == XML_READER_TYPE_ELEMENT )
- return true;
- WAR << *_reader << endl;
- }
- return false;
- }
-
-
- xml::Reader & _reader;
- std::string _name;
- int _depth;
-};
-
-std::ostream & operator<<( std::ostream & str, const Element & obj )
-{
- str << ( obj.atBegin() ? 'B' : '_' )
- << ( obj.atEnd() ? 'E' : '_' )
- << obj._depth << ":" << std::string( obj._depth, ' ') << obj._name
- << " {" << *obj._reader << '}';
- return str;
-}
-
-bool dumpEl( xml::Reader & reader_r )
-{
- Element el( reader_r );
- return true;
-}
-
-void parse2( const InputStream & file_r )
-{
- Measure x( file_r.name() );
- try
- {
- MIL << file_r << endl;
- xml::Reader r( file_r );
- MIL << *r << endl;
- Element el( r );
- MIL << *r << endl;
- }
- catch ( const Exception & )
- {
- }
-}
-///////////////////////////////////////////////////////////////////
-class BasicParser
-{
- public:
- typedef function<void( xml::Reader & )> Consumer;
- typedef ExplicitMap<std::string,Consumer> ConsumerMap;
-
- BasicParser( const InputStream & file_r )
- : _reader( file_r )
- , _cmap( nop )
- {}
-
- public:
- xml::Reader & reader()
- { return _reader; }
-
- const xml::Reader & reader() const
- { return _reader; }
-
- ConsumerMap & cmap()
- { return _cmap; }
-
- const ConsumerMap & cmap() const
- { return _cmap; }
-
- public:
-
- bool parse( xml::Reader & reader_r )
- {
- switch ( reader_r->nodeType() )
- {
- case XML_READER_TYPE_ELEMENT:
- case XML_READER_TYPE_TEXT:
- case XML_READER_TYPE_CDATA:
- case XML_READER_TYPE_END_ELEMENT:
- consume( reader_r );
- default:
- ;
- }
- return true;
- }
-
- public:
- void consume( xml::Reader & reader_r, const std::string & key_r )
- { _cmap[key_r]( reader_r ); }
-
- void consume( xml::Reader & reader_r )
- { consume( reader_r, reader_r->name().asString() ); }
-
- void consume()
- { consume( _reader ); }
-
- public:
- static void nop( xml::Reader & reader_r )
- { ; }
-
- static void log( xml::Reader & reader_r )
- { DBG << "NOP " << *reader_r << endl; }
-
-
- protected:
- xml::Reader _reader;
- ConsumerMap _cmap;
-};
-
-///////////////////////////////////////////////////////////////////
-
-struct RepomdParser : private BasicParser
-{
- RepomdParser( const InputStream & file_r )
- : BasicParser( file_r )
- {
- reader().foreachNode( ref(*this) );
- }
-
- bool operator()( xml::Reader & reader_r )
- {
- return parse( reader_r );
- }
-
- // READER goes here!
-};
-
-///////////////////////////////////////////////////////////////////
-struct Consume
-{
- struct Entry
- {
- Pathname _location;
- CheckSum _checksum;
- //unused: Date _timestamp;
- //unused: CheckSum _openChecksum;
- };
-
- typedef void (Consume::*Consumer)( xml::Reader & reader_r );
-
- Consume( const InputStream & file_r )
- : _reader( file_r )
- , _consume( &Consume::nop )
- , _centry( NULL )
- {
- _consume.set( "data", &Consume::data );
- _reader.foreachNode( ref(*this) );
- }
-
- bool operator()( xml::Reader & reader_r )
- {
- switch ( reader_r->nodeType() )
- {
- case XML_READER_TYPE_ELEMENT:
- (this->*_consume[reader_r->name().asString()])( reader_r );
- //data( reader_r );
- break;
- default:
- WAR << *_reader << endl;
- break;
- }
- return true;
- }
-
- void nop( xml::Reader & reader_r )
- { ; }
-
- void log( xml::Reader & reader_r )
- { DBG << "NOP " << *_reader << endl; }
-
- void data( xml::Reader & reader_r )
- {
- MIL << *_reader << endl;
- _result[reader_r->name().asString()] = Entry();
- }
-
-
-
- xml::Reader _reader;
- ExplicitMap<std::string,Consumer> _consume;
- std::map<std::string,Entry> _result;
- Entry * _centry;
-};
-
-std::ostream & operator<<( std::ostream & str, const Consume & obj )
-{
- return str;
-}
-
-std::ostream & operator<<( std::ostream & str, const Consume::Entry & obj )
-{
- return str << "Entry";
-}
-
-void parse( const InputStream & file_r )
-{
- Measure x( file_r.name() );
- try
- {
- MIL << file_r << endl;
- RepomdParser a( file_r );
- //WAR << a._result << endl;
- }
- catch ( const Exception & )
- {
- }
-}
-
-struct Test
-{
- struct Mix
- {
- Mix()
- : a( 0 )
- {}
-
- void seta( int v )
- { a = v; }
-
- void setb( const string & v )
- { b = v; }
-
- int a;
- string b;
- };
-
- Test()
- : a( 0 )
- {}
-
- int a;
- string b;
- Mix c;
-};
-
-std::ostream & operator<<( std::ostream & str, const Test & obj )
-{
- return str << "Test(" << obj.a << '|' << obj.b
- << '|' << obj.c.a << '|' << obj.c.b << ')';
-}
-
-struct Transform
-{
- Transform()
- : outfile( "susedu.xml", std::ios_base::out )
- {}
-
- static const bool indented = !false;
- static const bool shorttags = !true;
- std::fstream outfile;
-
- bool operator()( xml::Reader & reader_r )
- {
- switch ( reader_r->nodeType() )
- {
- case XML_READER_TYPE_ELEMENT:
- process( reader_r, true );
- break;
- case XML_READER_TYPE_END_ELEMENT:
- process( reader_r, false );
- break;
- default:
- //WAR << *reader_r << endl;
- break;
- }
- return true;
- }
-
- struct File
- {
- std::string name;
- std::string type;
-
- bool operator<( const File & rhs ) const
- { return( name < rhs.name ); }
- };
-
- struct Package
- {
- std::string pkgid;
- std::string name;
- std::string epoch;
- std::string ver;
- std::string rel;
- std::string arch;
- std::set<File> files;
- };
-
- shared_ptr<Package> pkg;
-
- void process( xml::Reader & reader_r, bool open_r )
- {
- if ( reader_r->name() == "file" )
- {
- if ( open_r )
- addFile( reader_r );
- }
- else if ( reader_r->name() == "version" )
- {
- if ( open_r )
- addVersion( reader_r );
- }
- else if ( reader_r->name() == "package" )
- {
- if ( open_r )
- startPackage( reader_r );
- else
- endPackage();
- }
- else if ( reader_r->name() == "filelists" )
- {
- DBG << *reader_r << endl;
- if ( open_r )
- {
- DBG << outfile << endl;
- outfile << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
- outfile << "<susedu>" << endl;
- }
- else
- {
- outfile << "</susedu>" << endl;
- outfile.close();
- }
- }
- else
- {
- throw;
- }
- }
-
- void startPackage( xml::Reader & reader_r )
- {
- endPackage();
- pkg.reset( new Package );
- pkg->pkgid = reader_r->getAttribute( "pkgid" ).asString();
- pkg->name = reader_r->getAttribute( "name" ).asString();
- pkg->arch = reader_r->getAttribute( "arch" ).asString();
- }
-
- void addVersion( xml::Reader & reader_r )
- {
- pkg->epoch = reader_r->getAttribute( "epoch" ).asString();
- pkg->ver = reader_r->getAttribute( "ver" ).asString();
- pkg->rel = reader_r->getAttribute( "rel" ).asString();
- }
-
- void addFile( xml::Reader & reader_r )
- {
- File f;
- f.type = reader_r->getAttribute( "type" ).asString();
- for( reader_r.nextNode();
- reader_r->nodeType() != XML_READER_TYPE_END_ELEMENT;
- reader_r.nextNode() )
- {
- if ( reader_r->nodeType() == XML_READER_TYPE_TEXT )
- {
- f.name = reader_r->value().asString();
- }
- }
- pkg->files.insert( f );
- }
-
- void endPackage()
- {
- if ( pkg )
- {
- writePackage( outfile );
- pkg.reset();
- }
- }
-
- static std::ostream & putAttr( std::ostream & stream_r,
- const std::string & tag_r,
- const std::string & value_r )
- {
- if ( value_r.empty() || tag_r.empty() )
- return stream_r;
- return stream_r
- << str::form( " %s=\"%s\"", tag_r.c_str(), value_r.c_str() );
- }
-
- void writePackage( std::ostream & stream_r )
- {
- stream_r << " <package";
- putAttr( stream_r, "pkgid", pkg->pkgid );
- putAttr( stream_r, "name", pkg->name );
- putAttr( stream_r, "arch", pkg->arch );
- stream_r << ">\n";
-
- stream_r << " <version";
- putAttr( stream_r, "epoch", pkg->epoch );
- putAttr( stream_r, "ver", pkg->ver );
- putAttr( stream_r, "rel", pkg->rel );
- stream_r << "/>\n";
-
- writePackageFiles2( stream_r );
-
- stream_r << " </package>\n";
- }
-
- void writePackageFiles( std::ostream & stream_r )
- {
- for ( std::set<File>::const_iterator it = pkg->files.begin();
- it != pkg->files.end(); ++it )
- {
- stream_r << " <file";
- putAttr( stream_r, "type", it->type );
- stream_r << ">" << it->name << "</file>\n";
- }
- }
-
- struct Fnode
- {
- Fnode( const std::string & name_r )
- : name( name_r )
- , entry( NULL )
- {}
-
- std::string name;
- mutable const File * entry;
- mutable std::set<Fnode> children;
-
- const Fnode * add( const std::string & sub_r ) const
- {
- std::set<Fnode>::iterator i = children.find( sub_r );
- if ( i != children.end() )
- return &(*i);
- return &(*(children.insert( Fnode( sub_r ) ).first));
- }
-
- void dump( std::ostream & stream_r, const std::string & pname, unsigned level ) const
- {
- std::string tname;
- if ( pname.empty() )
- {
- tname = name;
- }
- else if ( pname == "/" )
- {
- tname = pname+name;
- }
- else
- {
- tname = pname+"/"+name;
- }
-
- if ( children.size() == 1 )
- {
- children.begin()->dump( stream_r, tname, (indented?level:0) );
- return;
- }
-
- std::string tag;
- stream_r << std::string( level, ' ' );
-
- if ( entry )
- {
- tag = (shorttags ? "f" : "file");
- stream_r << "<" << tag;
- putAttr( stream_r, (shorttags ? "t" : "type"), entry->type );
- putAttr( stream_r, (shorttags ? "n" : "name"), tname );
- }
- else
- {
- tag = (shorttags ? "b" : "base");
- stream_r << "<" << tag;
- putAttr( stream_r, (shorttags ? "n" : "name"), tname );
- }
-
- if ( children.empty() )
- {
- stream_r << "/>" << (indented?"\n":"");
- }
- else
- {
- stream_r << ">" << (indented?"\n":"");
- for ( std::set<Fnode>::const_iterator it = children.begin();
- it != children.end(); ++it )
- {
- it->dump( stream_r, "", (indented?level+1:0) );
- }
- stream_r << std::string( level, ' ' ) << "</" << tag << ">" << (indented?"\n":"");
- }
- }
-
- bool operator<( const Fnode & rhs ) const
- { return( name < rhs.name ); }
- };
-
- void writePackageFiles2( std::ostream & stream_r )
- {
- Fnode root( "" );
- for ( std::set<File>::const_iterator it = pkg->files.begin();
- it != pkg->files.end(); ++it )
- {
- std::list<std::string> words;
- str::split( it->name, std::back_inserter(words), "/" );
-
- const Fnode * c = &root;
- for ( std::list<std::string>::const_iterator w = words.begin();
- w != words.end(); ++w )
- {
- c = c->add( *w );
- }
- c->entry = &(*it);
- }
- root.dump( stream_r, "/", (indented?3:0) );
- }
-
-};
-
-/******************************************************************
-**
-** FUNCTION NAME : main
-** FUNCTION TYPE : int
-*/
-int main( int argc, char * argv[] )
-{
- INT << "===[START]==========================================" << endl;
- {
- Measure x;
- Pathname repodata( "/Local/PATCHES/repodata" );
- //repodata = "/Local/FACTORY/repodata";
- xml::Reader reader( repodata/"filelists.xml" );
- Transform t;
- reader.foreachNode( ref(t) );
- }
- INT << "===[END]============================================" << endl << endl;
- return 0;
- int s;
-
- Pathname repodata( "/Local/PATCHES/repodata" );
- //repodata = "/Local/FACTORY/repodata";
- InputStream x ( "/Local/PATCHES/repodata" );
- parse2( repodata/"repomd.xml" );
- //parse2( repodata/"primary.xml" );
-
- INT << "===[END]============================================" << endl << endl;
- return 0;
- {
- Measure x;
- for ( int i = 1; i; --i )
- {
- parse( repodata/"repomd.xml" );
- parse( repodata/"primary.xml" );
- parse( repodata/"filelists.xml" );
- parse( repodata/"other.xml" );
- }
- }
- ERR << "done..." << endl;
- cin >> s;
- return 0;
- {
- Measure x;
- for ( int i = 20; i; --i )
- {
- parse( (repodata/"repomd.xml").asString() );
- parse( repodata/"primary.xml" );
- parse( repodata/"filelists.xml" );
- parse( repodata/"other.xml" );
- }
- }
- ERR << "done..." << endl;
- cin >> s;
-
- INT << "===[END]============================================" << endl << endl;
- return 0;
-}
-
* runTasks( tasks, 10 );
* \endcode
*/
- template <class _Function>
- void runTasks( const std::vector<_Function>& tasks, size_t threadCount = 1 )
+ template <class TFunction>
+ void runTasks( const std::vector<TFunction>& tasks, size_t threadCount = 1 )
{
if ( threadCount )
{
namespace zypp
{
- template <class _LIterator, class _RIterator, class _Function>
- inline int invokeOnEach( _LIterator lbegin_r, _LIterator lend_r,
- _RIterator rbegin_r, _RIterator rend_r,
- _Function fnc_r )
+ template <class TLIterator, class TRIterator, class TFunction>
+ inline int invokeOnEach( TLIterator lbegin_r, TLIterator lend_r,
+ TRIterator rbegin_r, TRIterator rend_r,
+ TFunction fnc_r )
{
int cnt = 0;
- for ( _LIterator lit = lbegin_r; lit != lend_r; ++lit )
+ for ( TLIterator lit = lbegin_r; lit != lend_r; ++lit )
{
- for ( _RIterator rit = rbegin_r; rit != rend_r; ++rit )
+ for ( TRIterator rit = rbegin_r; rit != rend_r; ++rit )
{
++cnt;
if ( ! fnc_r( *lit, *rit ) )
}
}
-
-void dbgDu( Selectable::Ptr sel )
-{
- if ( sel->installedObj() )
- {
- DBG << "i: " << sel->installedObj() << endl
- << sel->installedObj()->diskusage() << endl;
- }
- if ( sel->candidateObj() )
- {
- DBG << "c: " << sel->candidateObj() << endl
- << sel->candidateObj()->diskusage() << endl;
- }
- INT << sel << endl
- << getZYpp()->diskUsage() << endl;
-}
-
///////////////////////////////////////////////////////////////////
std::ostream & testDump( std::ostream & str, const PoolItem & pi )
namespace container
{
- template<class _Tp>
- bool isIn( const std::set<_Tp> & cont, const typename std::set<_Tp>::value_type & val )
+ template<class Tp>
+ bool isIn( const std::set<Tp> & cont, const typename std::set<Tp>::value_type & val )
{ return cont.find( val ) != cont.end(); }
}
///////////////////////////////////////////////////////////////////
{
namespace filter
{
- template <class _MemFun, class _Value>
+ template <class TMemFun, class TValue>
class HasValue
{
public:
- HasValue( _MemFun fun_r, _Value val_r )
+ HasValue( TMemFun fun_r, TValue val_r )
: _fun( fun_r ), _val( val_r )
{}
- template <class _Tp>
- bool operator()( const _Tp & obj_r ) const
+ template <class Tp>
+ bool operator()( const Tp & obj_r ) const
{ return( _fun && (obj_r.*_fun)() == _val ); }
private:
- _MemFun _fun;
- _Value _val;
+ TMemFun _fun;
+ TValue _val;
};
- template <class _MemFun, class _Value>
- HasValue<_MemFun, _Value> byValue( _MemFun fun_r, _Value val_r )
- { return HasValue<_MemFun, _Value>( fun_r, val_r ); }
+ template <class TMemFun, class TValue>
+ HasValue<TMemFun, TValue> byValue( TMemFun fun_r, TValue val_r )
+ { return HasValue<TMemFun, TValue>( fun_r, val_r ); }
}
}
template <class L>
-struct _TestO { _TestO( const L & lhs ) : _lhs( lhs ) {} const L & _lhs; };
+struct TestO { TestO( const L & lhs ) : _lhs( lhs ) {} const L & _lhs; };
template <class L>
-std::ostream & operator<<( std::ostream & str, const _TestO<L> & obj )
+std::ostream & operator<<( std::ostream & str, const TestO<L> & obj )
{ const L & lhs( obj._lhs); return str << (lhs?'_':'*') << (lhs.empty()?'e':'_') << "'" << lhs << "'"; }
template <class L>
-_TestO<L> testO( const L & lhs )
-{ return _TestO<L>( lhs ); }
+TestO<L> testO( const L & lhs )
+{ return TestO<L>( lhs ); }
template <class L, class R>
void testCMP( const L & lhs, const R & rhs )
inline bool useRepo( RepoInfo & repo )
{
- return repo.alias() == "matest";
+ //return repo.alias() == "matest";
return repo.enabled();
}
ResPool pool( ResPool::instance() );
sat::Pool satpool( sat::Pool::instance() );
///////////////////////////////////////////////////////////////////
- dumpRange( WAR << "satpool.multiversion " , satpool.multiversionBegin(), satpool.multiversionEnd() ) << endl;
+ dumpRange( WAR << "satpool.multiversion " , satpool.multiversion().begin(), satpool.multiversion().end() ) << endl;
TestSetup::LoadSystemAt( sysRoot, Arch_i586 );
///////////////////////////////////////////////////////////////////
#include <zypp/base/InputStream.h>
#include <zypp/base/ProvideNumericId.h>
#include <zypp/base/Flags.h>
+#include <zypp/base/StrMatcher.h>
#include <zypp/AutoDispose.h>
#include "zypp/ResPoolProxy.h"
#include "zypp/sat/Pool.h"
#include "zypp/sat/LocaleSupport.h"
#include "zypp/sat/LookupAttr.h"
-#include "zypp/sat/AttrMatcher.h"
#include "zypp/sat/SolvableSet.h"
#include "zypp/sat/SolvIterMixin.h"
#include "zypp/sat/detail/PoolImpl.h"
namespace zypp
{
- template <class _LIterator, class _RIterator, class _Function>
- inline int invokeOnEach( _LIterator lbegin_r, _LIterator lend_r,
- _RIterator rbegin_r, _RIterator rend_r,
- _Function fnc_r )
+ template <class TLIterator, class TRIterator, class TFunction>
+ inline int invokeOnEach( TLIterator lbegin_r, TLIterator lend_r,
+ TRIterator rbegin_r, TRIterator rend_r,
+ TFunction fnc_r )
{
int cnt = 0;
- for ( _LIterator lit = lbegin_r; lit != lend_r; ++lit )
+ for ( TLIterator lit = lbegin_r; lit != lend_r; ++lit )
{
- for ( _RIterator rit = rbegin_r; rit != rend_r; ++rit )
+ for ( TRIterator rit = rbegin_r; rit != rend_r; ++rit )
{
++cnt;
if ( ! fnc_r( *lit, *rit ) )
}
-void dbgDu( Selectable::Ptr sel )
-{
- if ( sel->installedObj() )
- {
- DBG << "i: " << sel->installedObj() << endl
- << sel->installedObj()->diskusage() << endl;
- }
- if ( sel->candidateObj() )
- {
- DBG << "c: " << sel->candidateObj() << endl
- << sel->candidateObj()->diskusage() << endl;
- }
- INT << sel << endl
- << getZYpp()->diskUsage() << endl;
-}
-
///////////////////////////////////////////////////////////////////
std::ostream & testDump( std::ostream & str, const PoolItem & pi )
namespace container
{
- template<class _Tp>
- bool isIn( const std::set<_Tp> & cont, const typename std::set<_Tp>::value_type & val )
+ template<class Tp>
+ bool isIn( const std::set<Tp> & cont, const typename std::set<Tp>::value_type & val )
{ return cont.find( val ) != cont.end(); }
}
///////////////////////////////////////////////////////////////////
{
namespace filter
{
- template <class _MemFun, class _Value>
+ template <class TMemFun, class TValue>
class HasValue
{
public:
- HasValue( _MemFun fun_r, _Value val_r )
+ HasValue( TMemFun fun_r, TValue val_r )
: _fun( fun_r ), _val( val_r )
{}
- template <class _Tp>
- bool operator()( const _Tp & obj_r ) const
+ template <class Tp>
+ bool operator()( const Tp & obj_r ) const
{ return( _fun && (obj_r.*_fun)() == _val ); }
private:
- _MemFun _fun;
- _Value _val;
+ TMemFun _fun;
+ TValue _val;
};
- template <class _MemFun, class _Value>
- HasValue<_MemFun, _Value> byValue( _MemFun fun_r, _Value val_r )
- { return HasValue<_MemFun, _Value>( fun_r, val_r ); }
+ template <class TMemFun, class TValue>
+ HasValue<TMemFun, TValue> byValue( TMemFun fun_r, TValue val_r )
+ { return HasValue<TMemFun, TValue>( fun_r, val_r ); }
}
}
template <class L>
-struct _TestO { _TestO( const L & lhs ) : _lhs( lhs ) {} const L & _lhs; };
+struct TestO { TestO( const L & lhs ) : _lhs( lhs ) {} const L & _lhs; };
template <class L>
-std::ostream & operator<<( std::ostream & str, const _TestO<L> & obj )
+std::ostream & operator<<( std::ostream & str, const TestO<L> & obj )
{ const L & lhs( obj._lhs); return str << (lhs?'_':'*') << (lhs.empty()?'e':'_') << "'" << lhs << "'"; }
template <class L>
-_TestO<L> testO( const L & lhs )
-{ return _TestO<L>( lhs ); }
+TestO<L> testO( const L & lhs )
+{ return TestO<L>( lhs ); }
template <class L, class R>
void testCMP( const L & lhs, const R & rhs )
}
else
{
- MIL << "---???---" << endl;
+ MIL << "--- ??? ---" << endl;
}
}
+++ /dev/null
-#include "Tools.h"
-
-#include <zypp/base/PtrTypes.h>
-#include <zypp/base/Exception.h>
-#include <zypp/base/LogTools.h>
-#include <zypp/base/ProvideNumericId.h>
-#include <zypp/AutoDispose.h>
-
-#include "zypp/ZYppFactory.h"
-#include "zypp/ResPoolProxy.h"
-
-#include "zypp/ZYppCallbacks.h"
-#include "zypp/NVRAD.h"
-#include "zypp/ResPool.h"
-#include "zypp/ResFilters.h"
-#include "zypp/Package.h"
-#include "zypp/Pattern.h"
-#include "zypp/Language.h"
-#include "zypp/Digest.h"
-#include "zypp/PackageKeyword.h"
-#include "zypp/ManagedFile.h"
-
-
-#include "zypp/parser/TagParser.h"
-#include "zypp/parser/susetags/PackagesFileReader.h"
-#include "zypp/parser/susetags/PackagesLangFileReader.h"
-#include "zypp/parser/susetags/PatternFileReader.h"
-#include "zypp/parser/susetags/ContentFileReader.h"
-#include "zypp/parser/susetags/RepoIndex.h"
-#include "zypp/parser/susetags/RepoParser.h"
-#include "zypp/cache/CacheStore.h"
-#include "zypp/RepoManager.h"
-#include "zypp/RepoInfo.h"
-
-#include "zypp/repo/DeltaCandidates.h"
-#include "zypp/repo/PackageProvider.h"
-#include "zypp/repo/SrcPackageProvider.h"
-
-#include "zypp/ui/PatchContents.h"
-#include "zypp/ResPoolProxy.h"
-
-using namespace std;
-using namespace zypp;
-using namespace zypp::functor;
-using namespace zypp::ui;
-using zypp::parser::TagParser;
-
-///////////////////////////////////////////////////////////////////
-
-static const Pathname sysRoot( "/Local/ROOT" );
-
-///////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-
-bool queryInstalledEditionHelper( const std::string & name_r,
- const Edition & ed_r,
- const Arch & arch_r )
-{
- if ( ed_r == Edition::noedition )
- return true;
- if ( name_r == "kernel-default" && ed_r == Edition("2.6.22.5-10") )
- return true;
- if ( name_r == "update-test-affects-package-manager" && ed_r == Edition("1.1-6") )
- return true;
-
- return false;
-}
-
-
-ManagedFile repoProvidePackage( const PoolItem & pi )
-{
- ResPool _pool( getZYpp()->pool() );
- repo::RepoMediaAccess _access;
-
- // Redirect PackageProvider queries for installed editions
- // (in case of patch/delta rpm processing) to rpmDb.
- repo::PackageProviderPolicy packageProviderPolicy;
- packageProviderPolicy.queryInstalledCB( queryInstalledEditionHelper );
-
- Package::constPtr p = asKind<Package>(pi.resolvable());
-
- // Build a repository list for repos
- // contributing to the pool
- repo::DeltaCandidates deltas( repo::makeDeltaCandidates( _pool.knownRepositoriesBegin(),
- _pool.knownRepositoriesEnd() ) );
- repo::PackageProvider pkgProvider( _access, p, deltas, packageProviderPolicy );
- return pkgProvider.providePackage();
-}
-
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-
-void dbgDu( Selectable::Ptr sel )
-{
- if ( sel->installedPoolItem() )
- {
- DBG << "i: " << sel->installedPoolItem() << endl
- << sel->installedPoolItem()->diskusage() << endl;
- }
- if ( sel->candidatePoolItem() )
- {
- DBG << "c: " << sel->candidatePoolItem() << endl
- << sel->candidatePoolItem()->diskusage() << endl;
- }
- INT << sel << endl
- << getZYpp()->diskUsage() << endl;
-}
-
-///////////////////////////////////////////////////////////////////
-
-struct Xprint
-{
- bool operator()( const PoolItem & obj_r )
- {
- if ( obj_r.status().isLocked() )
- SEC << obj_r << endl;
-
-// handle( asKind<Package>( obj_r ) );
-// handle( asKind<Patch>( obj_r ) );
-// handle( asKind<Pattern>( obj_r ) );
-// handle( asKind<Product>( obj_r ) );
- return true;
- }
-
- void handle( const Package_constPtr & p )
- {
- if ( !p )
- return;
-
- WAR << p->size() << endl;
- MIL << p->diskusage() << endl;
- }
-
- void handle( const Patch_constPtr & p )
- {
- if ( !p )
- return;
- }
-
- void handle( const Pattern_constPtr & p )
- {
- if ( !p )
- return;
-
- if ( p->vendor().empty() )
- ERR << p << endl;
- else if ( p->vendor() == "SUSE (assumed)" )
- SEC << p << endl;
- }
-
- void handle( const Product_constPtr & p )
- {
- if ( !p )
- return;
-
- USR << p << endl;
- USR << p->vendor() << endl;
- USR << p->type() << endl;
- }
-
- template<class _C>
- bool operator()( const _C & obj_r )
- {
- return true;
- }
-};
-
-///////////////////////////////////////////////////////////////////
-struct SetTransactValue
-{
- SetTransactValue( ResStatus::TransactValue newVal_r, ResStatus::TransactByValue causer_r )
- : _newVal( newVal_r )
- , _causer( causer_r )
- {}
-
- ResStatus::TransactValue _newVal;
- ResStatus::TransactByValue _causer;
-
- bool operator()( const PoolItem & pi ) const
- {
- bool ret = pi.status().setTransactValue( _newVal, _causer );
- if ( ! ret )
- ERR << _newVal << _causer << " " << pi << endl;
- return ret;
- }
-};
-
-struct StatusReset : public SetTransactValue
-{
- StatusReset()
- : SetTransactValue( ResStatus::KEEP_STATE, ResStatus::USER )
- {}
-};
-
-struct StatusInstall : public SetTransactValue
-{
- StatusInstall()
- : SetTransactValue( ResStatus::TRANSACT, ResStatus::USER )
- {}
-};
-
-///////////////////////////////////////////////////////////////////
-
-bool solve( bool establish = false )
-{
- if ( establish )
- {
- bool eres = false;
- {
- zypp::base::LogControl::TmpLineWriter shutUp;
- eres = getZYpp()->resolver()->establishPool();
- }
- if ( ! eres )
- {
- ERR << "establish " << eres << endl;
- return false;
- }
- MIL << "establish " << eres << endl;
- }
-
- bool rres = false;
- {
- zypp::base::LogControl::TmpLineWriter shutUp;
- rres = getZYpp()->resolver()->resolvePool();
- }
- if ( ! rres )
- {
- ERR << "resolve " << rres << endl;
- return false;
- }
- MIL << "resolve " << rres << endl;
- return true;
-}
-
-bool install()
-{
- SEC << getZYpp()->commit( ZYppCommitPolicy() ) << endl;
- return true;
-}
-
-///////////////////////////////////////////////////////////////////
-
-struct ConvertDbReceive : public callback::ReceiveReport<target::ScriptResolvableReport>
-{
- virtual void start( const Resolvable::constPtr & script_r,
- const Pathname & path_r,
- Task task_r )
- {
- SEC << __FUNCTION__ << endl
- << " " << script_r << endl
- << " " << path_r << endl
- << " " << task_r << endl;
- }
-
- virtual bool progress( Notify notify_r, const std::string & text_r )
- {
- SEC << __FUNCTION__ << endl
- << " " << notify_r << endl
- << " " << text_r << endl;
- return true;
- }
-
- virtual void problem( const std::string & description_r )
- {
- SEC << __FUNCTION__ << endl
- << " " << description_r << endl;
- }
-
- virtual void finish()
- {
- SEC << __FUNCTION__ << endl;
- }
-
-};
-///////////////////////////////////////////////////////////////////
-
-struct DigestReceive : public callback::ReceiveReport<DigestReport>
-{
- DigestReceive()
- {
- connect();
- }
-
- virtual bool askUserToAcceptNoDigest( const zypp::Pathname &file )
- {
- USR << endl;
- return false;
- }
- virtual bool askUserToAccepUnknownDigest( const Pathname &file, const std::string &name )
- {
- USR << endl;
- return false;
- }
- virtual bool askUserToAcceptWrongDigest( const Pathname &file, const std::string &requested, const std::string &found )
- {
- USR << "fle " << PathInfo(file) << endl;
- USR << "req " << requested << endl;
- USR << "fnd " << found << endl;
-
- waitForInput();
-
- return false;
- }
-};
-
-struct KeyRingSignalsReceive : public callback::ReceiveReport<KeyRingSignals>
-{
- KeyRingSignalsReceive()
- {
- connect();
- }
- virtual void trustedKeyAdded( const PublicKey &/*key*/ )
- {
- USR << endl;
- }
- virtual void trustedKeyRemoved( const PublicKey &/*key*/ )
- {
- USR << endl;
- }
-};
-
-///////////////////////////////////////////////////////////////////
-
-struct MediaChangeReceive : public callback::ReceiveReport<media::MediaChangeReport>
-{
- virtual Action requestMedia( Url & source
- , unsigned mediumNr
- , Error error
- , const std::string & description )
- {
- SEC << __FUNCTION__ << endl
- << " " << source << endl
- << " " << mediumNr << endl
- << " " << error << endl
- << " " << description << endl;
- return IGNORE;
- }
-};
-
-///////////////////////////////////////////////////////////////////
-
-namespace container
-{
- template<class _Tp>
- bool isIn( const std::set<_Tp> & cont, const typename std::set<_Tp>::value_type & val )
- { return cont.find( val ) != cont.end(); }
-}
-
-///////////////////////////////////////////////////////////////////
-
-struct AddResolvables
-{
- bool operator()( const Repository & src ) const
- {
- getZYpp()->addResolvables( src.resolvables() );
- return true;
- }
-};
-
-///////////////////////////////////////////////////////////////////
-
-
-std::ostream & operator<<( std::ostream & str, const iostr::EachLine & obj )
-{
- str << "(" << obj.valid() << ")[" << obj.lineNo() << "|" << obj.lineStart() << "]{" << *obj << "}";
- return str;
-
-}
-
-///////////////////////////////////////////////////////////////////
-
-#define for_(IT,BEG,END) for ( typeof(BEG) IT = BEG; IT != END; ++IT )
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-
-
- void Vtst( const std::string & lhs, const std::string & rhs )
- {
- (VendorAttr::instance().equivalent( lhs, rhs )?MIL:ERR) << lhs << " <==> "<< rhs << endl;
-
- }
-
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-
-using namespace zypp;
-
-void tt( std::string dd )
-{
- unsigned level = 3;
- std::string::size_type pos = dd.find( "/" );
- while ( --level && pos != std::string::npos )
- {
- pos = dd.find( "/", pos+1 );
- }
- if ( pos != std::string::npos )
- dd.erase( pos+1 );
- DBG << dd << "\t" << level << " " << pos << endl;
-}
-
-/******************************************************************
-**
-** FUNCTION NAME : main
-** FUNCTION TYPE : int
-*/
-int main( int argc, char * argv[] )
-{
- //zypp::base::LogControl::instance().logfile( "log.restrict" );
- INT << "===[START]==========================================" << endl;
- setenv( "ZYPP_CONF", "/Local/ROOT/zypp.conf", 1 );
-
- DigestReceive foo;
- KeyRingSignalsReceive baa;
-
- RepoManager repoManager( makeRepoManager( "/Local/ROOT" ) );
-
- RepoInfoList repos = repoManager.knownRepositories();
- SEC << "/Local/ROOT " << repos << endl;
-
- for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it )
- {
- RepoInfo & nrepo( *it );
- if ( ! nrepo.enabled() )
- continue;
-
- if ( ! repoManager.isCached( nrepo ) || 0 )
- {
- if ( repoManager.isCached( nrepo ) )
- {
- SEC << "cleanCache" << endl;
- repoManager.cleanCache( nrepo );
- }
- SEC << "refreshMetadata" << endl;
- //repoManager.refreshMetadata( nrepo, RepoManager::RefreshForced );
- repoManager.refreshMetadata( nrepo );
- SEC << "buildCache" << endl;
- repoManager.buildCache( nrepo );
- }
-
- SEC << nrepo << endl;
- Repository nrep( repoManager.createFromCache( nrepo ) );
- const zypp::ResStore & store( nrep.resolvables() );
-
- dumpPoolStats( SEC << "Store: " << endl,
- store.begin(), store.end() ) << endl;
- getZYpp()->addResolvables( store );
- }
-
- ResPool pool( getZYpp()->pool() );
- USR << "pool: " << pool << endl;
- SEC << pool.knownRepositoriesSize() << endl;
-
- if ( 0 )
- {
- {
- zypp::base::LogControl::TmpLineWriter shutUp;
- //getZYpp()->initTarget( sysRoot );
- getZYpp()->initTarget( "/" );
- }
- MIL << "Added target: " << pool << endl;
- }
-
-
- //std::for_each( pool.begin(), pool.end(), Xprint() );
-
- PoolItem pi = getPi<Patch>( "fetchmsttfonts.sh" );
- USR << pi << endl;
-
- //pi.status().setTransact( true, ResStatus::USER );
- //install();
-
- ///////////////////////////////////////////////////////////////////
- INT << "===[END]============================================" << endl << endl;
- zypp::base::LogControl::instance().logNothing();
- return 0;
-}
-
struct Print
{
- template<class _Tp>
- bool operator()( const _Tp & val_r ) const
+ template<class Tp>
+ bool operator()( const Tp & val_r ) const
{ USR << val_r << endl; return true; }
};
///////////////////////////////////////////////////////////////////
-template<class _Tp>
- struct PrintOn : public std::unary_function<_Tp, bool>
+template<class Tp>
+ struct PrintOn : public std::unary_function<Tp, bool>
{
- bool operator()( const _Tp & obj ) const
+ bool operator()( const Tp & obj ) const
{
if ( _leadNL )
_str << std::endl << _prfx << obj;
using namespace zypp;
#undef MIL
-#define MIL MilSync( _BASEFILE, __FUNCTION__, __LINE__ )._str
+#define MIL MilSync( L_BASEFILE, __FUNCTION__, __LINE__ )._str
#ifdef _REENTRANT
#warning _REENTRANT
#include <map>
#include <set>
-#include "Printing.h"
-#include "FakePool.h"
-
#define INCLUDE_TESTSETUP_WITHOUT_BOOST
#include "zypp/../tests/lib/TestSetup.h"
#undef INCLUDE_TESTSETUP_WITHOUT_BOOST
///////////////////////////////////////////////////////////////////
//
-template<class _Condition>
+template<class TCondition>
struct SetTrue
{
- SetTrue( _Condition cond_r )
+ SetTrue( TCondition cond_r )
: _cond( cond_r )
{}
- template<class _Tp>
- bool operator()( _Tp t ) const
+ template<class Tp>
+ bool operator()( Tp t ) const
{
_cond( t );
return true;
}
- _Condition _cond;
+ TCondition _cond;
};
-template<class _Condition>
- inline SetTrue<_Condition> setTrue_c( _Condition cond_r )
+template<class TCondition>
+ inline SetTrue<TCondition> setTrue_c( TCondition cond_r )
{
- return SetTrue<_Condition>( cond_r );
+ return SetTrue<TCondition>( cond_r );
}
struct PrintPoolItem
{ USR << pi << endl; }
};
-template <class _Iterator>
+template <class TIterator>
std::ostream & vdumpPoolStats( std::ostream & str,
- _Iterator begin_r, _Iterator end_r )
+ TIterator begin_r, TIterator end_r )
{
pool::PoolStats stats;
std::for_each( begin_r, end_r,
typedef zypp::pool::PoolStats Rstats;
-template<class _Iterator>
- void rstats( _Iterator begin, _Iterator end )
+template<class TIterator>
+ void rstats( TIterator begin, TIterator end )
{
DBG << __PRETTY_FUNCTION__ << endl;
Rstats stats;
MIL << stats << endl;
}
-template<class _Container>
- void rstats( const _Container & c )
+template<class TContainer>
+ void rstats( const TContainer & c )
{
rstats( c.begin(), c.end() );
}
///////////////////////////////////////////////////////////////////
-template<class _Res>
+template<class TRes>
ui::Selectable::Ptr getSel( const std::string & name_r )
{
ResPoolProxy uipool( getZYpp()->poolProxy() );
- for_(it, uipool.byKindBegin<_Res>(), uipool.byKindEnd<_Res>() )
+ for_(it, uipool.byKindBegin<TRes>(), uipool.byKindEnd<TRes>() )
{
if ( (*it)->name() == name_r )
return (*it);
-template<class _Res>
+template<class TRes>
PoolItem getPi( const std::string & alias_r, const std::string & name_r, const Edition & ed_r, const Arch & arch_r )
{
PoolItem ret;
ResPool pool( getZYpp()->pool() );
- for_(it, pool.byIdentBegin<_Res>(name_r), pool.byIdentEnd<_Res>(name_r) )
+ for_(it, pool.byIdentBegin<TRes>(name_r), pool.byIdentEnd<TRes>(name_r) )
{
if ( ( ed_r.empty() || ed_r.match((*it)->edition()) == 0 )
&& ( arch_r.empty() || arch_r == (*it)->arch() )
}
return ret;
}
-template<class _Res>
+template<class TRes>
PoolItem getPi( const std::string & name_r, const Edition & ed_r, const Arch & arch_r )
{
- return getPi<_Res>( "", name_r, ed_r, arch_r );
+ return getPi<TRes>( "", name_r, ed_r, arch_r );
}
-template<class _Res>
+template<class TRes>
PoolItem getPi( const std::string & name_r )
{
- return getPi<_Res>( name_r, Edition(), Arch_empty );
+ return getPi<TRes>( name_r, Edition(), Arch_empty );
}
-template<class _Res>
+template<class TRes>
PoolItem getPi( const std::string & name_r, const Edition & ed_r )
{
- return getPi<_Res>( name_r, ed_r, Arch_empty );
+ return getPi<TRes>( name_r, ed_r, Arch_empty );
}
-template<class _Res>
+template<class TRes>
PoolItem getPi( const std::string & name_r, const Arch & arch_r )
{
- return getPi<_Res>( name_r, Edition(), arch_r );
+ return getPi<TRes>( name_r, Edition(), arch_r );
}
///////////////////////////////////////////////////////////////////
+++ /dev/null
-#include "Tools.h"
-
-#include <zypp/PoolQuery.h>
-#include <zypp/target/rpm/librpmDb.h>
-#include <zypp/parser/ProductFileReader.h>
-
-#include "zypp/sat/WhatObsoletes.h"
-#include "zypp/ExternalProgram.h"
-#include <zypp/ZYppCallbacks.h>
-
-#include "zypp/sat/Transaction.h"
-
-///////////////////////////////////////////////////////////////////
-
-//static const Pathname sysRoot( getenv("SYSROOT") ? getenv("SYSROOT") : "/Local/ROOT" );
-//static const Pathname sysRoot( "/tmp/ToolScanRepos" );
-// static const Pathname sysRoot( "/tmp/updateTestcase" );
-static const Pathname sysRoot( "/tmp/ToolScanRepos" );
-
-///////////////////////////////////////////////////////////////////
-struct IRR : public zypp::callback::ReceiveReport<zypp::target::rpm::InstallResolvableReport>
-{
- IRR()
- { connect(); }
-#if 0
- enum Action {
- ABORT, // abort and return error
- RETRY, // retry
- IGNORE // ignore the failure
- };
-
- enum Error {
- NO_ERROR,
- NOT_FOUND, // the requested Url was not found
- IO, // IO error
- INVALID // th resolvable is invalid
- };
-
- // the level of RPM pushing
- /** \deprecated We fortunately no longer do 3 attempts. */
- enum RpmLevel {
- RPM,
- RPM_NODEPS,
- RPM_NODEPS_FORCE
- };
-#endif
-
- virtual void reportbegin()
- { /*SEC << endl;*/ }
- virtual void reportend()
- { /*SEC << endl;*/ }
-
- virtual void start(Resolvable::constPtr /*resolvable*/)
- { INT << endl; }
-
- virtual bool progress(int /*value*/, Resolvable::constPtr /*resolvable*/)
- {
- static int i = 4;
- if ( --i <= 0 )
- {
- INT << "return abort" << endl;
- return false;
- }
- return true;
- }
-
- virtual Action problem(Resolvable::constPtr /*resolvable*/, Error /*error*/, const std::string &/*description*/, RpmLevel /*level*/)
- {
- INT << "return abort" << endl;
- return ABORT;
- }
-
- virtual void finish(Resolvable::constPtr /*resolvable*/, Error /*error*/, const std::string &/*reason*/, RpmLevel /*level*/)
- { INT << endl; }
-};
-
-struct RRR : public zypp::callback::ReceiveReport<zypp::target::rpm::RemoveResolvableReport>
-{
- RRR()
- { connect(); }
-#if 0
- enum Action {
- ABORT, // abort and return error
- RETRY, // retry
- IGNORE // ignore the failure
- };
-
- enum Error {
- NO_ERROR,
- NOT_FOUND, // the requested Url was not found
- IO, // IO error
- INVALID // th resolvable is invalid
- };
-#endif
-
- virtual void reportbegin()
- { /*SEC << endl;*/ }
- virtual void reportend()
- { /*SEC << endl;*/ }
-
- virtual void start( Resolvable::constPtr /*resolvable*/ )
- { INT << endl; }
-
- virtual bool progress(int /*value*/, Resolvable::constPtr /*resolvable*/)
- { INT << endl; return true; }
-
- virtual Action problem( Resolvable::constPtr /*resolvable*/ , Error /*error*/ , const std::string &/*description*/ )
- { INT << endl; return ABORT; }
-
- virtual void finish( Resolvable::constPtr /*resolvable*/ , Error /*error*/ , const std::string &/*reason*/ )
- { INT << endl; }
-};
-
-
-bool solve()
-{
- bool rres = false;
- {
- //zypp::base::LogControl::TmpLineWriter shutUp;
- //getZYpp()->resolver()->setOnlyRequires( true );
- rres = getZYpp()->resolver()->resolvePool();
- }
- if ( ! rres )
- {
- ERR << "resolve " << rres << endl;
- getZYpp()->resolver()->problems();
- return false;
- }
- MIL << "resolve " << rres << endl;
- return true;
-}
-
-bool upgrade()
-{
- bool rres = false;
- {
- zypp::base::LogControl::TmpLineWriter shutUp;
- Measure x( "Upgrade" );
- rres = getZYpp()->resolver()->doUpgrade();
- }
- if ( ! rres )
- {
- Measure x( "Upgrade Error" );
- ERR << "upgrade " << rres << endl;
- getZYpp()->resolver()->problems();
- return false;
- }
- MIL << "upgrade " << rres << endl;
- return true;
-}
-
-bool install()
-{
- ZYppCommitPolicy pol;
- //pol.dryRun( true );
- pol.downloadMode( DownloadAsNeeded );
- pol.rpmInstFlags( pol.rpmInstFlags().setFlag( target::rpm::RPMINST_JUSTDB ) );
- ZYppCommitResult res( getZYpp()->commit( pol ) );
- SEC << res << endl;
- MIL << res.transactionStepList() << endl;
- return true;
-}
-
-///////////////////////////////////////////////////////////////////
-
-template <class _Iter>
-unsigned count( _Iter begin, _Iter end )
-{
- unsigned cnt = 0;
- for_( it, begin, end )
- ++cnt;
- return cnt;
-}
-
-///////////////////////////////////////////////////////////////////
-int main( int argc, char * argv[] )
-try {
- --argc;
- ++argv;
- zypp::base::LogControl::instance().logToStdErr();
- INT << "===[START]==========================================" << endl;
- ///////////////////////////////////////////////////////////////////
- IRR _irr;
- RRR _rrr;
- if ( sysRoot == "/" )
- ::unsetenv( "ZYPP_CONF" );
-
- sat::Transaction();
- const sat::Transaction a;
- sat::Transaction b;
- sat::Transaction c( a );
- b = a;
-
- ResPool pool( ResPool::instance() );
- sat::Pool satpool( sat::Pool::instance() );
- ///////////////////////////////////////////////////////////////////
- dumpRange( WAR << "satpool.multiversion " , satpool.multiversionBegin(), satpool.multiversionEnd() ) << endl;
- TestSetup::LoadSystemAt( sysRoot, Arch_i586 );
- getZYpp()->initializeTarget( sysRoot );
-
- ///////////////////////////////////////////////////////////////////
-
- if ( 1 )
- {
- getPi<Product>( "openSUSE-CD-retail" ).status().setToBeInstalled( ResStatus::USER );
- getPi<Pattern>( "devel_qt4" ).status().setToBeInstalled( ResStatus::USER );
-// getPi<Pattern>( "devel_qt4" ).status().setToBeInstalled( ResStatus::USER );
- solve();
- sat::Transaction trans( pool.resolver().getTransaction() );
- trans.order();
-
- USR << count( trans.actionBegin(), trans.actionEnd() ) << endl;
- USR << count( trans.actionBegin(sat::Transaction::STEP_TODO), trans.actionEnd() ) << endl;
- USR << count( trans.actionBegin(sat::Transaction::STEP_DONE), trans.actionEnd() ) << endl;
- USR << count( trans.actionBegin(sat::Transaction::STEP_ERROR), trans.actionEnd() ) << endl;
- USR << count( trans.actionBegin(sat::Transaction::STEP_TODO|sat::Transaction::STEP_ERROR), trans.actionEnd() ) << endl;
- USR << count( trans.actionBegin(~sat::Transaction::STEP_ERROR), trans.actionEnd() ) << endl;
- USR << count( trans.actionBegin(~sat::Transaction::STEP_TODO), trans.actionEnd() ) << endl;
-
- //install();
- }
-
- ///////////////////////////////////////////////////////////////////
- // ResPoolProxy selpool( pool.proxy() );
- if ( 0 )
- {
- upgrade();
- install();
- }
-
- ///////////////////////////////////////////////////////////////////
- INT << "===[END]============================================" << endl << endl;
- zypp::base::LogControl::instance().logNothing();
- return 0;
-}
-catch ( const Exception & exp )
-{
- INT << exp << endl << exp.historyAsString();
-}
-catch (...)
-{}
-
///////////////////////////////////////////////////////////////////
/** Helper to detect an objects type. */
-template<class _Cl> void ti( const _Cl & c )
+template<class TCl> void ti( const TCl & c )
{
SEC << __PRETTY_FUNCTION__ << endl;
}
+++ /dev/null
-0 <NULL>
-1
-2 solvable:name
-3 solvable:arch
-4 solvable:evr
-5 solvable:vendor
-6 solvable:provides
-7 solvable:obsoletes
-8 solvable:conflicts
-9 solvable:requires
-10 solvable:recommends
-11 solvable:suggests
-12 solvable:supplements
-13 solvable:enhances
-14 solvable:freshens
-15 rpm:dbid
-16 solvable:prereqmarker
-17 solvable:filemarker
-18 namespace:installed
-19 namespace:modalias
-20 system:system
-21 src
-22 nosrc
-23 noarch
-24 <NULL>
-25 <NULL>
-26 <NULL>
-27 <NULL>
-28 <NULL>
-29 <NULL>
-
+++ /dev/null
-@ package
-@ installed
-
-- readline 1 1 i686
-
-- bash 1 1 i686
-@ requires
-readline = 1
-
-- fontcfg 1 1 i686
-@ prerequires
-bash
-
-@ available
-
-- readline 2 1 i686
-
-- bash 2 1 i686
-@ requires
-readline = 2
-
-- fontcfg 2 1 i686
-#@ prerequires
-#bash
-filesystem()
-filesystem(sdfa)
-
-@ fin
+++ /dev/null
-#include "Tools.h"
-
-#include <zypp/ResPool.h>
-#include <zypp/ResObjects.h>
-#include <zypp/PoolQuery.h>
-
-#include <zypp/misc/CheckAccessDeleted.h>
-
-///////////////////////////////////////////////////////////////////
-
-Pathname sysRoot( getenv("SYSROOT") ? getenv("SYSROOT") : "/Local/ROOT" );
-
-///////////////////////////////////////////////////////////////////
-
-int main( int argc, char * argv[] )
-try {
- --argc;
- ++argv;
- zypp::base::LogControl::instance().logToStdErr();
- INT << "===[START]==========================================" << endl;
- if ( argc )
- {
- unsetenv("SYSROOT");
- sysRoot = Pathname(*argv);
- setenv( "ZYPP_CONF", (sysRoot/"etc/zypp.conf").c_str(), true );
- }
- ZConfig::instance();
- //TestSetup::LoadSystemAt( sysRoot );
- ///////////////////////////////////////////////////////////////////
- ResPool pool( ResPool::instance() );
- sat::Pool satpool( sat::Pool::instance() );
- ///////////////////////////////////////////////////////////////////
- dumpRange( USR, satpool.reposBegin(), satpool.reposEnd() ) << endl;
- USR << "pool: " << pool << endl;
- ///////////////////////////////////////////////////////////////////
-
- {
- Measure x("x");
- CheckAccessDeleted checker;
- USR << checker << endl;
- }
- SEC << CheckAccessDeleted::findService( "syslog" ) << endl;
- SEC << CheckAccessDeleted::findService( "syslogd" ) << endl;
- SEC << CheckAccessDeleted::findService( "ssh" ) << endl;
- SEC << CheckAccessDeleted::findService( "sshd" ) << endl;
- SEC << CheckAccessDeleted::findService( 3844 ) << endl;
- ///////////////////////////////////////////////////////////////////
- INT << "===[END]============================================" << endl << endl;
- zypp::base::LogControl::instance().logNothing();
- return 0;
-}
-catch ( const Exception & exp )
-{
- INT << exp << endl << exp.historyAsString();
-}
-catch (...)
-{}
-
///////////////////////////////////////////////////////////////////
// connect resolvables interface and implementation.
-template<class _Res>
- struct ResImplConnect : public _Res
+template<class TRes>
+ struct ResImplConnect : public TRes
{
public:
typedef ResImplConnect Self;
- typedef typename _Res::Impl Impl;
+ typedef typename TRes::Impl Impl;
typedef zypp::base::shared_ptr<Impl> ImplPtr;
typedef zypp::base::intrusive_ptr<Self> Ptr;
typedef zypp::base::intrusive_ptr<const Self> constPtr;
};
-template<class _Impl>
- typename _Impl::ResType::Ptr
- makeResolvable( /*NVRA*/ zypp::base::shared_ptr<_Impl> & impl_r )
+template<class TImpl>
+ typename TImpl::ResType::Ptr
+ makeResolvable( /*NVRA*/ zypp::base::shared_ptr<TImpl> & impl_r )
{
- impl_r.reset( new _Impl );
- return new ResImplConnect<typename _Impl::ResType>( /*NVRA*/ impl_r );
+ impl_r.reset( new TImpl );
+ return new ResImplConnect<typename TImpl::ResType>( /*NVRA*/ impl_r );
}
///////////////////////////////////////////////////////////////////
virtual ~ObjectImpl() {};
private:
- template<class _Res>
+ template<class TRes>
friend class ResImpl;
Resolvable * _backRef;
};
--- /dev/null
+/**
+
+\page zypp--appdata Code 12 Application Metadata
+
+\author Michael Andres <ma@suse.de>
+
+<HR><!-- ====================================================================== -->
+
+\section zypp-appdata_intro Intro
+
+Since Code12 we support \c application as new kind of resolvable object (see e.g. http://worldofgnome.org/gnome-software-on-opensuse). This is short abstract about how a \c package and it's associated \c application are connected metadata wise.
+
+\code
+# zypper download virt-manager
+...
+Retrieving package virt-manager-1.2.1-8.1.noarch (1/1), 354.8 KiB ( 2.6 MiB unpacked)
+(1/1) /var/cache/zypp/packages/server/suse/noarch/virt-manager-1.2.1-8.1.noarch.rpm .......[done]
+\endcode
+\code
+# rpm -qplv /var/cache/zypp/packages/server/suse/noarch/virt-manager-1.2.1-8.1.noarch.rpm | grep /usr/share/appdata
+-rw-r--r-- 1 root root 1119 Sep 18 09:47 /usr/share/appdata/virt-manager.appdata.xml
+\endcode
+
+The <tt>package:virt-manager</tt> provides \c application metadata in its file <tt>/usr/share/appdata/virt-manager.appdata.xml</tt>. After installation the presence of <tt>/usr/share/appdata/virt-manager.appdata.xml</tt> indicates the installed <tt>application:'Virtual Machine Manager'</tt>. The connection is provided by the <tt>package:virt-manager</tt> \c appdata provides...
+
+\code
+# zypp-NameReqPrv -D virt-manager
+...
+(976)virt-manager-1.2.1-8.1.noarch(@System)
+ PROVIDES (5){
+ application()
+ appdata()
+ appdata(virt-manager.appdata.xml)
+ ^^^^^^^^^^^^
+\endcode
+
+...matching the content of \c /usr/share/appdata/virt-manager.appdata.xml:
+
+\code
+# less /usr/share/appdata/virt-manager.appdata.xml
+<application>
+ <id type="desktop">virt-manager.desktop</id>
+ ^^ ^^^^^^^^^^^^
+ <metadata_license>CC0-1.0</metadata_license>
+ <project_license>GPL-2.0+</project_license>
+ <name>Virtual Machine Manager</name>
+\endcode
+
+To establish this connection for uninstalled \c package/application pairs, the repository metadata must provide the \c appdata.xml files for the included packages. This is done in for \c susetags repos in \c suse/setup/descr/appdata.xml.gz, for \c rpmmd in <tt>repodata/CHCKSUM-appdata.xml.gz</tt>.
+
+
+\section zypp-appdata_wrong_appdata Missing or wrong appdata
+
+\code
+# zypper se -s -t application 'Virtual Machine Manager'
+...
+S | Name | Type | Version | Arch | Repository
+--+-------------------------+-------------+---------+--------+------------------
+i | Virtual Machine Manager | application | | noarch | (System Packages)
+\endcode
+\code
+# zypper se -s virt-manager
+...
+S | Name | Type | Version | Arch | Repository
+--+---------------------+------------+-----------+--------+------------------
+i | virt-manager | package | 1.2.1-8.1 | noarch | SLE-12-SP1-Server
+\endcode
+
+\note While the <tt>package:virt-manager</tt> is installed and also available in the SLE-12-SP1-Server repository, <tt>(System Packages)</tt> indicates that the \c application is installed, but not provided by any repository. This usually happens if the repository provides wrong appdata, or no appdata at all.
+
+\code
+# zypper in -f virt-manager
+...
+Forcing installation of 'virt-manager-1.2.1-8.1.noarch' from repository 'SLE-12-SP1-Server'.
+Resolving package dependencies...
+
+The following application is going to be REMOVED:
+ "Virtual Machine Manager"
+
+The following package is going to be reinstalled:
+ virt-manager
+\endcode
+
+\c Zypper can not 'see' that the new package also transports a new application. Due to this \c zypper must assume the installed application gets deleted, when the package is reinstalled or updated.
+
+\code
+\endcode
+*/
-------------------------------------------------------------------
+Mon Oct 5 12:27:49 CEST 2015 - ma@suse.de
+
+- fix reserved identifier violation (fixes #51)
+- solver: speed up collecting pool data to build the job queue
+- doc: short abstract about 'Code 12 Application Metadata'
+- version 15.19.0 (19)
+
+-------------------------------------------------------------------
Tue Sep 29 17:51:48 CEST 2015 - ma@suse.de
- solver verify: multiversion property needs to be assigned to
BOOST_CHECK( compare( wildcardfree, Value::ANY, SetCompare::properSubset ) );
BOOST_CHECK( compare( wildcardfree, Value::NA, SetCompare::disjoint ) );
- //BOOST_CHECK( compare( wildcardfree, wildcardfree, _NeedsCloserLook, // equal or disjoint
+ //BOOST_CHECK( compare( wildcardfree, wildcardfree, kNeedsCloserLook, // equal or disjoint
BOOST_CHECK( compare( wildcardfree, wildcardfree, SetCompare::equal ) );
BOOST_CHECK( compare( wildcardfree, wildcardfree2, SetCompare::disjoint ) );
#if WFN_STRICT_SPEC
BOOST_CHECK( compare( wildcardfree, wildcarded, SetCompare::uncomparable ) );
#else
- //BOOST_CHECK( compare( wildcardfree, wildcarded, _NeedsCloserLook, // subset or disjoint
+ //BOOST_CHECK( compare( wildcardfree, wildcarded, kNeedsCloserLook, // subset or disjoint
BOOST_CHECK( compare( wildcardfree, wildcarded, SetCompare::properSubset ) );
BOOST_CHECK( compare( wildcardfree, wildcarded2, SetCompare::disjoint ) );
#endif
BOOST_CHECK( compare( wildcarded, Value::ANY, SetCompare::properSubset ) );
BOOST_CHECK( compare( wildcarded, Value::NA, SetCompare::disjoint ) );
- //BOOST_CHECK( compare( wildcarded, wildcardfree, _NeedsCloserLook, // superset or disjoint
+ //BOOST_CHECK( compare( wildcarded, wildcardfree, kNeedsCloserLook, // superset or disjoint
BOOST_CHECK( compare( wildcarded, wildcardfree, SetCompare::properSuperset ) );
BOOST_CHECK( compare( wildcarded, wildcardfree2, SetCompare::disjoint ) );
#if WFN_STRICT_SPEC
BOOST_CHECK( compare( wildcarded, wildcarded, SetCompare::uncomparable ) );
#else
- //BOOST_CHECK( compare( wildcarded, wildcarded, _NeedsCloserLook, // equal or uncomparable
+ //BOOST_CHECK( compare( wildcarded, wildcarded, kNeedsCloserLook, // equal or uncomparable
BOOST_CHECK( compare( wildcarded, wildcarded, SetCompare::equal ) );
BOOST_CHECK( compare( wildcarded, wildcarded2, SetCompare::uncomparable ) );
#endif
static TestSetup test;
-template <class _Iterator>
-std::ostream & vdumpPoolStats( std::ostream & str, _Iterator begin_r, _Iterator end_r )
+template <class TIterator>
+std::ostream & vdumpPoolStats( std::ostream & str, TIterator begin_r, TIterator end_r )
{
pool::PoolStats stats;
for_( it, begin_r, end_r )
-#ifndef _ZYPP_KEYRING_TEST_RECEIVER_H
-#define _ZYPP_KEYRING_TEST_RECEIVER_H
+#ifndef ZYPP_KEYRING_TEST_RECEIVER_H
+#define ZYPP_KEYRING_TEST_RECEIVER_H
#include "zypp/Callback.h"
#include "zypp/KeyRing.h"
#define TRACE_TAG DBG << this->numericId() << " " << __PRETTY_FUNCTION__ << endl
/** Logs Ctor, CopyCtor, Assign and Dtor. */
-template<class _Trace>
- struct Trace : public ProvideNumericId<_Trace,unsigned>
+template<class TTrace>
+ struct Trace : public ProvideNumericId<TTrace,unsigned>
{
Trace() { TRACE_TAG; }
Trace( const Trace & ) { TRACE_TAG; }
#define T_EQ(a,b) assert( a == b ); assert( a == b.cgetPtr() ); assert( a.cgetPtr() == b ); assert( a.cgetPtr() == b.cgetPtr() );
#define T_NE(a,b) assert( a != b ); assert( a != b.cgetPtr() ); assert( a.cgetPtr() != b ); assert( a.cgetPtr() != b.cgetPtr() );
-template<class _RW>
+template<class RW>
void test()
{
MIL << __PRETTY_FUNCTION__ << std::endl;
// typedefs that should be provided:
- typedef typename _RW::_Ptr _Ptr;
- typedef typename _RW::_constPtr _constPtr;
- typedef typename _Ptr::element_type _Ptr_element_type;
- typedef typename _constPtr::element_type _constPtr_element_type;
+ typedef typename RW::PtrType Ptr;
+ typedef typename RW::constPtrType constPtr;
+ typedef typename Ptr::element_type Ptr_element_type;
+ typedef typename constPtr::element_type constPtr_element_type;
// initial NULL
- _RW ptr;
+ RW ptr;
T_NULL;
T_UNIQUE;
T_EQ(ptr,ptr);
// assign
- ptr = _RW( new _Ptr_element_type );
+ ptr = RW( new Ptr_element_type );
T_NOT_NULL;
T_UNIQUE;
T_EQ(ptr,ptr);
{
// share
- _RW ptr2( ptr );
+ RW ptr2( ptr );
T_NOT_NULL;
T_NOT_UNIQUE;
T_EQ(ptr,ptr2);
T_UNIQUE;
T_NE(ptr,ptr2);
// different impl
- ptr2.reset( new _Ptr_element_type );
+ ptr2.reset( new Ptr_element_type );
T_NE(ptr,ptr2);
}
// assign
ptr = nullptr;
T_NULL;
T_UNIQUE;
- ptr = _RW( nullptr );
+ ptr = RW( nullptr );
T_NULL;
T_UNIQUE;
}
-template<class _RW>
+template<class RW>
void cowt()
{
- test<_RW>();
+ test<RW>();
MIL << __PRETTY_FUNCTION__ << std::endl;
- typedef typename _RW::_Ptr::element_type _Ptr_element_type;
+ typedef typename RW::PtrType::element_type Ptr_element_type;
// create
- _RW ptr( new _Ptr_element_type );
+ RW ptr( new Ptr_element_type );
unsigned long ptrid = ptr->numericId();
// share
- _RW ptr2( ptr );
+ RW ptr2( ptr );
// clone aon access
unsigned long ptrid2 = ptr2->numericId();
assert( ptrid != ptrid2 );
////////////////////////////////////////////////////////////////////////////////
// tools
////////////////////////////////////////////////////////////////////////////////
-template<class _Tp>
-inline const _Tp & max( const _Tp & lhs, const _Tp & rhs )
+template<class Tp>
+inline const Tp & max( const Tp & lhs, const Tp & rhs )
{ return lhs < rhs ? rhs : lhs; }
-template<class _Tp, int N>
-inline _Tp * begin( _Tp (& _array)[N] ) { return _array; }
+template<class Tp, int N>
+inline Tp * begin( Tp (& _array)[N] ) { return _array; }
-template<class _Tp, int N>
-inline _Tp * end( _Tp (& _array)[N] ) { return _array + (sizeof(_array)/sizeof(_Tp)); }
+template<class Tp, int N>
+inline Tp * end( Tp (& _array)[N] ) { return _array + (sizeof(_array)/sizeof(Tp)); }
ResStatus::TransactByValue transactByValues[] = {
ResStatus::USER, ResStatus::APPL_HIGH, ResStatus::APPL_LOW, ResStatus::SOLVER
// TRANSACT = bit::RangeValue<TransactField,2>::value // transact according to state
// };
-template <class _Iter>
-inline bool _all( _Iter begin_r, _Iter end_r, ResStatus::TransactValue val_r )
+template <class TIter>
+inline bool _all( TIter begin_r, TIter end_r, ResStatus::TransactValue val_r )
{
for_( it, begin_r, end_r )
{
return true;
}
-template <class _Iter>
-inline bool _none( _Iter begin_r, _Iter end_r, ResStatus::TransactValue val_r )
+template <class TIter>
+inline bool _none( TIter begin_r, TIter end_r, ResStatus::TransactValue val_r )
{
for_( it, begin_r, end_r )
{
return true;
}
-template <class _Iter>
-inline bool _atLeastOne( _Iter begin_r, _Iter end_r, ResStatus::TransactValue val_r )
+template <class TIter>
+inline bool _atLeastOne( TIter begin_r, TIter end_r, ResStatus::TransactValue val_r )
{ return ! _none( begin_r, end_r, val_r ); }
inline bool _allBySolver( ui::Selectable::Ptr sel )
{
const CompatEntry & target( assertCompatSetEntry( targetArch_r ) );
target.addCompatBit( assertCompatSetEntry( arch0_r )._idBit );
-#define _SETARG(N) if ( arch##N##_r.empty() ) return; target.addCompatBit( assertCompatSetEntry( arch##N##_r )._idBit )
- _SETARG(1); _SETARG(2); _SETARG(3); _SETARG(4);
- _SETARG(5); _SETARG(6); _SETARG(7); _SETARG(8); _SETARG(9);
-#undef _SETARG
+#define SETARG(N) if ( arch##N##_r.empty() ) return; target.addCompatBit( assertCompatSetEntry( arch##N##_r )._idBit )
+ SETARG(1); SETARG(2); SETARG(3); SETARG(4);
+ SETARG(5); SETARG(6); SETARG(7); SETARG(8); SETARG(9);
+#undef SETARG
}
private:
///////////////////////////////////////////////////////////////////
//
- // CLASS NAME : AutoDispose<_Tp>
+ // CLASS NAME : AutoDispose<Tp>
//
- /** Reference counted access to a \c _Tp object calling a custom
+ /** Reference counted access to a \c Tp object calling a custom
* \c Dispose function when the last AutoDispose handle to it is
* destroyed or reset.
*
* \note As with pointers, constness of an \c AutoDispose object does
- * \b not apply to the stored \c _Tp object. If the stored \c _Tp object
- * should be immutable, you should use <tt>AutoDispose\<const _Tp\></tt>.
+ * \b not apply to the stored \c Tp object. If the stored \c Tp object
+ * should be immutable, you should use <tt>AutoDispose\<const Tp\></tt>.
*
* Pass a filename to the application and provide the appropriate
* code to be executed when the file is no longer needed:
* }
* \endcode
*/
- template<class _Tp>
+ template<class Tp>
class AutoDispose
{
public:
- typedef typename boost::call_traits<_Tp>::param_type param_type;
- typedef typename boost::call_traits<_Tp>::reference reference;
- typedef typename boost::call_traits<_Tp>::const_reference const_reference;
- typedef _Tp value_type;
- typedef typename boost::call_traits<_Tp>::value_type result_type;
+ typedef typename boost::call_traits<Tp>::param_type param_type;
+ typedef typename boost::call_traits<Tp>::reference reference;
+ typedef typename boost::call_traits<Tp>::const_reference const_reference;
+ typedef Tp value_type;
+ typedef typename boost::call_traits<Tp>::value_type result_type;
public:
/** Dispose function signatue. */
public:
- /** Provide implicit conversion to \c _Tp\&. */
+ /** Provide implicit conversion to \c Tp\&. */
operator reference() const
{ return _pimpl->_value; }
- /** Reference to the \c _Tp object. */
+ /** Reference to the \c Tp object. */
reference value() const
{ return _pimpl->_value; }
- /** Reference to the \c _Tp object. */
+ /** Reference to the \c Tp object. */
reference operator*() const
{ return _pimpl->_value; }
- /** Pointer to the \c _Tp object (asserted to be <tt>!= NULL</tt>). */
+ /** Pointer to the \c Tp object (asserted to be <tt>!= NULL</tt>). */
value_type * operator->() const
{ return & _pimpl->_value; }
};
///////////////////////////////////////////////////////////////////
- /** \relates AutoDispose Stream output of the \c _Tp object. */
- template<class _Tp>
- inline std::ostream & operator<<( std::ostream & str, const AutoDispose<_Tp> & obj )
+ /** \relates AutoDispose Stream output of the \c Tp object. */
+ template<class Tp>
+ inline std::ostream & operator<<( std::ostream & str, const AutoDispose<Tp> & obj )
{ return str << obj.value(); }
/////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
/**
* \todo Use boost::mpl library to assert constraints
- * at compiletime! There various like (_IntT is an integral type)
+ * at compiletime! There various like (TInt is an integral type)
* (begin+size < maxbits) or ( field dependent
* constants must be within the range defined by size ).
*/
namespace bit_detail
{
/** Generate constants with \a _size trailing '1'-bits */
- template<class _IntT, unsigned _size>
+ template<class TInt, unsigned _size>
struct Gen1Bits
{
- static const _IntT value = (Gen1Bits<_IntT,_size-1>::value << 1)+1;
+ static const TInt value = (Gen1Bits<TInt,_size-1>::value << 1)+1;
};
/** Specialization for \a _length 0 */
- template<class _IntT>
- struct Gen1Bits<_IntT, 0>
+ template<class TInt>
+ struct Gen1Bits<TInt, 0>
{
- static const _IntT value = 0;
+ static const TInt value = 0;
};
}
- /** Number of bits available in \a _IntT. */
- template<class _IntT>
+ /** Number of bits available in \a TInt. */
+ template<class TInt>
struct MaxBits
{
- typedef _IntT IntT;
+ typedef TInt IntT;
static const unsigned value = (sizeof(IntT)*8);
};
/** For printing bits. */
- template<class _IntT>
- inline std::string asString( _IntT val, char zero = '0', char one = '1' )
+ template<class TInt>
+ inline std::string asString( TInt val, char zero = '0', char one = '1' )
{
- std::string s( MaxBits<_IntT>::value, zero );
- for( unsigned i = MaxBits<_IntT>::value; i; )
+ std::string s( MaxBits<TInt>::value, zero );
+ for( unsigned i = MaxBits<TInt>::value; i; )
{
--i;
- if ( val & (_IntT)1 )
+ if ( val & (TInt)1 )
s[i] = one;
val = val >> 1;
};
}
/** A bitmaks of \a _size 1-bits starting at bit \a _begin. */
- template<class _IntT, unsigned _begin, unsigned _size>
+ template<class TInt, unsigned _begin, unsigned _size>
struct Mask
{
- typedef _IntT IntT;
+ typedef TInt IntT;
static const IntT value = bit_detail::Gen1Bits<IntT,_size>::value << _begin;
static const IntT inverted = ~value;
};
/** Range of bits starting at bit \a _begin with length \a _size. */
- template<class _IntT, unsigned _begin, unsigned _size>
+ template<class TInt, unsigned _begin, unsigned _size>
struct Range
{
- typedef _IntT IntT;
+ typedef TInt IntT;
typedef zypp::bit::MaxBits<IntT> MaxBits;
typedef zypp::bit::Mask<IntT,_begin,_size> Mask;
* Force error at compiletime. Currently because types
* and values are undefined
*/
- template<class _IntT, unsigned _begin>
- struct Range<_IntT, _begin, 0>
+ template<class TInt, unsigned _begin>
+ struct Range<TInt, _begin, 0>
{};
/** A value with in a Range.
* RangeValue<SubField,3>::value; // 00001100
* \endcode
*/
- template<class _Range, typename _Range::IntT _value>
+ template<class TRange, typename TRange::IntT _value>
struct RangeValue
{
- typedef _Range RangeT;
- typedef typename _Range::IntT IntT;
+ typedef TRange RangeT;
+ typedef typename TRange::IntT IntT;
static const IntT value = _value << RangeT::begin;
};
* RangeBit<SubField,2>::value; // 00010000
* \endcode
*/
- template<class _Range, unsigned _pos>
+ template<class TRange, unsigned _pos>
struct RangeBit
{
- typedef _Range RangeT;
- typedef typename _Range::IntT IntT;
+ typedef TRange RangeT;
+ typedef typename TRange::IntT IntT;
static const IntT value = IntT(1) << (RangeT::begin + _pos);
};
* bf<SubField>.assign( 0 ); // 11100011
* \endcode
*/
- template<class _IntT>
- class BitField : public Range<_IntT, 0, MaxBits<_IntT>::value>
+ template<class TInt>
+ class BitField : public Range<TInt, 0, MaxBits<TInt>::value>
{
public:
/** Default ctor: zero. */
BitField()
- : _value( (_IntT)0 )
+ : _value( (TInt)0 )
{}
- /** Ctor taking an \a _IntT. */
- BitField( const _IntT & value_r )
+ /** Ctor taking an \a TInt. */
+ BitField( const TInt & value_r )
: _value( value_r )
{}
public:
/** Validate in a boolean context. */
explicit operator bool() const
- { return _value != (_IntT)0; }
+ { return _value != (TInt)0; }
public:
/** Return the value. */
- template<class _Range>
- _IntT value() const
+ template<class TRange>
+ TInt value() const
{
- return _value & _Range::Mask::value;
+ return _value & TRange::Mask::value;
}
- _IntT value() const
+ TInt value() const
{
return _value;
}
/** Value as bit string. */
- template<class _Range>
+ template<class TRange>
std::string asString() const
{
- return bit::asString( _value & _Range::Mask::value, '_' );
+ return bit::asString( _value & TRange::Mask::value, '_' );
}
std::string asString() const
{
}
/** Assign Range in \a rhs to \c this. */
- template<class _Range>
- BitField & assign( _IntT rhs )
+ template<class TRange>
+ BitField & assign( TInt rhs )
{
- _value = (_value & _Range::Mask::inverted)
- | (rhs & _Range::Mask::value);
+ _value = (_value & TRange::Mask::inverted)
+ | (rhs & TRange::Mask::value);
return *this;
}
- BitField & assign( _IntT rhs )
+ BitField & assign( TInt rhs )
{
_value = rhs;
return *this;
}
/** Test for equal value within a Range. */
- template<class _Range>
- bool isEqual( _IntT rhs ) const
+ template<class TRange>
+ bool isEqual( TInt rhs ) const
{
- return (_value & _Range::Mask::value)
- == (rhs & _Range::Mask::value);
+ return (_value & TRange::Mask::value)
+ == (rhs & TRange::Mask::value);
}
- bool isEqual( _IntT rhs ) const
+ bool isEqual( TInt rhs ) const
{
return _value == rhs;
}
public:
/** Set or unset bits of \a rhs. */
- template<class _Range>
- BitField & set( _IntT rhs, bool doset_r )
- { return set( (rhs & _Range::Mask::value), doset_r ); }
+ template<class TRange>
+ BitField & set( TInt rhs, bool doset_r )
+ { return set( (rhs & TRange::Mask::value), doset_r ); }
- BitField & set( _IntT rhs, bool doset_r )
+ BitField & set( TInt rhs, bool doset_r )
{ return doset_r ? set( rhs ) : unset( rhs ); }
/** Set bits of \a rhs. */
- template<class _Range>
- BitField & set( _IntT rhs )
- { return set( rhs & _Range::Mask::value ); }
+ template<class TRange>
+ BitField & set( TInt rhs )
+ { return set( rhs & TRange::Mask::value ); }
- BitField & set( _IntT rhs )
+ BitField & set( TInt rhs )
{ _value |= rhs; return *this; }
/** Unset bits of \a rhs. */
- template<class _Range>
- BitField & unset( _IntT rhs )
- { return unset( rhs & _Range::Mask::value ); }
+ template<class TRange>
+ BitField & unset( TInt rhs )
+ { return unset( rhs & TRange::Mask::value ); }
- BitField & unset( _IntT rhs )
+ BitField & unset( TInt rhs )
{ _value &= ~rhs; return *this; }
/** Test whether \b all bits of \a rhs are set. */
- template<class _Range>
- bool test( _IntT rhs )
- { return test( rhs & _Range::Mask::value ); }
+ template<class TRange>
+ bool test( TInt rhs )
+ { return test( rhs & TRange::Mask::value ); }
- bool test( _IntT rhs ) const
+ bool test( TInt rhs ) const
{ return (_value & rhs) == rhs; }
/** Test whether \b at \b least \b one bit of \a rhs is set. */
- template<class _Range>
- bool testAnyOf( _IntT rhs )
- { return testAnyOf( rhs & _Range::Mask::value ); }
+ template<class TRange>
+ bool testAnyOf( TInt rhs )
+ { return testAnyOf( rhs & TRange::Mask::value ); }
- bool testAnyOf( _IntT rhs ) const
+ bool testAnyOf( TInt rhs ) const
{ return (_value & rhs); }
public:
{ return ~_value; }
private:
- _IntT _value;
+ TInt _value;
};
///////////////////////////////////////////////////////////////////
/** \relates BitField Stream output */
- template<class _IntT>
- std::ostream & operator<<( std::ostream & str, const BitField<_IntT> & obj )
+ template<class TInt>
+ std::ostream & operator<<( std::ostream & str, const BitField<TInt> & obj )
{
return str << obj.asString();
}
/** \relates BitField */
- template<class _IntT>
- inline bool operator==( const BitField<_IntT> & lhs, const BitField<_IntT> & rhs )
+ template<class TInt>
+ inline bool operator==( const BitField<TInt> & lhs, const BitField<TInt> & rhs )
{ return lhs.value() == rhs.value(); }
/** \relates BitField */
- template<class _IntT>
- inline bool operator!=( const BitField<_IntT> & lhs, const BitField<_IntT> & rhs )
+ template<class TInt>
+ inline bool operator!=( const BitField<TInt> & lhs, const BitField<TInt> & rhs )
{ return ! (lhs == rhs); }
/** \relates BitField */
- template<class _IntT>
- inline BitField<_IntT> operator&( const BitField<_IntT> & lhs, const BitField<_IntT> & rhs )
- { return BitField<_IntT>(lhs) &= rhs; }
+ template<class TInt>
+ inline BitField<TInt> operator&( const BitField<TInt> & lhs, const BitField<TInt> & rhs )
+ { return BitField<TInt>(lhs) &= rhs; }
/** \relates BitField */
- template<class _IntT>
- inline BitField<_IntT> operator|( const BitField<_IntT> & lhs, const BitField<_IntT> & rhs )
- { return BitField<_IntT>(lhs) |= rhs; }
+ template<class TInt>
+ inline BitField<TInt> operator|( const BitField<TInt> & lhs, const BitField<TInt> & rhs )
+ { return BitField<TInt>(lhs) |= rhs; }
/** \relates BitField */
- template<class _IntT>
- inline BitField<_IntT> operator^( const BitField<_IntT> & lhs, const BitField<_IntT> & rhs )
- { return BitField<_IntT>(lhs) ^= rhs; }
+ template<class TInt>
+ inline BitField<TInt> operator^( const BitField<TInt> & lhs, const BitField<TInt> & rhs )
+ { return BitField<TInt>(lhs) ^= rhs; }
/** \relates BitField */
- template<class _IntT>
- inline BitField<_IntT> operator<<( const BitField<_IntT> & lhs, unsigned num )
- { return BitField<_IntT>(lhs) <<= num; }
+ template<class TInt>
+ inline BitField<TInt> operator<<( const BitField<TInt> & lhs, unsigned num )
+ { return BitField<TInt>(lhs) <<= num; }
/** \relates BitField */
- template<class _IntT>
- inline BitField<_IntT> operator>>( const BitField<_IntT> & lhs, unsigned num )
- { return BitField<_IntT>(lhs) >>= num; }
+ template<class TInt>
+ inline BitField<TInt> operator>>( const BitField<TInt> & lhs, unsigned num )
+ { return BitField<TInt>(lhs) >>= num; }
/////////////////////////////////////////////////////////////////
} // namespace bit
InstanceId.cc
KeyRing.cc
Locks.cc
- MediaProducts.cc
MediaSetAccess.cc
OnMediaLocation.cc
Package.cc
*
* \par Sending a Task report (SENDER SIDE).
*
- * Simply create a callback::SendReport<_Report>, where _Report
+ * Simply create a callback::SendReport<TReport>, where TReport
* is your task report structure. Invoke the callback functions
* as needed. That's it.
*
* argument.
*
* Convenient sending can be achieved by installing non-virtual methods
- * in the _Report class, which encode the arguments in UserData and send
+ * in the TReport class, which encode the arguments in UserData and send
* them via ReportBase::report().
*
* Convenient receiving can be achieved by installing virtual methods in
- * the _Report class, which can be simply overloaded by the receiver. Downside
+ * the TReport class, which can be simply overloaded by the receiver. Downside
* of this is that adding virtual methods breaks binary compatibility.
*/
namespace callback
};
/** */
- template<class _Report>
+ template<class TReport>
class DistributeReport;
/** */
- template<class _Report>
- struct ReceiveReport : public _Report
+ template<class TReport>
+ struct ReceiveReport : public TReport
{
- typedef _Report ReportType;
- typedef ReceiveReport<_Report> Receiver;
- typedef DistributeReport<_Report> Distributor;
+ typedef TReport ReportType;
+ typedef ReceiveReport<TReport> Receiver;
+ typedef DistributeReport<TReport> Distributor;
virtual ~ReceiveReport()
{ disconnect(); }
};
/** */
- template<class _Report>
+ template<class TReport>
struct DistributeReport
{
public:
- typedef _Report ReportType;
- typedef ReceiveReport<_Report> Receiver;
- typedef DistributeReport<_Report> Distributor;
+ typedef TReport ReportType;
+ typedef ReceiveReport<TReport> Receiver;
+ typedef DistributeReport<TReport> Distributor;
static DistributeReport & instance()
{
};
/** */
- template<class _Report>
+ template<class TReport>
struct SendReport : private zypp::base::NonCopyable
{
- typedef _Report ReportType;
- typedef ReceiveReport<_Report> Receiver;
- typedef DistributeReport<_Report> Distributor;
+ typedef TReport ReportType;
+ typedef ReceiveReport<TReport> Receiver;
+ typedef DistributeReport<TReport> Distributor;
SendReport()
{ Distributor::instance()->reportbegin(); }
* ...// r receiving the report
* \endcode
*/
- template<class _Report>
+ template<class TReport>
struct TempConnect
{
- typedef _Report ReportType;
- typedef ReceiveReport<_Report> Receiver;
- typedef DistributeReport<_Report> Distributor;
+ typedef TReport ReportType;
+ typedef ReceiveReport<TReport> Receiver;
+ typedef DistributeReport<TReport> Distributor;
TempConnect()
: _oldRec( Distributor::instance().getReceiver() )
/** Build \ref Capability from data. No parsing required.
*/
- sat::detail::IdType relFromStr( ::_Pool * pool_r,
+ sat::detail::IdType relFromStr( sat::detail::CPool * pool_r,
const Arch & arch_r,
const std::string & name_r,
Rel op_r,
/** Build \ref Capability from data, just parsing name for '[.arch]' and detect
* 'kind srcpackage' (will be mapped to arch \c src).
*/
- sat::detail::IdType relFromStr( ::_Pool * pool_r,
+ sat::detail::IdType relFromStr( sat::detail::CPool * pool_r,
const std::string & name_r, Rel op_r, const Edition & ed_r,
const ResKind & kind_r )
{
/** Full parse from string, unless Capability::PARSED.
*/
- sat::detail::IdType relFromStr( ::_Pool * pool_r,
+ sat::detail::IdType relFromStr( sat::detail::CPool * pool_r,
const Arch & arch_r, // parse from name if empty
const std::string & str_r, const ResKind & kind_r,
Capability::CtorFlag flag_r )
// class CpeId::WfnAttribute
///////////////////////////////////////////////////////////////////
- const std::string & CpeId::_AttributeDef::asString( Enum val_r )
+ const std::string & CpeId::EAttributeDef::asString( Enum val_r )
{
static std::map<Enum,std::string> _table = {
#define OUTS(N) { N, #N }
#if WFN_STRICT_SPEC
//SetCompare CpeId::Value::setRelationMixinCompare( const CpeId::Value & trg ) const
{
- static const SetCompare _NeedsCloserLook( SetCompare::Enum(-1) ); // artificial Compare value
+ static const SetCompare kNeedsCloserLook( SetCompare::Enum(-1) ); // artificial Compare value
static const SetCompare matchTabel[4][4] = {{
/* ANY, ANY */ SetCompare::equal,
/* ANY, NA */ SetCompare::properSuperset,
},{
/* wildcardfree, ANY */ SetCompare::properSubset,
/* wildcardfree, NA */ SetCompare::disjoint,
- /* wildcardfree, wildcardfree */ _NeedsCloserLook, // equal or disjoint
+ /* wildcardfree, wildcardfree */ kNeedsCloserLook, // equal or disjoint
/* wildcardfree, wildcarded */ SetCompare::uncomparable,
},{
/* wildcarded, ANY */ SetCompare::properSubset,
/* wildcarded, NA */ SetCompare::disjoint,
- /* wildcarded, wildcardfree */ _NeedsCloserLook, // superset or disjoint
+ /* wildcarded, wildcardfree */ kNeedsCloserLook, // superset or disjoint
/* wildcarded, wildcarded */ SetCompare::uncomparable,
}};
Type srcType = type();
Type trgType = trg.type();
SetCompare ret = matchTabel[srcType.asIntegral()][trgType.asIntegral()];
- if ( ret == _NeedsCloserLook )
+ if ( ret == kNeedsCloserLook )
{
if ( srcType == Type::wildcardfree ) // trgType == Type::wildcardfree
{
public:
/** WFN attributes (use like 'enum class \ref Attribute') */
- struct _AttributeDef {
+ struct EAttributeDef {
enum Enum {
part, //< attribute (2.2)
vendor, //< attribute (2.2)
static constexpr unsigned numAttributes = other+1; ///< number of attributes
static const std::string & asString( Enum val_r ); ///< string representantion
};
- typedef base::EnumClass<_AttributeDef> Attribute; ///< 'enum class Attribute'
+ typedef base::EnumClass<EAttributeDef> Attribute; ///< 'enum class Attribute'
public:
/** Indicator type for non-trowing ctor. */
public:
/** Classification of \ref Value types mostly for \ref match (use like 'enum class \ref Type') */
- struct _TypeDef {
+ struct ETypeDef {
enum Enum {
ANY,
NA,
wildcarded,
};
};
- typedef base::EnumClass<_TypeDef> Type; ///< 'enum class Type'
+ typedef base::EnumClass<ETypeDef> Type; ///< 'enum class Type'
/** Return the \ref Type of this \ref Value. */
Type type() const
/** \name Printing in various predefined formats */
//@{
/** Date formats for printing (use like 'enum class \ref DateFormat') */
- struct _DateFormatDef { enum Enum {
+ struct EDateFormatDef { enum Enum {
none, ///< ""
calendar, ///< 2014-02-07
month, ///< 2014-02
weekday, ///< 2014-W06-5 (1 is Monday)
ordinal, ///< 2014-038
};};
- typedef base::EnumClass<_DateFormatDef> DateFormat; ///< 'enum class DateFormat'
+ typedef base::EnumClass<EDateFormatDef> DateFormat; ///< 'enum class DateFormat'
/** Time formats for printing (use like 'enum class \ref TimeFormat') */
- struct _TimeFormatDef { enum Enum {
+ struct ETimeFormatDef { enum Enum {
none, ///< ""
seconds, ///< 07:06:41
minutes, ///< 07:06
hours, ///< 07
};};
- typedef base::EnumClass<_TimeFormatDef> TimeFormat; ///< 'enum class TimeFormat'
+ typedef base::EnumClass<ETimeFormatDef> TimeFormat; ///< 'enum class TimeFormat'
/** Timezone indicator for printing (use like 'enum class \ref TimeZoneFormat') */
- struct _TimeZoneFormatDef { enum Enum {
+ struct ETimeZoneFormatDef { enum Enum {
none, ///< ""
name, ///< UTC, CET, ...
offset, ///< +00[:00]
};};
- typedef base::EnumClass<_TimeZoneFormatDef> TimeZoneFormat; ///< 'enum class TimeZoneFormat'
+ typedef base::EnumClass<ETimeZoneFormatDef> TimeZoneFormat; ///< 'enum class TimeZoneFormat'
/** Default format is <tt>'2014-02-07 07:06:41 CET'</tt>
* The default is \ref DateFormat::calendar, \ref TimeFormat::seconds, \ref TimeZoneFormat::name and
//
//////////////////////////////////////////////////////////////////////
- namespace _ExternalProgram
+ namespace externalprogram
{
EarlyPipe::EarlyPipe()
{
if ( _stderr )
::fclose( _stderr );
}
- }
+ } // namespace externalprogram
bool ExternalProgramWithStderr::stderrGetUpTo( std::string & retval_r, const char delim_r, bool returnDelim_r )
{
};
- namespace _ExternalProgram
+ namespace externalprogram
{
/** Helper providing pipe FDs for \ref ExternalProgramWithStderr.
* Moved to a basse class because the pipe needs to be initialized
FILE * _stderr;
int _fds[2];
};
- }
+ } // namespace externalprogram
/** ExternalProgram extended to offer reading programs stderr.
* \see \ref ExternalProgram
*/
- class ExternalProgramWithStderr : private _ExternalProgram::EarlyPipe, public ExternalProgram
+ class ExternalProgramWithStderr : private externalprogram::EarlyPipe, public ExternalProgram
{
public:
ExternalProgramWithStderr( const Arguments & argv_r )
public:
/** Return \c FILE* to read programms stderr (O_NONBLOCK set). */
- using _ExternalProgram::EarlyPipe::stderr;
+ using externalprogram::EarlyPipe::stderr;
/** Read data up to \c delim_r from stderr (nonblocking).
* \note If \c delim_r is '\0', we read as much data as possible.
{ return _sel && _sel( solv_r ); }
/** Filter fitting PoolItem/ResObject. */
- template<class _Solv>
- bool operator()( const _Solv & solv_r ) const
+ template<class TSolv>
+ bool operator()( const TSolv & solv_r ) const
{ return operator()( solv_r.satSolvable() ); }
private:
{ return solv_r.isKind( _kind ); }
/** Filter fitting PoolItem/ResObject. */
- template<class _Solv>
- bool operator()( const _Solv & solv_r ) const
+ template<class TSolv>
+ bool operator()( const TSolv & solv_r ) const
{ return operator()( solv_r.satSolvable() ); }
private:
};
/** \relates ByKind templated convenience ctor. */
- template<class _Res>
+ template<class TRes>
inline ByKind byKind()
- { return ByKind( ResTraits<_Res>::kind ); }
+ { return ByKind( ResTraits<TRes>::kind ); }
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
{ return _pred && (pi_r.status().*_pred)(); }
/** Filter fitting sat::Solvable/ResObject. */
- template<class _Solv>
- bool operator()( const _Solv & solv_r ) const
+ template<class TSolv>
+ bool operator()( const TSolv & solv_r ) const
{ return operator()( PoolItem(solv_r) ); }
private:
{}
/** Fitting PoolItem/ResObject. */
- template<class _Solv>
- SameItemAs( const _Solv & solv_r )
+ template<class TSolv>
+ SameItemAs( const TSolv & solv_r )
: _item( solv_r.satSolvable() )
{}
}
/** Filter fitting PoolItem/ResObject. */
- template<class _Solv>
- bool operator()( const _Solv & solv_r ) const
+ template<class TSolv>
+ bool operator()( const TSolv & solv_r ) const
{ return operator()( solv_r.satSolvable() ); }
private:
int Glob::add( const char * pattern_r, Flags flags_r )
{
- static Flags _APPEND( GLOB_APPEND ); // not published
+ static Flags kAppend( GLOB_APPEND ); // not published
if ( ! flags_r )
flags_r = _defaultFlags;
if ( _result )
- flags_r |= _APPEND;
+ flags_r |= kAppend;
else
_result.reset( new ::glob_t );
return( _lastGlobReturn = ::glob( pattern_r, flags_r, NULL, &(*_result) ) );
kErr = GLOB_ERR, //!< Return on read errors.
kMark = GLOB_MARK, //!< Append a slash to each name.
kNoSort = GLOB_NOSORT, //!< Don't sort the names.
- // unsupported _DOOFFS = GLOB_DOOFFS, //!< Insert PGLOB->gl_offs NULLs.
+ // unsupported kDoOffs = GLOB_DOOFFS, //!< Insert PGLOB->gl_offs NULLs.
kNoCheck = GLOB_NOCHECK, //!< If nothing matches, return the pattern.
- // autoapplied _APPEND = GLOB_APPEND, //!< Append to results of a previous call.
+ // autoapplied kAppend = GLOB_APPEND, //!< Append to results of a previous call.
kNoEscape = GLOB_NOESCAPE, //!< Backslashes don't quote metacharacters.
kPeriod = GLOB_PERIOD, //!< Leading `.' can be matched by metachars.
- // unsupported _MAGCHAR = GLOB_MAGCHAR,//!< Set in gl_flags if any metachars seen.
+ // unsupported kMagChar = GLOB_MAGCHAR,//!< Set in gl_flags if any metachars seen.
kAltDirFunc = GLOB_ALTDIRFUNC, //!< Use gl_opendir et al functions.
kBrace = GLOB_BRACE, //!< Expand "{a,b}" to "a" "b".
kNoMagic = GLOB_NOMAGIC, //!< If no magic chars, return the pattern.
public:
- /** \name Collecting Glob results to some _OutputIterator
+ /** \name Collecting Glob results to some TOutputIterator
* \code
* std::list<Pathname> p;
* Glob::collect( "/bin/a*.dat}", std::back_inserter(p) );
- * Glob::collect( "/bin/a*{.xml,.xml.gz}", Glob::_BRACE, std::back_inserter(p) );
+ * Glob::collect( "/bin/a*{.xml,.xml.gz}", Glob::kBrace, std::back_inserter(p) );
* \endcode
*/
//@{
/** Write glob result to some \c OutputIterator. */
- template<class _OutputIterator>
- static int collect( const Pathname & pattern_r, _OutputIterator result_r )
+ template<class TOutputIterator>
+ static int collect( const Pathname & pattern_r, TOutputIterator result_r )
{ return collect( pattern_r.c_str(), Flags(), result_r ); }
/** \overload */
- template<class _OutputIterator>
- static int collect( const std::string & pattern_r, _OutputIterator result_r )
+ template<class TOutputIterator>
+ static int collect( const std::string & pattern_r, TOutputIterator result_r )
{ return collect( pattern_r.c_str(), Flags(), result_r ); }
/** \overload */
- template<class _OutputIterator>
- static int collect( const char * pattern_r, _OutputIterator result_r )
+ template<class TOutputIterator>
+ static int collect( const char * pattern_r, TOutputIterator result_r )
{ return collect( pattern_r, Flags(), result_r ); }
/** \overload With \ref Flags */
- template<class _OutputIterator>
- static int collect( const Pathname & pattern_r, Flags flags_r, _OutputIterator result_r )
+ template<class TOutputIterator>
+ static int collect( const Pathname & pattern_r, Flags flags_r, TOutputIterator result_r )
{ return collect( pattern_r.c_str(), flags_r, result_r ); }
/** \overload */
- template<class _OutputIterator>
- static int collect( const std::string & pattern_r, Flags flags_r, _OutputIterator result_r )
+ template<class TOutputIterator>
+ static int collect( const std::string & pattern_r, Flags flags_r, TOutputIterator result_r )
{ return collect( pattern_r.c_str(), flags_r, result_r ); }
/** \overload */
- template<class _OutputIterator>
- static int collect( const char * pattern_r, Flags flags_r, _OutputIterator result_r )
+ template<class TOutputIterator>
+ static int collect( const char * pattern_r, Flags flags_r, TOutputIterator result_r )
{
Glob glob( pattern_r, flags_r );
if ( glob.lastGlobReturn() == 0 )
for_( it, glob.begin(), glob.end() )
- (*result_r)++ = typename _OutputIterator::container_type::value_type(*it);
+ (*result_r)++ = typename TOutputIterator::container_type::value_type(*it);
return glob.lastGlobReturn();
}
//@}
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-
-
-#undef ZYPP_BASE_LOGGER_LOGGROUP
-#define ZYPP_BASE_LOGGER_LOGGROUP "zypp"
-
-#include "zypp/MediaProducts.h"
-
-using namespace std;
-
-namespace zypp
-{
-
-// template<class _OutputIterator>
-// void productsInMedia( const Url & url_r, _OutputIterator result )
-
-
-} // ns zypp
-
-// vim: set ts=2 sts=2 sw=2 et ai:
/**
* FIXME: add a comment here...
*/
- template <class _OutputIterator>
- static void scanProductsFile( const Pathname & file_r, _OutputIterator result )
+ template <class TOutputIterator>
+ static void scanProductsFile( const Pathname & file_r, TOutputIterator result )
{
std::ifstream pfile( file_r.asString().c_str() );
while ( pfile.good() ) {
* items will be inserted.
* \throws MediaException If accessng the media fails
*/
- template <class _OutputIterator>
- void productsInMedia( const Url & url_r, _OutputIterator result )
+ template <class TOutputIterator>
+ void productsInMedia( const Url & url_r, TOutputIterator result )
{
media::MediaManager media_mgr;
// open the media
/** \overload taking container of category strings
* 2nd template arg just to prevent instantiation for Category
*/
- template <class _Container, typename = typename _Container::value_type>
- bool isCategory( const _Container & categories_r ) const
+ template <class TContainer, typename = typename TContainer::value_type>
+ bool isCategory( const TContainer & categories_r ) const
{
for ( const std::string & el : categories_r )
{ if ( isCategory( el ) ) return true; }
/** \overload taking container of severity strings
* 2nd template arg just to prevent instantiation for SeverityFlag
*/
- template <class _Container, typename = typename _Container::value_type>
- bool isSeverity( const _Container & severities_r ) const
+ template <class TContainer, typename = typename TContainer::value_type>
+ bool isSeverity( const TContainer & severities_r ) const
{
for ( const std::string & el : severities_r )
{ if ( isSeverity( el ) ) return true; }
//
///////////////////////////////////////////////////////////////////
- /******************************************************************
- **
- ** FUNCTION NAME : _Log_Result
- ** FUNCTION TYPE : int
- **
- ** DESCRIPTION : Helper function to log return values.
- */
-#define _Log_Result MIL << endl, __Log_Result
- inline int __Log_Result( const int res, const char * rclass = 0 /*errno*/ )
- {
- if ( res )
+#define logResult MIL << endl, doLogResult
+ namespace {
+ /** Helper function to log return values. */
+ inline int doLogResult( const int res, const char * rclass = 0 /*errno*/ )
{
- if ( rclass )
- WAR << " FAILED: " << rclass << " " << res << endl;
- else
- WAR << " FAILED: " << str::strerror( res ) << endl;
+ if ( res )
+ {
+ if ( rclass )
+ WAR << " FAILED: " << rclass << " " << res << endl;
+ else
+ WAR << " FAILED: " << str::strerror( res ) << endl;
+ }
+ return res;
}
- return res;
- }
+ } // namespace
///////////////////////////////////////////////////////////////////
//
{
MIL << "mkdir " << path << ' ' << str::octstring( mode );
if ( ::mkdir( path.asString().c_str(), mode ) == -1 ) {
- return _Log_Result( errno );
+ return logResult( errno );
}
- return _Log_Result( 0 );
+ return logResult( 0 );
}
///////////////////////////////////////////////////////////////////
{
MIL << "rmdir " << path;
if ( ::rmdir( path.asString().c_str() ) == -1 ) {
- return _Log_Result( errno );
+ return logResult( errno );
}
- return _Log_Result( 0 );
+ return logResult( 0 );
}
///////////////////////////////////////////////////////////////////
struct dirent * d;
if ( ! (dp = opendir( dir.c_str() )) )
- return _Log_Result( errno );
+ return logResult( errno );
while ( (d = readdir(dp)) )
{
PathInfo p( path );
if ( !p.isExist() ) {
- return _Log_Result( 0 );
+ return logResult( 0 );
}
if ( !p.isDir() ) {
- return _Log_Result( ENOTDIR );
+ return logResult( ENOTDIR );
}
- return _Log_Result( recursive_rmdir_1( path ) );
+ return logResult( recursive_rmdir_1( path ) );
}
///////////////////////////////////////////////////////////////////
PathInfo p( path );
if ( !p.isExist() ) {
- return _Log_Result( 0 );
+ return logResult( 0 );
}
if ( !p.isDir() ) {
- return _Log_Result( ENOTDIR );
+ return logResult( ENOTDIR );
}
- return _Log_Result( recursive_rmdir_1( path, false/* don't remove path itself */ ) );
+ return logResult( recursive_rmdir_1( path, false/* don't remove path itself */ ) );
}
///////////////////////////////////////////////////////////////////
PathInfo sp( srcpath );
if ( !sp.isDir() ) {
- return _Log_Result( ENOTDIR );
+ return logResult( ENOTDIR );
}
PathInfo dp( destpath );
if ( !dp.isDir() ) {
- return _Log_Result( ENOTDIR );
+ return logResult( ENOTDIR );
}
PathInfo tp( destpath + srcpath.basename() );
if ( tp.isExist() ) {
- return _Log_Result( EEXIST );
+ return logResult( EEXIST );
}
MIL << " " << output;
}
int ret = prog.close();
- return _Log_Result( ret, "returned" );
+ return logResult( ret, "returned" );
}
///////////////////////////////////////////////////////////////////
PathInfo sp( srcpath );
if ( !sp.isDir() ) {
- return _Log_Result( ENOTDIR );
+ return logResult( ENOTDIR );
}
PathInfo dp( destpath );
if ( !dp.isDir() ) {
- return _Log_Result( ENOTDIR );
+ return logResult( ENOTDIR );
}
if ( srcpath == destpath ) {
- return _Log_Result( EEXIST );
+ return logResult( EEXIST );
}
std::string src( srcpath.asString());
MIL << " " << output;
}
int ret = prog.close();
- return _Log_Result( ret, "returned" );
+ return logResult( ret, "returned" );
}
///////////////////////////////////////////////////////////////////////
MIL << "readdir " << dir_r << ' ';
if ( ! dir )
- return _Log_Result( errno );
+ return logResult( errno );
MIL << endl; // close line before callbacks are invoked.
int ret = 0;
{
MIL << "unlink " << path;
if ( ::unlink( path.asString().c_str() ) == -1 ) {
- return _Log_Result( errno );
+ return logResult( errno );
}
- return _Log_Result( 0 );
+ return logResult( 0 );
}
///////////////////////////////////////////////////////////////////
{
MIL << "rename " << oldpath << " -> " << newpath;
if ( ::rename( oldpath.asString().c_str(), newpath.asString().c_str() ) == -1 ) {
- return _Log_Result( errno );
+ return logResult( errno );
}
- return _Log_Result( 0 );
+ return logResult( 0 );
}
///////////////////////////////////////////////////////////////////
{
MIL << "exchange " << lpath << " <-> " << rpath;
if ( lpath.empty() || rpath.empty() )
- return _Log_Result( EINVAL );
+ return logResult( EINVAL );
PathInfo linfo( lpath );
PathInfo rinfo( rpath );
if ( ! linfo.isExist() )
{
if ( ! rinfo.isExist() )
- return _Log_Result( 0 ); // both don't exist.
+ return logResult( 0 ); // both don't exist.
// just rename rpath -> lpath
int ret = assert_dir( lpath.dirname() );
if ( ret != 0 )
- return _Log_Result( ret );
+ return logResult( ret );
if ( ::rename( rpath.c_str(), lpath.c_str() ) == -1 ) {
- return _Log_Result( errno );
+ return logResult( errno );
}
- return _Log_Result( 0 );
+ return logResult( 0 );
}
// HERE: lpath exists:
// just rename lpath -> rpath
int ret = assert_dir( rpath.dirname() );
if ( ret != 0 )
- return _Log_Result( ret );
+ return logResult( ret );
if ( ::rename( lpath.c_str(), rpath.c_str() ) == -1 ) {
- return _Log_Result( errno );
+ return logResult( errno );
}
- return _Log_Result( 0 );
+ return logResult( 0 );
}
// HERE: both exist
TmpFile tmpfile( TmpFile::makeSibling( rpath ) );
if ( ! tmpfile )
- return _Log_Result( errno );
+ return logResult( errno );
Pathname tmp( tmpfile.path() );
::unlink( tmp.c_str() );
if ( ::rename( lpath.c_str(), tmp.c_str() ) == -1 ) {
- return _Log_Result( errno );
+ return logResult( errno );
}
if ( ::rename( rpath.c_str(), lpath.c_str() ) == -1 ) {
::rename( tmp.c_str(), lpath.c_str() );
- return _Log_Result( errno );
+ return logResult( errno );
}
if ( ::rename( tmp.c_str(), rpath.c_str() ) == -1 ) {
::rename( lpath.c_str(), rpath.c_str() );
::rename( tmp.c_str(), lpath.c_str() );
- return _Log_Result( errno );
+ return logResult( errno );
}
- return _Log_Result( 0 );
+ return logResult( 0 );
}
///////////////////////////////////////////////////////////////////
PathInfo sp( file );
if ( !sp.isFile() ) {
- return _Log_Result( EINVAL );
+ return logResult( EINVAL );
}
PathInfo dp( dest );
if ( dp.isDir() ) {
- return _Log_Result( EISDIR );
+ return logResult( EISDIR );
}
const char *const argv[] = {
MIL << " " << output;
}
int ret = prog.close();
- return _Log_Result( ret, "returned" );
+ return logResult( ret, "returned" );
}
///////////////////////////////////////////////////////////////////
{
MIL << "symlink " << newpath << " -> " << oldpath;
if ( ::symlink( oldpath.asString().c_str(), newpath.asString().c_str() ) == -1 ) {
- return _Log_Result( errno );
+ return logResult( errno );
}
- return _Log_Result( 0 );
+ return logResult( 0 );
}
///////////////////////////////////////////////////////////////////
{
MIL << "hardlink " << newpath << " -> " << oldpath;
if ( ::link( oldpath.asString().c_str(), newpath.asString().c_str() ) == -1 ) {
- return _Log_Result( errno );
+ return logResult( errno );
}
- return _Log_Result( 0 );
+ return logResult( 0 );
}
///////////////////////////////////////////////////////////////////
{
int res = unlink( newpath );
if ( res != 0 )
- return _Log_Result( res );
+ return logResult( res );
}
// Here: no symlink, no newpath
return copy( oldpath, newpath );
break;
}
- return _Log_Result( errno );
+ return logResult( errno );
}
- return _Log_Result( 0 );
+ return logResult( 0 );
}
///////////////////////////////////////////////////////////////////
{
target_r = Pathname();
MIL << "readlink " << symlink_r;
- return _Log_Result( errno );
+ return logResult( errno );
}
buf[ret] = '\0';
target_r = buf;
PathInfo sp( file );
if ( !sp.isFile() ) {
- return _Log_Result( EINVAL );
+ return logResult( EINVAL );
}
PathInfo dp( dest );
if ( !dp.isDir() ) {
- return _Log_Result( ENOTDIR );
+ return logResult( ENOTDIR );
}
const char *const argv[] = {
MIL << " " << output;
}
int ret = prog.close();
- return _Log_Result( ret, "returned" );
+ return logResult( ret, "returned" );
}
///////////////////////////////////////////////////////////////////
{
MIL << "chmod " << path << ' ' << str::octstring( mode );
if ( ::chmod( path.asString().c_str(), mode ) == -1 ) {
- return _Log_Result( errno );
+ return logResult( errno );
}
- return _Log_Result( 0 );
+ return logResult( 0 );
}
int addmod( const Pathname & path, mode_t mode )
int ret = assert_dir( path.dirname() );
MIL << "assert_file " << str::octstring( mode ) << " " << path;
if ( ret != 0 )
- return _Log_Result( ret );
+ return logResult( ret );
PathInfo pi( path );
if ( pi.isExist() )
- return _Log_Result( pi.isFile() ? 0 : EEXIST );
+ return logResult( pi.isFile() ? 0 : EEXIST );
int fd = ::creat( path.c_str(), mode );
if ( fd == -1 )
- return _Log_Result( errno );
+ return logResult( errno );
::close( fd );
- return _Log_Result( 0 );
+ return logResult( 0 );
}
///////////////////////////////////////////////////////////////////
times.actime = ::time( 0 );
times.modtime = ::time( 0 );
if ( ::utime( path.asString().c_str(), × ) == -1 ) {
- return _Log_Result( errno );
+ return logResult( errno );
}
- return _Log_Result( 0 );
+ return logResult( 0 );
}
/////////////////////////////////////////////////////////////////
{
if ( _buffer.empty() )
{
- _DBG("PLUGIN") << "< (empty)" << endl;
+ L_DBG("PLUGIN") << "< (empty)" << endl;
}
else
{
std::istringstream datas( _buffer );
- iostr::copyIndent( datas, _DBG("PLUGIN"), "< " ) << endl;
+ iostr::copyIndent( datas, L_DBG("PLUGIN"), "< " ) << endl;
}
}
}
{
std::string line;
while ( _prog.stderrGetline( line ) )
- _WAR("PLUGIN") << "! " << line << endl;
+ L_WAR("PLUGIN") << "! " << line << endl;
}
ExternalProgramWithStderr & _prog;
};
if ( PLUGIN_DEBUG )
{
std::istringstream datas( data );
- iostr::copyIndent( datas, _DBG("PLUGIN") ) << endl;
+ iostr::copyIndent( datas, L_DBG("PLUGIN") ) << endl;
}
// try writing the pipe....
{ _ctor_init(); add( pi_r ); }
/** Ctor feeding a range of \ref sat::Solvable or \ref PoolItem. */
- template<class _Iterator>
- PoolItemBest( _Iterator begin_r, _Iterator end_r )
+ template<class TIterator>
+ PoolItemBest( TIterator begin_r, TIterator end_r )
{ _ctor_init(); add( begin_r, end_r ); }
public:
void add( const PoolItem & pi_r );
/** Feed a range of \ref sat::Solvable or \ref PoolItem. */
- template<class _Iterator>
- void add( _Iterator begin_r, _Iterator end_r )
+ template<class TIterator>
+ void add( TIterator begin_r, TIterator end_r )
{
for_( it, begin_r, end_r )
add( *it );
* string representation instead. If you add new predicated, check the
* deserialization code in \ref deserialize.
*/
- template<class _Predicate>
- void addPredicate( const _Predicate & predicate_r )
+ template<class TPredicate>
+ void addPredicate( const TPredicate & predicate_r )
{
predicate = predicate_r;
predicateStr = predicate_r.serialize();
{ operator+=( query_r ); }
/** Ctor adding a range of items for which \ref operator+= is defined. */
- template<class _QueryResultIter>
- PoolQueryResult( _QueryResultIter begin_r, _QueryResultIter end_r )
+ template<class TQueryResultIter>
+ PoolQueryResult( TQueryResultIter begin_r, TQueryResultIter end_r )
{
for_( it, begin_r, end_r )
{
bool hasUpdateContentIdentifier( const Repository::ContentIdentifier & cident_r ) const;
/** Whether one of the ContentIdentifier is listed as required update repository. */
- template <class _Iterator>
- bool hasUpdateContentIdentifier( _Iterator begin, _Iterator end ) const
+ template <class TIterator>
+ bool hasUpdateContentIdentifier( TIterator begin, TIterator end ) const
{
for_( it, begin, end )
if ( hasUpdateContentIdentifier( *it ) )
}
else
{ // translators: an annotation to a gpg keys expiry date
- ret += str::form( _PL("(expires in %d day)", "(expires in %d days)", ttl ), ttl );
+ ret += str::form( PL_("(expires in %d day)", "(expires in %d days)", ttl ), ttl );
}
}
return ret;
/**
*
*/
- template<class _Tp, class _Compare = Compare<_Tp> >
+ template<class Tp, class TCompare = Compare<Tp> >
struct Range
{
/** */
Rel op;
/** */
- _Tp value;
+ Tp value;
/** Default ctor: \ref Rel::ANY. */
Range()
: op( Rel::ANY )
{}
- /** Ctor taking \a _Tp (\ref Rel::EQ). */
- Range( const _Tp & value_r )
+ /** Ctor taking \a Tp (\ref Rel::EQ). */
+ Range( const Tp & value_r )
: op( Rel::EQ )
, value( value_r )
{}
- /** Ctor taking \ref Rel and \a _Tp. */
- Range( Rel op_r, const _Tp & value_r )
+ /** Ctor taking \ref Rel and \a Tp. */
+ Range( Rel op_r, const Tp & value_r )
: op( op_r )
, value( value_r )
{}
/** Return whether two Ranges overlap. */
bool overlaps( const Range & rhs ) const
- {
- return range_detail::overlaps( op, rhs.op,
- _Compare()( value, rhs.value ) );
- }
+ { return range_detail::overlaps( op, rhs.op, TCompare()( value, rhs.value ) ); }
};
///////////////////////////////////////////////////////////////////
- template<class _Tp, class _Compare>
- inline bool overlaps( const Range<_Tp,_Compare> & lhs,
- const Range<_Tp,_Compare> & rhs )
+ template<class Tp, class TCompare>
+ inline bool overlaps( const Range<Tp,TCompare> & lhs,
+ const Range<Tp,TCompare> & rhs )
{ return lhs.overlaps( rhs ); }
///////////////////////////////////////////////////////////////////
- template<class _Tp, class _Compare>
- inline bool operator==( const Range<_Tp,_Compare> & lhs,
- const Range<_Tp,_Compare> & rhs )
+ template<class Tp, class TCompare>
+ inline bool operator==( const Range<Tp,TCompare> & lhs,
+ const Range<Tp,TCompare> & rhs )
{
return( lhs.op == rhs.op
&& ( lhs.op == Rel::ANY
|| lhs.op == Rel::NONE
- || relCompare( Rel::EQ, lhs.value, rhs.value,
- _Compare() )
+ || relCompare( Rel::EQ, lhs.value, rhs.value, TCompare() )
)
);
}
- template<class _Tp, class _Compare>
- inline bool operator!=( const Range<_Tp,_Compare> & lhs,
- const Range<_Tp,_Compare> & rhs )
+ template<class Tp, class TCompare>
+ inline bool operator!=( const Range<Tp,TCompare> & lhs,
+ const Range<Tp,TCompare> & rhs )
{ return ! ( lhs == rhs ); }
/////////////////////////////////////////////////////////////////
* \code
* // Compare two elements returning -1, 0, 1
* // if the elemants compare <,==,>.
- * static int compare( const _Tp & lhs, const _Tp & rhs );
+ * static int compare( const Tp & lhs, const Tp & rhs );
* \endcode
*
- * <tt>Compare\<_Tp\></tt> provides a functor wrapping \c compare.
+ * <tt>Compare\<Tp\></tt> provides a functor wrapping \c compare.
* In case the general comparison method is named differently, the
* class, or you, have to provide an approriate functor.
*
*
* Furthermore a bunch of functors using a certain opertator is
* defined. All templated by type and general comparison
- * method (defaults to Compare\<_Tp\>).
+ * method (defaults to Compare\<Tp\>).
* \code
* // Editions sets use lexicographical order per default:
* std::set<Edition>
//@{
/** General compare functor returning <tt>-1, 0, 1</tt>.
- * Expects _Tp::compare to be a static comaprison method
+ * Expects Tp::compare to be a static comaprison method
* returning <tt>-1, 0, 1</tt> if the elements compare
* <tt>\<,==,\></tt>.
*/
- template<class _Tp>
- struct Compare : public std::binary_function<_Tp,_Tp,int>
+ template<class Tp>
+ struct Compare : public std::binary_function<Tp,Tp,int>
{
- int operator()( const _Tp & lhs, const _Tp & rhs ) const
- { return _Tp::compare( lhs, rhs ); }
+ int operator()( const Tp & lhs, const Tp & rhs ) const
+ { return Tp::compare( lhs, rhs ); }
};
///////////////////////////////////////////////////////////////////
/** Comparison of two elements using relational operator \a op.
- * Expects \a _Compare to be a binary operator returning
+ * Expects \a TCompare to be a binary operator returning
* <tt>-1, 0, 1</tt> if the elemants compare <tt>\<,==,\></tt>.
* \code
* // Signature of compare function or functor:
- * int compare( const _Tp & lhs, const _Tp & rhs );
+ * int compare( const Tp & lhs, const Tp & rhs );
* \endcode
* \li If \a op is Rel::ANY, the expression is always \c true.
* \li If \a op is Rel::NONE, the expression is always \c false.
*
* \ingroup RelCompare
*/
- template<class _Tp, class _Compare>
- inline bool compareByRel( Rel op, const _Tp & lhs, const _Tp & rhs,
- _Compare compare )
+ template<class Tp, class TCompare>
+ inline bool compareByRel( Rel op, const Tp & lhs, const Tp & rhs, TCompare compare )
{
switch ( op.inSwitch() )
{
return false;
}
- /** \ref compareByRel convenience using Compare<_Tp> as general compare
+ /** \ref compareByRel convenience using Compare<Tp> as general compare
* functor.
*/
- template<class _Tp>
- inline bool compareByRel( Rel op, const _Tp & lhs, const _Tp & rhs )
- { return compareByRel( op, lhs, rhs, Compare<_Tp>() ); }
+ template<class Tp>
+ inline bool compareByRel( Rel op, const Tp & lhs, const Tp & rhs )
+ { return compareByRel( op, lhs, rhs, Compare<Tp>() ); }
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
/** Functor to compare two elements by \ref Rel based on
- * a general \a _Compare functor.
+ * a general \a TCompare functor.
*
- * Expects \a _Compare to be suitable for use in \ref compareByRel.
- * Defaults to Compare\<_Tp\>.
+ * Expects \a TCompare to be suitable for use in \ref compareByRel.
+ * Defaults to Compare\<Tp\>.
*/
- template<class _Tp, class _Compare = Compare<_Tp> >
- struct CompareBy : public std::binary_function<_Tp,_Tp,bool>
+ template<class Tp, class TCompare = Compare<Tp> >
+ struct CompareBy : public std::binary_function<Tp,Tp,bool>
{
CompareBy( Rel op_r )
: _op( op_r )
{}
- bool operator()( const _Tp & lhs, const _Tp & rhs ) const
- { return compareByRel( _op, lhs, rhs, _Compare() ); }
+ bool operator()( const Tp & lhs, const Tp & rhs ) const
+ { return compareByRel( _op, lhs, rhs, TCompare() ); }
Rel _op;
};
- template<class _Tp, class _Compare = Compare<_Tp> >
- struct CompareByEQ : public std::binary_function<_Tp,_Tp,bool>
+ template<class Tp, class TCompare = Compare<Tp> >
+ struct CompareByEQ : public std::binary_function<Tp,Tp,bool>
{
- bool operator()( const _Tp & lhs, const _Tp & rhs ) const
- { return compareByRel( Rel::EQ, lhs, rhs, _Compare() ); }
+ bool operator()( const Tp & lhs, const Tp & rhs ) const
+ { return compareByRel( Rel::EQ, lhs, rhs, TCompare() ); }
};
- template<class _Tp, class _Compare = Compare<_Tp> >
- struct CompareByNE : public std::binary_function<_Tp,_Tp,bool>
+ template<class Tp, class TCompare = Compare<Tp> >
+ struct CompareByNE : public std::binary_function<Tp,Tp,bool>
{
- bool operator()( const _Tp & lhs, const _Tp & rhs ) const
- { return compareByRel( Rel::NE, lhs, rhs, _Compare() ); }
+ bool operator()( const Tp & lhs, const Tp & rhs ) const
+ { return compareByRel( Rel::NE, lhs, rhs, TCompare() ); }
};
- template<class _Tp, class _Compare = Compare<_Tp> >
- struct CompareByLT : public std::binary_function<_Tp,_Tp,bool>
+ template<class Tp, class TCompare = Compare<Tp> >
+ struct CompareByLT : public std::binary_function<Tp,Tp,bool>
{
- bool operator()( const _Tp & lhs, const _Tp & rhs ) const
- { return compareByRel( Rel::LT, lhs, rhs, _Compare() ); }
+ bool operator()( const Tp & lhs, const Tp & rhs ) const
+ { return compareByRel( Rel::LT, lhs, rhs, TCompare() ); }
};
- template<class _Tp, class _Compare = Compare<_Tp> >
- struct CompareByLE : public std::binary_function<_Tp,_Tp,bool>
+ template<class Tp, class TCompare = Compare<Tp> >
+ struct CompareByLE : public std::binary_function<Tp,Tp,bool>
{
- bool operator()( const _Tp & lhs, const _Tp & rhs ) const
- { return compareByRel( Rel::LE, lhs, rhs, _Compare() ); }
+ bool operator()( const Tp & lhs, const Tp & rhs ) const
+ { return compareByRel( Rel::LE, lhs, rhs, TCompare() ); }
};
- template<class _Tp, class _Compare = Compare<_Tp> >
- struct CompareByGT : public std::binary_function<_Tp,_Tp,bool>
+ template<class Tp, class TCompare = Compare<Tp> >
+ struct CompareByGT : public std::binary_function<Tp,Tp,bool>
{
- bool operator()( const _Tp & lhs, const _Tp & rhs ) const
- { return compareByRel( Rel::GT, lhs, rhs, _Compare() ); }
+ bool operator()( const Tp & lhs, const Tp & rhs ) const
+ { return compareByRel( Rel::GT, lhs, rhs, TCompare() ); }
};
- template<class _Tp, class _Compare = Compare<_Tp> >
- struct CompareByGE : public std::binary_function<_Tp,_Tp,bool>
+ template<class Tp, class TCompare = Compare<Tp> >
+ struct CompareByGE : public std::binary_function<Tp,Tp,bool>
{
- bool operator()( const _Tp & lhs, const _Tp & rhs ) const
- { return compareByRel( Rel::GE, lhs, rhs, _Compare() ); }
+ bool operator()( const Tp & lhs, const Tp & rhs ) const
+ { return compareByRel( Rel::GE, lhs, rhs, TCompare() ); }
};
- template<class _Tp, class _Compare = Compare<_Tp> >
- struct CompareByANY : public std::binary_function<_Tp,_Tp,bool>
+ template<class Tp, class TCompare = Compare<Tp> >
+ struct CompareByANY : public std::binary_function<Tp,Tp,bool>
{
- bool operator()( const _Tp & lhs, const _Tp & rhs ) const
- { return compareByRel( Rel::ANY, lhs, rhs, _Compare() ); }
+ bool operator()( const Tp & lhs, const Tp & rhs ) const
+ { return compareByRel( Rel::ANY, lhs, rhs, TCompare() ); }
};
- template<class _Tp, class _Compare = Compare<_Tp> >
- struct CompareByNONE : public std::binary_function<_Tp,_Tp,bool>
+ template<class Tp, class TCompare = Compare<Tp> >
+ struct CompareByNONE : public std::binary_function<Tp,Tp,bool>
{
- bool operator()( const _Tp & lhs, const _Tp & rhs ) const
- { return compareByRel( Rel::NONE, lhs, rhs, _Compare() ); }
+ bool operator()( const Tp & lhs, const Tp & rhs ) const
+ { return compareByRel( Rel::NONE, lhs, rhs, TCompare() ); }
};
///////////////////////////////////////////////////////////////////
/** Add content keywords */
void addContent( const std::string & keyword_r );
/** \overload add keywords from container */
- template <class _Iterator>
- void addContentFrom( _Iterator begin_r, _Iterator end_r )
+ template <class TIterator>
+ void addContentFrom( TIterator begin_r, TIterator end_r )
{ for_( it, begin_r, end_r ) addContent( *it ); }
/** \overload */
- template <class _Container>
- void addContentFrom( const _Container & container_r )
+ template <class TContainer>
+ void addContentFrom( const TContainer & container_r )
{ addContentFrom( container_r.begin(), container_r.end() ); }
/** Check for content keywords.
*/
bool hasContent( const std::string & keyword_r = std::string() ) const;
/** \overload check for \b all keywords being present */
- template <class _Iterator>
- bool hasContentAll( _Iterator begin_r, _Iterator end_r ) const
+ template <class TIterator>
+ bool hasContentAll( TIterator begin_r, TIterator end_r ) const
{ for_( it, begin_r, end_r ) if ( ! hasContent( *it ) ) return false; return true; }
/** \overload */
- template <class _Container>
- bool hasContentAll( const _Container & container_r ) const
+ template <class TContainer>
+ bool hasContentAll( const TContainer & container_r ) const
{ return hasContentAll( container_r.begin(), container_r.end() ); }
/** \overload check for \b any keyword being present */
- template <class _Iterator>
- bool hasContentAny( _Iterator begin_r, _Iterator end_r ) const
+ template <class TIterator>
+ bool hasContentAny( TIterator begin_r, TIterator end_r ) const
{ for_( it, begin_r, end_r ) if ( hasContent( *it ) ) return true; return false; }
/** \overload */
- template <class _Container>
- bool hasContentAny( const _Container & container_r ) const
+ template <class TContainer>
+ bool hasContentAny( const TContainer & container_r ) const
{ return hasContentAny( container_r.begin(), container_r.end() ); }
public:
assert_urls(info);
// we will throw this later if no URL checks out fine
- RepoException rexception( info, _PL("Valid metadata not found at specified URL",
+ RepoException rexception( info, PL_("Valid metadata not found at specified URL",
"Valid metadata not found at specified URLs",
info.baseUrlsSize() ) );
/////////////////////////////////////////////////////////////////
- ::_Repo * Repository::get() const
+ sat::detail::CRepo * Repository::get() const
{ return myPool().getRepo( _id ); }
#define NO_REPOSITORY_RETURN( VAL ) \
- ::_Repo * _repo( get() ); \
+ sat::detail::CRepo * _repo( get() ); \
if ( ! _repo ) return VAL
#define NO_REPOSITORY_THROW( VAL ) \
- ::_Repo * _repo( get() ); \
+ sat::detail::CRepo * _repo( get() ); \
if ( ! _repo ) ZYPP_THROW( VAL )
bool Repository::isSystemRepo() const
{
if ( base() )
{
- ::_Pool * satpool = sat::Pool::instance().get();
+ sat::detail::CPool * satpool = sat::Pool::instance().get();
do {
++base_reference();
} while ( base() < satpool->repos+satpool->nrepos && !*base() );
public:
/** Expert backdoor. */
- ::_Repo * get() const;
+ sat::detail::CRepo * get() const;
/** Expert backdoor. */
IdType id() const { return _id; }
/** libsolv internal priorities.
/** */
class RepositoryIterator : public boost::iterator_adaptor<
RepositoryIterator // Derived
- , ::_Repo ** // Base
+ , sat::detail::CRepo ** // Base
, Repository // Value
, boost::forward_traversal_tag // CategoryOrTraversal
, Repository // Reference
: RepositoryIterator::iterator_adaptor_( 0 )
{}
- explicit RepositoryIterator( ::_Repo ** p )
+ explicit RepositoryIterator( sat::detail::CRepo ** p )
: RepositoryIterator::iterator_adaptor_( p )
{}
typedef boost::function<bool ( ResObject::constPtr )> ResFilter;
/** */
- template<class _Res>
+ template<class TRes>
inline filter::ByKind byKind()
- { return filter::ByKind( ResTraits<_Res>::kind ); }
+ { return filter::ByKind( ResTraits<TRes>::kind ); }
/** Select ResObject by name. */
struct ByName : public ResObjectFilterFunctor
std::string _alias;
};
- /** Select ResObject by Edition using \a _Compare functor.
+ /** Select ResObject by Edition using \a TCompare functor.
*
- * Selects ResObject if <tt>_Compare( ResObject->edition(), _edition )</tt>
+ * Selects ResObject if <tt>TCompare( ResObject->edition(), _edition )</tt>
* is \c true.
* \code
* // use the convenience funktions to create ByEdition:
* byEdition( someedition, CompareByGT<Edition>() ) // edition > someedition
* \endcode
*/
- template<class _Compare = CompareByEQ<Edition> >
+ template<class TCompare = CompareByEQ<Edition> >
struct ByEdition : public ResObjectFilterFunctor
{
- ByEdition( const Edition & edition_r,
- _Compare cmp_r )
+ ByEdition( const Edition & edition_r, TCompare cmp_r )
: _edition( edition_r )
, _cmp( cmp_r )
{}
}
Edition _edition;
- _Compare _cmp;
+ TCompare _cmp;
};
/** */
- template<class _Compare>
- ByEdition<_Compare> byEdition( const Edition & edition_r, _Compare cmp_r )
- { return ByEdition<_Compare>( edition_r, cmp_r ); }
+ template<class TCompare>
+ ByEdition<TCompare> byEdition( const Edition & edition_r, TCompare cmp_r )
+ { return ByEdition<TCompare>( edition_r, cmp_r ); }
/** */
- template<class _Compare>
- ByEdition<_Compare> byEdition( const Edition & edition_r )
- { return byEdition( edition_r, _Compare() ); }
+ template<class TCompare>
+ ByEdition<TCompare> byEdition( const Edition & edition_r )
+ { return byEdition( edition_r, TCompare() ); }
- /** Select ResObject by Arch using \a _Compare functor.
+ /** Select ResObject by Arch using \a TCompare functor.
*
- * Selects ResObject if <tt>_Compare( ResObject->arch(), _arch )</tt>
+ * Selects ResObject if <tt>TCompare( ResObject->arch(), _arch )</tt>
* is \c true.
* \code
* // use the convenience funktions to create ByArch:
* byArch( somearch, CompareByGT<Arch>() ) // arch > somearch
* \endcode
*/
- template<class _Compare = CompareByEQ<Arch> >
+ template<class TCompare = CompareByEQ<Arch> >
struct ByArch : public ResObjectFilterFunctor
{
- ByArch( const Arch & arch_r,
- _Compare cmp_r )
+ ByArch( const Arch & arch_r, TCompare cmp_r )
: _arch( arch_r )
, _cmp( cmp_r )
{}
}
Arch _arch;
- _Compare _cmp;
+ TCompare _cmp;
};
/** */
- template<class _Compare>
- ByArch<_Compare> byArch( const Arch & arch_r, _Compare cmp_r )
- { return ByArch<_Compare>( arch_r, cmp_r ); }
+ template<class TCompare>
+ ByArch<TCompare> byArch( const Arch & arch_r, TCompare cmp_r )
+ { return ByArch<TCompare>( arch_r, cmp_r ); }
/** */
- template<class _Compare>
- ByArch<_Compare> byArch( const Arch & arch_r )
- { return byArch( arch_r, _Compare() ); }
+ template<class TCompare>
+ ByArch<TCompare> byArch( const Arch & arch_r )
+ { return byArch( arch_r, TCompare() ); }
///////////////////////////////////////////////////////////////////
{
return p.status().isInstalled();
}
-
};
/** Select PoolItem by uninstalled. */
* DBG << pi->asKind<Package>()->keywords() << endl;
* \endcode
*/
- template<class _Res>
- inline typename ResTraits<_Res>::constPtrType asKind() const;
+ template<class TRes>
+ inline typename ResTraits<TRes>::constPtrType asKind() const;
- template<class _Res>
- inline typename ResTraits<_Res>::PtrType asKind();
+ template<class TRes>
+ inline typename ResTraits<TRes>::PtrType asKind();
public:
/**
* \todo make<> was a poor choice (AFAIR because gcc had some trouble with
* asKind<>(sat::Solvable)). Remove it in favour of asKind<>(sat::Solvable)
*/
- template<class _Res>
- inline typename ResTraits<_Res>::PtrType make( const sat::Solvable & solvable_r )
- { return( isKind<_Res>( solvable_r ) ? new _Res( solvable_r ) : 0 ); }
+ template<class TRes>
+ inline typename ResTraits<TRes>::PtrType make( const sat::Solvable & solvable_r )
+ { return( isKind<TRes>( solvable_r ) ? new TRes( solvable_r ) : 0 ); }
/** \overload Specialisation for ResObject autodetecting the kind of resolvable. */
template<>
inline ResObject::Ptr make<ResObject>( const sat::Solvable & solvable_r )
{ return makeResObject( solvable_r ); }
/** Directly create a certain kind of ResObject from \ref sat::Solvable. */
- template<class _Res>
- inline typename ResTraits<_Res>::PtrType asKind( const sat::Solvable & solvable_r )
- { return make<_Res>( solvable_r ); }
+ template<class TRes>
+ inline typename ResTraits<TRes>::PtrType asKind( const sat::Solvable & solvable_r )
+ { return make<TRes>( solvable_r ); }
/** Convert ResObject::Ptr into Ptr of a certain Kind.
* \return \c NULL iff \a p is \c NULL or points to a Resolvable
* asKind<Package>(resPtr);
* \endcode
*/
- template<class _Res>
- inline typename ResTraits<_Res>::PtrType asKind( const ResObject::Ptr & p )
- { return dynamic_pointer_cast<_Res>(p); }
+ template<class TRes>
+ inline typename ResTraits<TRes>::PtrType asKind( const ResObject::Ptr & p )
+ { return dynamic_pointer_cast<TRes>(p); }
- template<class _Res>
- inline typename ResTraits<_Res>::constPtrType asKind( const ResObject::constPtr & p )
- { return dynamic_pointer_cast<const _Res>(p); }
+ template<class TRes>
+ inline typename ResTraits<TRes>::constPtrType asKind( const ResObject::constPtr & p )
+ { return dynamic_pointer_cast<const TRes>(p); }
- template<class _Res>
- inline typename ResTraits<_Res>::constPtrType ResObject::asKind() const
- { return dynamic_cast<const _Res *>( this ); }
+ template<class TRes>
+ inline typename ResTraits<TRes>::constPtrType ResObject::asKind() const
+ { return dynamic_cast<const TRes *>( this ); }
- template<class _Res>
- inline typename ResTraits<_Res>::PtrType ResObject::asKind()
- { return dynamic_cast<_Res *>( this ); }
+ template<class TRes>
+ inline typename ResTraits<TRes>::PtrType ResObject::asKind()
+ { return dynamic_cast<TRes *>( this ); }
} // namespace zypp
///////////////////////////////////////////////////////////////////
{ return( resolvable_r ? find( resolvable_r->satSolvable() ) : PoolItem() ); }
public:
- /** \name Iterate over all PoolItems matching a \c _Filter. */
+ /** \name Iterate over all PoolItems matching a \c TFilter. */
//@{
- template<class _Filter>
- filter_iterator<_Filter,const_iterator> filterBegin( const _Filter & filter_r ) const
+ template<class TFilter>
+ filter_iterator<TFilter,const_iterator> filterBegin( const TFilter & filter_r ) const
{ return make_filter_begin( filter_r, *this ); }
- template<class _Filter>
- filter_iterator<_Filter,const_iterator> filterEnd( const _Filter & filter_r ) const
+ template<class TFilter>
+ filter_iterator<TFilter,const_iterator> filterEnd( const TFilter & filter_r ) const
{ return make_filter_end( filter_r, *this ); }
- template<class _Filter>
- Iterable<filter_iterator<_Filter,const_iterator> > filter( const _Filter & filter_r ) const
+ template<class TFilter>
+ Iterable<filter_iterator<TFilter,const_iterator> > filter( const TFilter & filter_r ) const
{ return makeIterable( filterBegin( filter_r ), filterEnd( filter_r ) ); }
//@}
byIdent_iterator byIdentBegin( ResKind kind_r, const C_Str & name_r ) const
{ return byIdentBegin( ByIdent(kind_r,name_r) ); }
- template<class _Res>
+ template<class TRes>
byIdent_iterator byIdentBegin( IdString name_r ) const
- { return byIdentBegin( ByIdent(ResTraits<_Res>::kind,name_r) ); }
+ { return byIdentBegin( ByIdent(ResTraits<TRes>::kind,name_r) ); }
- template<class _Res>
+ template<class TRes>
byIdent_iterator byIdentBegin( const C_Str & name_r ) const
- { return byIdentBegin( ByIdent(ResTraits<_Res>::kind,name_r) ); }
+ { return byIdentBegin( ByIdent(ResTraits<TRes>::kind,name_r) ); }
/** Derive name and kind from \ref PoolItem. */
byIdent_iterator byIdentBegin( const PoolItem & pi_r ) const
byIdent_iterator byIdentEnd( ResKind kind_r, const C_Str & name_r ) const
{ return byIdentEnd( ByIdent(kind_r,name_r) ); }
- template<class _Res>
+ template<class TRes>
byIdent_iterator byIdentEnd( IdString name_r ) const
- { return byIdentEnd( ByIdent(ResTraits<_Res>::kind,name_r) ); }
+ { return byIdentEnd( ByIdent(ResTraits<TRes>::kind,name_r) ); }
- template<class _Res>
+ template<class TRes>
byIdent_iterator byIdentEnd( const C_Str & name_r ) const
- { return byIdentEnd( ByIdent(ResTraits<_Res>::kind,name_r) ); }
+ { return byIdentEnd( ByIdent(ResTraits<TRes>::kind,name_r) ); }
/** Derive name and kind from \ref PoolItem. */
byIdent_iterator byIdentEnd( const PoolItem & pi_r ) const
Iterable<byIdent_iterator> byIdent( ResKind kind_r, const C_Str & name_r ) const
{ return makeIterable( byIdentBegin( kind_r, name_r ), byIdentEnd( kind_r, name_r ) ); }
- template<class _Res>
+ template<class TRes>
Iterable<byIdent_iterator> byIdent( IdString name_r ) const
- { return makeIterable( byIdentBegin<_Res>( name_r ), byIdentEnd<_Res>( name_r ) ); }
+ { return makeIterable( byIdentBegin<TRes>( name_r ), byIdentEnd<TRes>( name_r ) ); }
- template<class _Res>
+ template<class TRes>
Iterable<byIdent_iterator> byIdent( const C_Str & name_r ) const
- { return makeIterable( byIdentBegin<_Res>( name_r ), byIdentEnd<_Res>( name_r ) ); }
+ { return makeIterable( byIdentBegin<TRes>( name_r ), byIdentEnd<TRes>( name_r ) ); }
Iterable<byIdent_iterator> byIdent( const PoolItem & pi_r ) const
{ return makeIterable( byIdentBegin( pi_r ), byIdentEnd( pi_r ) ); }
byKind_iterator byKindBegin( const ResKind & kind_r ) const
{ return make_filter_begin( ByKind(kind_r), *this ); }
- template<class _Res>
+ template<class TRes>
byKind_iterator byKindBegin() const
- { return make_filter_begin( resfilter::byKind<_Res>(), *this ); }
+ { return make_filter_begin( resfilter::byKind<TRes>(), *this ); }
byKind_iterator byKindEnd( const ResKind & kind_r ) const
{ return make_filter_end( ByKind(kind_r), *this ); }
- template<class _Res>
+ template<class TRes>
byKind_iterator byKindEnd() const
- { return make_filter_end( resfilter::byKind<_Res>(), *this ); }
+ { return make_filter_end( resfilter::byKind<TRes>(), *this ); }
Iterable<byKind_iterator> byKind( const ResKind & kind_r ) const
{ return makeIterable( byKindBegin( kind_r ), byKindEnd( kind_r ) ); }
- template<class _Res>
+ template<class TRes>
Iterable<byKind_iterator> byKind() const
- { return makeIterable( byKindBegin<_Res>(), byKindEnd<_Res>() ); }
+ { return makeIterable( byKindBegin<TRes>(), byKindEnd<TRes>() ); }
//@}
public:
/** True if there are items of a certain kind. */
bool empty( const ResKind & kind_r ) const;
- template<class _Res>
+ template<class TRes>
bool empty() const
- { return empty( ResTraits<_Res>::kind ); }
+ { return empty( ResTraits<TRes>::kind ); }
/** Number of Items of a certain kind. */
size_type size( const ResKind & kind_r ) const;
- template<class _Res>
+ template<class TRes>
size_type size() const
- { return size( ResTraits<_Res>::kind ); }
+ { return size( ResTraits<TRes>::kind ); }
const_iterator byKindBegin( const ResKind & kind_r ) const;
- template<class _Res>
+ template<class TRes>
const_iterator byKindBegin() const
- { return byKindBegin( ResTraits<_Res>::kind ); }
+ { return byKindBegin( ResTraits<TRes>::kind ); }
const_iterator byKindEnd( const ResKind & kind_r ) const;
- template<class _Res>
+ template<class TRes>
const_iterator byKindEnd() const
- { return byKindEnd( ResTraits<_Res>::kind ); }
+ { return byKindEnd( ResTraits<TRes>::kind ); }
//@}
public:
!= make_end<ui::selfilter::ByHasInstalledObj>( kind_r ) );
}
- template<class _Res>
+ template<class TRes>
bool hasInstalledObj() const
- { return hasInstalledObj( ResTraits<_Res>::kind ); }
+ { return hasInstalledObj( ResTraits<TRes>::kind ); }
public:
/** \name Save and restore state per kind of resolvable.
void saveState( const ResKind & kind_r ) const;
- template<class _Res>
+ template<class TRes>
void saveState() const
- { return saveState( ResTraits<_Res>::kind ); }
+ { return saveState( ResTraits<TRes>::kind ); }
void restoreState() const;
void restoreState( const ResKind & kind_r ) const;
- template<class _Res>
+ template<class TRes>
void restoreState() const
- { return restoreState( ResTraits<_Res>::kind ); }
+ { return restoreState( ResTraits<TRes>::kind ); }
bool diffState() const;
bool diffState( const ResKind & kind_r ) const;
- template<class _Res>
+ template<class TRes>
bool diffState() const
- { return diffState( ResTraits<_Res>::kind ); }
+ { return diffState( ResTraits<TRes>::kind ); }
/**
* \class ScopedSaveState
ScopedSaveState scopedSaveState( const ResKind & kind_r ) const;
- template<class _Res>
+ template<class TRes>
ScopedSaveState && scopedSaveState() const
- { return scopedSaveState( ResTraits<_Res>::kind ); }
+ { return scopedSaveState( ResTraits<TRes>::kind ); }
//@}
private:
- template<class _Filter>
- filter_iterator<_Filter,const_iterator>
- make_begin( _Filter filter_r, const ResKind & kind_r ) const
+ template<class TFilter>
+ filter_iterator<TFilter,const_iterator>
+ make_begin( TFilter filter_r, const ResKind & kind_r ) const
{
return make_filter_iterator( filter_r,
byKindBegin(kind_r),
byKindEnd(kind_r) );
}
- template<class _Filter>
- filter_iterator<_Filter,const_iterator>
+ template<class TFilter>
+ filter_iterator<TFilter,const_iterator>
make_begin( const ResKind & kind_r ) const
{
- return make_begin( _Filter(), kind_r );
+ return make_begin( TFilter(), kind_r );
}
- template<class _Filter>
- filter_iterator<_Filter,const_iterator>
- make_end( _Filter filter_r, const ResKind & kind_r ) const
+ template<class TFilter>
+ filter_iterator<TFilter,const_iterator>
+ make_end( TFilter filter_r, const ResKind & kind_r ) const
{
return make_filter_iterator( filter_r,
byKindEnd(kind_r),
byKindEnd(kind_r) );
}
- template<class _Filter>
- filter_iterator<_Filter,const_iterator>
+ template<class TFilter>
+ filter_iterator<TFilter,const_iterator>
make_end( const ResKind & kind_r ) const
{
- return make_end( _Filter(), kind_r );
+ return make_end( TFilter(), kind_r );
}
private:
/** Return whether the corresponding Field has value \a val_r.
*/
- template<class _Field>
+ template<class TField>
bool fieldValueIs( FieldType val_r ) const
- { return _bitfield.isEqual<_Field>( val_r ); }
+ { return _bitfield.isEqual<TField>( val_r ); }
/** Set the corresponding Field to value \a val_r.
*/
- template<class _Field>
+ template<class TField>
void fieldValueAssign( FieldType val_r )
- { _bitfield.assign<_Field>( val_r ); }
+ { _bitfield.assign<TField>( val_r ); }
/** compare two values.
*/
- template<class _Field>
+ template<class TField>
bool isGreaterThan( FieldType val_r )
- { return _bitfield.value<_Field>() > val_r; }
+ { return _bitfield.value<TField>() > val_r; }
- template<class _Field>
+ template<class TField>
bool isLessThan( FieldType val_r )
- { return _bitfield.value<_Field>() < val_r; }
+ { return _bitfield.value<TField>() < val_r; }
private:
friend class resstatus::StatusBackup;
class PoolItem;
/** ResTraits. Defines common types and the ResKind value. */
- template<typename _Res>
+ template<typename TRes>
struct ResTraits
{
typedef ResKind KindType;
- typedef intrusive_ptr<_Res> PtrType;
- typedef intrusive_ptr<const _Res> constPtrType;
+ typedef intrusive_ptr<TRes> PtrType;
+ typedef intrusive_ptr<const TRes> constPtrType;
static const ResKind kind; ///< Defined in ResKind.cc
* ResKind packagekind = resKind<Package>();
* \endcode
*/
- template<typename _Res>
- inline ResKind resKind() { return ResTraits<_Res>::kind; }
+ template<typename TRes>
+ inline ResKind resKind() { return ResTraits<TRes>::kind; }
/** Convenient test for ResKinds.
* \code
* if ( isKind<Package>( value ) )
* \endcode
*/
- template<typename _Res>
+ template<typename TRes>
inline bool isKind( const ResKind & val_r )
- { return( resKind<_Res>() == val_r ); }
+ { return( resKind<TRes>() == val_r ); }
/** \overload */
- template<typename _Res>
+ template<typename TRes>
inline bool isKind( const std::string & val_r )
- { return( resKind<_Res>() == val_r ); }
+ { return( resKind<TRes>() == val_r ); }
/** \overload */
- template<typename _Res>
+ template<typename TRes>
inline bool isKind( const char * val_r )
- { return( resKind<_Res>() == val_r ); }
+ { return( resKind<TRes>() == val_r ); }
/////////////////////////////////////////////////////////////////
* isKind<Package>(resPtr);
* \endcode
*/
- template<class _Res>
+ template<class TRes>
inline bool isKind( const Resolvable::constPtr & p )
- { return p && p->isKind<_Res>(); }
+ { return p && p->isKind<TRes>(); }
// Specialization for Resolvable: Always true.
template<>
* asKind<Package>(resPtr);
* \endcode
*/
- template<class _Res>
- inline typename ResTraits<_Res>::PtrType asKind( const Resolvable::Ptr & p )
- { return dynamic_pointer_cast<_Res>(p); }
+ template<class TRes>
+ inline typename ResTraits<TRes>::PtrType asKind( const Resolvable::Ptr & p )
+ { return dynamic_pointer_cast<TRes>(p); }
- template<class _Res>
- inline typename ResTraits<_Res>::constPtrType asKind( const Resolvable::constPtr & p )
- { return dynamic_pointer_cast<const _Res>(p); }
+ template<class TRes>
+ inline typename ResTraits<TRes>::constPtrType asKind( const Resolvable::constPtr & p )
+ { return dynamic_pointer_cast<const TRes>(p); }
///////////////////////////////////////////////////////////////////
/**
* Adding new equivalent vendor set from list
**/
- template <class _Iterator>
- void addVendorList( _Iterator begin, _Iterator end ) const
+ template <class TIterator>
+ void addVendorList( TIterator begin, TIterator end ) const
{ VendorList tmp( begin, end ); _addVendorList( tmp ); }
/** Return whether two vendor strings shold be treated as the same vendor.
///////////////////////////////////////////////////////////////////
/** Mutable option. */
- template<class _Tp>
+ template<class Tp>
struct Option
{
- typedef _Tp value_type;
+ typedef Tp value_type;
/** No default ctor, explicit initialisation! */
Option( const value_type & initial_r )
};
/** Mutable option with initial value also remembering a config value. */
- template<class _Tp>
- struct DefaultOption : public Option<_Tp>
+ template<class Tp>
+ struct DefaultOption : public Option<Tp>
{
- typedef _Tp value_type;
- typedef Option<_Tp> option_type;
+ typedef Tp value_type;
+ typedef Option<Tp> option_type;
DefaultOption( const value_type & initial_r )
- : Option<_Tp>( initial_r ), _default( initial_r )
+ : Option<Tp>( initial_r ), _default( initial_r )
{}
/** Reset value to the current default. */
{
public:
/** message type (use like 'enum class \ref MsgType') */
- struct _MsgTypeDef {
+ struct EMsgTypeDef {
enum Enum { debug, info, warning, error, important, data };
};
- typedef base::EnumClass<_MsgTypeDef> MsgType; ///< 'enum class MsgType'
+ typedef base::EnumClass<EMsgTypeDef> MsgType; ///< 'enum class MsgType'
/** typsafe map of userdata */
typedef callback::UserData UserData;
* \return Number of invokations of \a fnc_r, negative if
* loop was aborted by \a fnc_.
*/
- template <class _Iterator, class _Filter, class _Function>
- inline int invokeOnEach( _Iterator begin_r, _Iterator end_r,
- _Filter filter_r,
- _Function fnc_r )
+ template <class TIterator, class TFilter, class TFunction>
+ inline int invokeOnEach( TIterator begin_r, TIterator end_r,
+ TFilter filter_r,
+ TFunction fnc_r )
{
int cnt = 0;
- for ( _Iterator it = begin_r; it != end_r; ++it )
+ for ( TIterator it = begin_r; it != end_r; ++it )
{
if ( filter_r( *it ) )
{
* \return Number of invokations of \a fnc_r, negative if
* loop was aborted by \a fnc_.
*/
- template <class _Iterator, class _Function>
- inline int invokeOnEach( _Iterator begin_r, _Iterator end_r,
- _Function fnc_r )
+ template <class TIterator, class TFunction>
+ inline int invokeOnEach( TIterator begin_r, TIterator end_r,
+ TFunction fnc_r )
{
int cnt = 0;
- for ( _Iterator it = begin_r; it != end_r; ++it )
+ for ( TIterator it = begin_r; it != end_r; ++it )
{
++cnt;
if ( ! fnc_r( *it ) )
///////////////////////////////////////////////////////////////////
//
- // CLASS NAME : _Collector<_OutputIterator>
+ // CLASS NAME : Collector<TOutputIterator>
//
/** Functor feeding values to an output_iterator.
*
* \code
* LocaleSet locales;
* for_each( begin(), end(),
- * Collector( std::inserter( locales_r, locales_r.begin() ) ) );
+ * collector( std::inserter( locales_r, locales_r.begin() ) ) );
* \endcode
*
- * \see Convenience constructor \ref Collector.
+ * \see Convenience constructor \ref collector.
*/
- template<class _OutputIterator>
- struct _Collector
+ template<class TOutputIterator>
+ struct Collector
{
- _Collector( _OutputIterator iter_r ) : _iter( iter_r ) {}
+ Collector( TOutputIterator iter_r ) : _iter( iter_r ) {}
- template<class _Tp>
- bool operator()( const _Tp & value_r ) const
+ template<class Tp>
+ bool operator()( const Tp & value_r ) const
{
*_iter++ = value_r;
return true;
}
private:
- mutable _OutputIterator _iter;
+ mutable TOutputIterator _iter;
};
///////////////////////////////////////////////////////////////////
- /** \relates _Collector Convenience constructor. */
- template<class _OutputIterator>
- inline _Collector<_OutputIterator> Collector( _OutputIterator iter_r )
- { return _Collector<_OutputIterator>( iter_r ); }
+ /** \relates Collector Convenience constructor. */
+ template<class TOutputIterator>
+ inline Collector<TOutputIterator> collector( TOutputIterator iter_r )
+ { return Collector<TOutputIterator>( iter_r ); }
///////////////////////////////////////////////////////////////////
//
/** Integral type with initial value \c 0.
*/
- template<class _IntT>
+ template<class TInt>
class Counter
{
public:
- Counter( _IntT value_r = _IntT(0) )
- : _value( _IntT( value_r ) )
+ Counter( TInt value_r = TInt(0) )
+ : _value( TInt( value_r ) )
{}
- operator _IntT &()
+ operator TInt &()
{ return _value; }
- operator const _IntT &() const
+ operator const TInt &() const
{ return _value; }
public:
- _IntT _value;
+ TInt _value;
};
///////////////////////////////////////////////////////////////////
* traced method, and traceCAD simply drops a line in the log.
*
* This tracer logs construction, copy construction, assignment,
- * destruction and _PING.
+ * destruction and ping.
*
* assignment: In case the traced class defines an operator=
* it must be altered to call TraceCAD::operator=, otherwise it
* won't be triggered.
*
- * _PING: Completely up to you. Call _PING somewhere in the traced
+ * ping: Completely up to you. Call ping somewhere in the traced
* class to indicate something. In case you overload traceCAD, do
- * whatever is appropriate on _PING. It's just an offer to perform
+ * whatever is appropriate on ping. It's just an offer to perform
* logging or actions here, and not in the traced code.
*
* But traceCAD may be overloaded to produce more stats.
*
* \see \c Example.COW_debug.cc.
*/
- template<class _Tp>
- struct TraceCAD : public base::ProvideNumericId<TraceCAD<_Tp>, unsigned long>
+ template<class Tp>
+ struct TraceCAD : public base::ProvideNumericId<TraceCAD<Tp>, unsigned long>
, public TraceCADBase
{
static unsigned long & _totalTraceCAD()
{ --_totalTraceCAD();
traceCAD( DTOR, *this, *this ); }
- void _PING() const
+ void ping() const
{ traceCAD( PING, *this, *this ); }
};
/** \relates TraceCAD Stream output. */
- template<class _Tp>
- inline std::ostream & operator<<( std::ostream & str, const TraceCAD<_Tp> & obj )
+ template<class Tp>
+ inline std::ostream & operator<<( std::ostream & str, const TraceCAD<Tp> & obj )
{ return str << "(ID " << obj.numericId() << ", TOTAL " << obj._totalTraceCAD()
<< ") [" << &obj << "] "; }
/** Drop a log line about the traced method. Overload to
* fit your needs.
*/
- template<class _Tp>
+ template<class Tp>
void traceCAD( TraceCADBase::What what_r,
- const TraceCAD<_Tp> & self_r,
- const TraceCAD<_Tp> & rhs_r )
+ const TraceCAD<Tp> & self_r,
+ const TraceCAD<Tp> & rhs_r )
{
switch( what_r )
{
case TraceCADBase::CTOR:
case TraceCADBase::PING:
case TraceCADBase::DTOR:
- _DBG("DEBUG") << what_r << self_r << " (" << self_r._ident << ")" << std::endl;
+ L_DBG("DEBUG") << what_r << self_r << " (" << self_r._ident << ")" << std::endl;
break;
case TraceCADBase::COPYCTOR:
case TraceCADBase::MOVECTOR:
case TraceCADBase::ASSIGN:
case TraceCADBase::MOVEASSIGN:
- _DBG("DEBUG") << what_r << self_r << "( " << rhs_r << ")" << " (" << self_r._ident << ")" << std::endl;
+ L_DBG("DEBUG") << what_r << self_r << "( " << rhs_r << ")" << " (" << self_r._ident << ")" << std::endl;
break;
}
}
///////////////////////////////////////////////////////////////////
//
- // CLASS NAME : DefaultIntegral<_Tp,_Initial>
+ // CLASS NAME : DefaultIntegral<Tp,TInitial>
//
/** Integral type with defined initial value when default constructed.
*
* \endcode
*
* \todo maybe specialize for bool, add logical and bit operators
- * \todo let _Initial default to 0 then remove base/Counter.h
+ * \todo let TInitial default to 0 then remove base/Counter.h
*/
- template<class _Tp, _Tp _Initial>
+ template<class Tp, Tp TInitial>
class DefaultIntegral
{
public:
- typedef _Tp value_type;
+ typedef Tp value_type;
public:
- DefaultIntegral( _Tp val_r = _Initial )
+ DefaultIntegral( Tp val_r = TInitial )
: _val( val_r )
- { BOOST_STATIC_ASSERT(boost::is_integral<_Tp>::value); }
+ { BOOST_STATIC_ASSERT(boost::is_integral<Tp>::value); }
- /** Conversion to _Tp. */
+ /** Conversion to Tp. */
//@{
- _Tp & get() { return _val; }
- _Tp get() const { return _val; }
+ Tp & get() { return _val; }
+ Tp get() const { return _val; }
- operator _Tp &() { return get(); }
- operator _Tp () const { return get(); }
+ operator Tp &() { return get(); }
+ operator Tp () const { return get(); }
//@}
/** Reset to the defined initial value. */
- DefaultIntegral & reset() { _val = _Initial; return *this; }
+ DefaultIntegral & reset() { _val = TInitial; return *this; }
/** \name Arithmetic operations.
- * \c + \c - \c * \c / are provided via conversion to _Tp.
+ * \c + \c - \c * \c / are provided via conversion to Tp.
*/
//@{
- DefaultIntegral & operator=( _Tp rhs ) { _val = rhs; return *this; }
- DefaultIntegral & operator+=( _Tp rhs ) { _val += rhs; return *this; }
- DefaultIntegral & operator-=( _Tp rhs ) { _val -= rhs; return *this; }
- DefaultIntegral & operator*=( _Tp rhs ) { _val *= rhs; return *this; }
- DefaultIntegral & operator/=( _Tp rhs ) { _val /= rhs; return *this; }
+ DefaultIntegral & operator=( Tp rhs ) { _val = rhs; return *this; }
+ DefaultIntegral & operator+=( Tp rhs ) { _val += rhs; return *this; }
+ DefaultIntegral & operator-=( Tp rhs ) { _val -= rhs; return *this; }
+ DefaultIntegral & operator*=( Tp rhs ) { _val *= rhs; return *this; }
+ DefaultIntegral & operator/=( Tp rhs ) { _val /= rhs; return *this; }
DefaultIntegral & operator++(/*prefix*/) { ++_val; return *this; }
DefaultIntegral & operator--(/*prefix*/) { --_val; return *this; }
//@}
private:
- _Tp _val;
+ Tp _val;
};
/** \relates DefaultIntegral \c true initialized \c bool */
class DtorReset
{
public:
- template<class _Var>
- DtorReset( _Var & var_r )
- : _pimpl( new Impl<_Var,_Var>( var_r, var_r ) )
+ template<class TVar>
+ DtorReset( TVar & var_r )
+ : _pimpl( new Impl<TVar,TVar>( var_r, var_r ) )
{}
- template<class _Var, class _Val>
- DtorReset( _Var & var_r, const _Val & val_r )
- : _pimpl( new Impl<_Var,_Val>( var_r, val_r ) )
+ template<class TVar, class TVal>
+ DtorReset( TVar & var_r, const TVal & val_r )
+ : _pimpl( new Impl<TVar,TVal>( var_r, val_r ) )
{}
private:
- /** Requires _Val being copy constructible, and assignment
- * <tt>_Var = _Val</tt> defined. */
- template<class _Var, class _Val>
+ /** Requires TVal being copy constructible, and assignment
+ * <tt>TVar = TVal</tt> defined. */
+ template<class TVar, class TVal>
struct Impl
{
- Impl( _Var & var_r, const _Val & val_r )
+ Impl( TVar & var_r, const TVal & val_r )
: _var( var_r )
, _val( val_r )
{}
~Impl()
{ _var = _val; }
- _Var & _var;
- _Val _val;
+ TVar & _var;
+ TVal _val;
};
shared_ptr<void> _pimpl;
};
/// \class EnumClass
/// \brief Type safe enum (workaround SWIG not supporting enum class)
/// \code
- /// struct _ColorDef { enum Enum { R, G ,B }; };
- /// typedef EnumClass<_ColorDef> Color;
+ /// struct EColorDef { enum Enum { R, G ,B }; };
+ /// typedef EnumClass<EColorDef> Color;
/// \endcode
/// Conversion to from string can be easily added, e.g. like this:
/// \code
- /// struct _ColorDef {
+ /// struct EColorDef {
/// enum Enum { R, G ,B };
/// static Enum fromString( const std::string & val_r );
/// static const std::string & asString( Enum val_r );
/// };
- /// std::ostream & operator<<( std::ostream & str, const _ColorDef & obj )
- /// { return str << _ColorDef::asString( obj.inSwitch() ); }
+ /// std::ostream & operator<<( std::ostream & str, const EColorDef & obj )
+ /// { return str << EColorDef::asString( obj.inSwitch() ); }
///
- /// typedef EnumClass<_ColorDef> Color;
+ /// typedef EnumClass<EColorDef> Color;
/// Color red = Color::fromString("red");
/// cout << red << endl; // "red"
/// \endcode
///////////////////////////////////////////////////////////////////
- template<typename _EnumDef>
- class EnumClass : public _EnumDef
+ template<typename TEnumDef>
+ class EnumClass : public TEnumDef
{
public:
- typedef typename _EnumDef::Enum Enum; ///< The underlying enum type
+ typedef typename TEnumDef::Enum Enum; ///< The underlying enum type
typedef typename std::underlying_type<Enum>::type Integral;///< The underlying integral type
EnumClass( Enum val_r ) : _val( val_r ) {}
/** Underlying enum value for use in switch
* \code
- * struct _ColorDef { enum Enum { R, G ,B }; }
- * typedef EnumClass<_ColorDef> Color;
+ * struct EColorDef { enum Enum { R, G ,B }; }
+ * typedef EnumClass<EColorDef> Color;
*
* Color a;
* switch ( a.asEnum() )
/** Underlying integral value (e.g. array index)
* \code
- * struct _ColorDef { enum Enum { R, G ,B }; }
- * typedef EnumClass<_ColorDef> Color;
+ * struct EColorDef { enum Enum { R, G ,B }; }
+ * typedef EnumClass<EColorDef> Color;
*
* Color a;
* std::string table[] = { "red", "green", "blue" };
std::ostream & operator<<( std::ostream & str, const Exception & obj );
///////////////////////////////////////////////////////////////////
-
- /** Helper for \ref ZYPP_THROW. */
- template<class _Excpt>
- void _ZYPP_THROW( const _Excpt & excpt_r, const exception_detail::CodeLocation & where_r ) __attribute__((noreturn));
- template<class _Excpt>
- void _ZYPP_THROW( const _Excpt & excpt_r, const exception_detail::CodeLocation & where_r )
+ namespace exception_detail
+ {
+ /** Helper for \ref ZYPP_THROW. */
+ template<class TExcpt>
+ void do_ZYPP_THROW( const TExcpt & excpt_r, const CodeLocation & where_r ) __attribute__((noreturn));
+ template<class TExcpt>
+ void do_ZYPP_THROW( const TExcpt & excpt_r, const CodeLocation & where_r )
{
excpt_r.relocate( where_r );
Exception::log( excpt_r, where_r, "THROW: " );
throw( excpt_r );
}
- /** Helper for \ref ZYPP_THROW. */
- template<class _Excpt>
- void _ZYPP_CAUGHT( const _Excpt & excpt_r, const exception_detail::CodeLocation & where_r )
+ /** Helper for \ref ZYPP_THROW. */
+ template<class TExcpt>
+ void do_ZYPP_CAUGHT( const TExcpt & excpt_r, const CodeLocation & where_r )
{
Exception::log( excpt_r, where_r, "CAUGHT: " );
}
- /** Helper for \ref ZYPP_THROW. */
- template<class _Excpt>
- void _ZYPP_RETHROW( const _Excpt & excpt_r, const exception_detail::CodeLocation & where_r ) __attribute__((noreturn));
- template<class _Excpt>
- void _ZYPP_RETHROW( const _Excpt & excpt_r, const exception_detail::CodeLocation & where_r )
+ /** Helper for \ref ZYPP_THROW. */
+ template<class TExcpt>
+ void do_ZYPP_RETHROW( const TExcpt & excpt_r, const CodeLocation & where_r ) __attribute__((noreturn));
+ template<class TExcpt>
+ void do_ZYPP_RETHROW( const TExcpt & excpt_r, const CodeLocation & where_r )
{
Exception::log( excpt_r, where_r, "RETHROW: " );
excpt_r.relocate( where_r );
throw;
}
-
+ } // namespace exception_detail
///////////////////////////////////////////////////////////////////
/** \defgroup ZYPP_THROW ZYPP_THROW macros
//@{
/** Drops a logline and throws the Exception. */
#define ZYPP_THROW(EXCPT)\
- _ZYPP_THROW( EXCPT, ZYPP_EX_CODELOCATION )
+ ::zypp::exception_detail::do_ZYPP_THROW( EXCPT, ZYPP_EX_CODELOCATION )
/** Drops a logline telling the Exception was caught (in order to handle it). */
#define ZYPP_CAUGHT(EXCPT)\
- _ZYPP_CAUGHT( EXCPT, ZYPP_EX_CODELOCATION )
+ ::zypp::exception_detail::do_ZYPP_CAUGHT( EXCPT, ZYPP_EX_CODELOCATION )
/** Drops a logline and rethrows, updating the CodeLocation. */
#define ZYPP_RETHROW(EXCPT)\
- _ZYPP_RETHROW( EXCPT, ZYPP_EX_CODELOCATION )
+ ::zypp::exception_detail::do_ZYPP_RETHROW( EXCPT, ZYPP_EX_CODELOCATION )
/** Throw Exception built from a message string. */
* }
* \endcode
*/
- template<typename _Enum>
+ template<typename TEnum>
class Flags
{
public:
- typedef _Enum Enum; ///< The underlying enum type
+ typedef TEnum Enum; ///< The underlying enum type
typedef typename std::underlying_type<Enum>::type Integral; ///< The underlying integral type
public:
return ret;
}
- template<typename _Enum>
- inline std::ostream & operator<<( std::ostream & str, const Flags<_Enum> & obj )
+ template<typename TEnum>
+ inline std::ostream & operator<<( std::ostream & str, const Flags<TEnum> & obj )
{ return str << str::hexstring(obj); }
- template<typename _Enum>
- inline std::ostream & operator<<( std::ostream & str, const typename Flags<_Enum>::Enum & obj )
- { return str << Flags<_Enum>(obj); }
+ template<typename TEnum>
+ inline std::ostream & operator<<( std::ostream & str, const typename Flags<TEnum>::Enum & obj )
+ { return str << Flags<TEnum>(obj); }
/** \relates Flags */
#define ZYPP_DECLARE_FLAGS(Name,Enum) typedef zypp::base::Flags<Enum> Name
namespace functor
{ /////////////////////////////////////////////////////////////////
- /** An unary functor forwarding to some other <tt>_Functor &</tt>.
+ /** An unary functor forwarding to some other <tt>TFunctor &</tt>.
* \ingroup g_Functor
*
* Most algorithms take functor arguments by value. That's inconvenient
*
* \code
* // Counts invokations of operator().
- * template<class _Tp>
- * struct Counter : public std::unary_function<_Tp, void>
+ * template<class Tp>
+ * struct Counter : public std::unary_function<Tp, void>
* {
- * void operator()( _Tp )
+ * void operator()( Tp )
* { ++_value; }
*
* Counter() : _value( 0 ) {}
* \endcode
*
* \note FunctorRef must be able to deduce the signature of
- * \c _Functor::operator(). This is currently not automated,
+ * \c TFunctor::operator(). This is currently not automated,
* so you must specify the operator() signature as template
* arguments.
*
/////////////////////////////////////////////////////////////////
namespace functor_detail
{
- template <class _Functor, class res_type>
+ template <class TFunctor, class res_type>
struct FunctorRef0
{
- FunctorRef0( _Functor & f_r )
+ FunctorRef0( TFunctor & f_r )
: _f( f_r )
{}
}
private:
- _Functor & _f;
+ TFunctor & _f;
};
- template <class _Functor, class res_type, class arg1_type>
+ template <class TFunctor, class res_type, class arg1_type>
struct FunctorRef1 : public std::unary_function<arg1_type, res_type>
{
- FunctorRef1( _Functor & f_r )
+ FunctorRef1( TFunctor & f_r )
: _f( f_r )
{}
}
private:
- _Functor & _f;
+ TFunctor & _f;
};
- template <class _Functor, class res_type, class arg1_type, class arg2_type>
+ template <class TFunctor, class res_type, class arg1_type, class arg2_type>
struct FunctorRef2 : public std::binary_function<arg1_type, arg2_type, res_type>
{
- FunctorRef2( _Functor & f_r )
+ FunctorRef2( TFunctor & f_r )
: _f( f_r )
{}
}
private:
- _Functor & _f;
+ TFunctor & _f;
};
struct nil
/** A binary \ref FunctorRef.
* Create it using \ref functorRef convenience function.
*/
- template <class _Functor, class res_type, class arg1_type = functor_detail::nil,
+ template <class TFunctor, class res_type, class arg1_type = functor_detail::nil,
class arg2_type = functor_detail::nil>
struct FunctorRef
- : public functor_detail::FunctorRef2<_Functor, res_type, arg1_type, arg2_type>
+ : public functor_detail::FunctorRef2<TFunctor, res_type, arg1_type, arg2_type>
{
- FunctorRef( _Functor & f_r )
- : functor_detail::FunctorRef2<_Functor, res_type, arg1_type, arg2_type>( f_r )
+ FunctorRef( TFunctor & f_r )
+ : functor_detail::FunctorRef2<TFunctor, res_type, arg1_type, arg2_type>( f_r )
{}
};
/** A unary \ref FunctorRef.
* Create it using \ref functorRef convenience function.
*/
- template <class _Functor, class res_type, class arg1_type>
- struct FunctorRef<_Functor, res_type, arg1_type>
- : public functor_detail::FunctorRef1<_Functor, res_type, arg1_type>
+ template <class TFunctor, class res_type, class arg1_type>
+ struct FunctorRef<TFunctor, res_type, arg1_type>
+ : public functor_detail::FunctorRef1<TFunctor, res_type, arg1_type>
{
- FunctorRef( _Functor & f_r )
- : functor_detail::FunctorRef1<_Functor, res_type, arg1_type>( f_r )
+ FunctorRef( TFunctor & f_r )
+ : functor_detail::FunctorRef1<TFunctor, res_type, arg1_type>( f_r )
{}
};
/** A nullary \ref FunctorRef.
* Create it using \ref functorRef convenience function.
*/
- template <class _Functor, class res_type>
- struct FunctorRef<_Functor, res_type>
- : public functor_detail::FunctorRef0<_Functor, res_type>
+ template <class TFunctor, class res_type>
+ struct FunctorRef<TFunctor, res_type>
+ : public functor_detail::FunctorRef0<TFunctor, res_type>
{
- FunctorRef( _Functor & f_r )
- : functor_detail::FunctorRef0<_Functor, res_type>( f_r )
+ FunctorRef( TFunctor & f_r )
+ : functor_detail::FunctorRef0<TFunctor, res_type>( f_r )
{}
};
/** Convenience function creating a binary \ref FunctorRef. */
- template <class res_type, class arg1_type, class arg2_type, class _Functor>
- FunctorRef<_Functor, res_type, arg1_type, arg2_type>
- functorRef( _Functor & f_r )
- { return FunctorRef<_Functor, res_type, arg1_type, arg2_type>( f_r ); }
- template <class res_type, class arg1_type, class _Functor>
- FunctorRef<_Functor, res_type, arg1_type>
- functorRef( _Functor & f_r )
- { return FunctorRef<_Functor, res_type, arg1_type>( f_r ); }
- template <class res_type, class _Functor>
- FunctorRef<_Functor, res_type>
- functorRef( _Functor & f_r )
- { return FunctorRef<_Functor, res_type>( f_r ); }
+ template <class res_type, class arg1_type, class arg2_type, class TFunctor>
+ FunctorRef<TFunctor, res_type, arg1_type, arg2_type>
+ functorRef( TFunctor & f_r )
+ { return FunctorRef<TFunctor, res_type, arg1_type, arg2_type>( f_r ); }
+ template <class res_type, class arg1_type, class TFunctor>
+ FunctorRef<TFunctor, res_type, arg1_type>
+ functorRef( TFunctor & f_r )
+ { return FunctorRef<TFunctor, res_type, arg1_type>( f_r ); }
+ template <class res_type, class TFunctor>
+ FunctorRef<TFunctor, res_type>
+ functorRef( TFunctor & f_r )
+ { return FunctorRef<TFunctor, res_type>( f_r ); }
/////////////////////////////////////////////////////////////////
*
* \li \ref True and \ref False. No supprise, they always return
* \c true or \c false.
- * \li \ref Not\<_Condition\>. _Condition is a functor, and
+ * \li \ref Not\<TCondition\>. TCondition is a functor, and
* it's result is inverted.
- * \li \ref Chain\<_ACondition,_BCondition\>. \c _ACondition and \c _BCondition
- * are functors, and Chain evaluates <tt>_ACondition && _BCondition</tt>.
+ * \li \ref Chain\<TACondition,TBCondition\>. \c TACondition and \c TBCondition
+ * are functors, and Chain evaluates <tt>TACondition && TBCondition</tt>.
*
* As it's no fun to get and write the correct template arguments,
* convenience functions creating the correct functor are provided.
*/
//@{
- /* functor that always returns a copied
- value */
- template<class T>
+ /* functor that always returns a copied value */
+ template<class TConst>
struct Constant
{
- Constant( const T &value )
+ Constant( const TConst &value )
: _value(value)
{}
- template<class _Tp>
- T operator()( _Tp ) const
+ template<class Tp>
+ TConst operator()( Tp ) const
{ return _value; }
- T operator()() const
+ TConst operator()() const
{ return _value; }
- T _value;
+ TConst _value;
};
- template<class T>
- inline Constant<T> constant( const T &value )
- { return Constant<T>(value); }
+ template<class TConst>
+ inline Constant<TConst> constant( const TConst &value )
+ { return Constant<TConst>(value); }
- /** Logical functor always \c true.
- */
+ /** Logical functor always \c true. */
struct True
{
- template<class _Tp>
- bool operator()( _Tp ) const
+ template<class Tp>
+ bool operator()( Tp ) const
{
return true;
}
*/
struct False
{
- template<class _Tp>
- bool operator()( _Tp ) const
+ template<class Tp>
+ bool operator()( Tp ) const
{
return false;
}
inline False false_c()
{ return False(); }
- /** Logical functor inverting \a _Condition.
+ /** Logical functor inverting \a TCondition.
*/
- template<class _Condition>
+ template<class TCondition>
struct Not
{
- Not( _Condition cond_r )
+ Not( TCondition cond_r )
: _cond( cond_r )
{}
- template<class _Tp>
- bool operator()( _Tp t ) const
+ template<class Tp>
+ bool operator()( Tp t ) const
{
return ! _cond( t );
}
- _Condition _cond;
+ TCondition _cond;
};
- /** Convenience function for creating a Not from \a _Condition. */
- template<class _Condition>
- inline Not<_Condition> not_c( _Condition cond_r )
+ /** Convenience function for creating a Not from \a TCondition. */
+ template<class TCondition>
+ inline Not<TCondition> not_c( TCondition cond_r )
{
- return Not<_Condition>( cond_r );
+ return Not<TCondition>( cond_r );
}
- /** Logical functor chaining \a _ACondition \c OR \a _BCondition.
+ /** Logical functor chaining \a TACondition \c OR \a TBCondition.
*/
- template<class _ACondition, class _BCondition>
+ template<class TACondition, class TBCondition>
struct Or
{
- Or( _ACondition conda_r, _BCondition condb_r )
+ Or( TACondition conda_r, TBCondition condb_r )
: _conda( conda_r )
, _condb( condb_r )
{}
- template<class _Tp>
- bool operator()( _Tp t ) const
+ template<class Tp>
+ bool operator()( Tp t ) const
{
return _conda( t ) || _condb( t );
}
- _ACondition _conda;
- _BCondition _condb;
+ TACondition _conda;
+ TBCondition _condb;
};
/** Convenience function for creating a Or from two conditions
* \a conda_r OR \a condb_r.
*/
- template<class _ACondition, class _BCondition>
- inline Or<_ACondition, _BCondition> or_c( _ACondition conda_r, _BCondition condb_r )
+ template<class TACondition, class TBCondition>
+ inline Or<TACondition, TBCondition> or_c( TACondition conda_r, TBCondition condb_r )
{
- return Or<_ACondition, _BCondition>( conda_r, condb_r );
+ return Or<TACondition, TBCondition>( conda_r, condb_r );
}
- /** Logical functor chaining \a _ACondition \c AND \a _BCondition.
+ /** Logical functor chaining \a TACondition \c AND \a TBCondition.
*/
- template<class _ACondition, class _BCondition>
+ template<class TACondition, class TBCondition>
struct Chain
{
- Chain( _ACondition conda_r, _BCondition condb_r )
+ Chain( TACondition conda_r, TBCondition condb_r )
: _conda( conda_r )
, _condb( condb_r )
{}
- template<class _Tp>
- bool operator()( _Tp t ) const
+ template<class Tp>
+ bool operator()( Tp t ) const
{
return _conda( t ) && _condb( t );
}
- _ACondition _conda;
- _BCondition _condb;
+ TACondition _conda;
+ TBCondition _condb;
};
/** Convenience function for creating a Chain from two conditions
* \a conda_r and \a condb_r.
*/
- template<class _ACondition, class _BCondition>
- inline Chain<_ACondition, _BCondition> chain( _ACondition conda_r, _BCondition condb_r )
+ template<class TACondition, class TBCondition>
+ inline Chain<TACondition, TBCondition> chain( TACondition conda_r, TBCondition condb_r )
{
- return Chain<_ACondition, _BCondition>( conda_r, condb_r );
+ return Chain<TACondition, TBCondition>( conda_r, condb_r );
}
//@}
* getFirst( result ) );
* \endcode
*/
- template<class _Tp>
+ template<class Tp>
struct GetFirst
{
- GetFirst( _Tp & result_r )
+ GetFirst( Tp & result_r )
: _result( &result_r )
{}
- bool operator()( const _Tp & val_r )
+ bool operator()( const Tp & val_r )
{ *_result = val_r; return false; }
private:
- _Tp * _result;
+ Tp * _result;
};
/** Convenience function for creating \ref GetFirst. */
- template<class _Tp>
- GetFirst<_Tp> getFirst( _Tp & result_r )
- { return GetFirst<_Tp>( result_r ); }
+ template<class Tp>
+ GetFirst<Tp> getFirst( Tp & result_r )
+ { return GetFirst<Tp>( result_r ); }
/** Strore the last result found in the variable passed to the ctor.
*/
- template<class _Tp>
+ template<class Tp>
struct GetLast
{
- GetLast( _Tp & result_r )
+ GetLast( Tp & result_r )
: _result( &result_r )
{}
- bool operator()( const _Tp & val_r )
+ bool operator()( const Tp & val_r )
{ *_result = val_r; return true; }
private:
- _Tp * _result;
+ Tp * _result;
};
/** Convenience function for creating \ref GetLast. */
- template<class _Tp>
- GetLast<_Tp> getLast( _Tp & result_r )
- { return GetLast<_Tp>( result_r ); }
+ template<class Tp>
+ GetLast<Tp> getLast( Tp & result_r )
+ { return GetLast<Tp>( result_r ); }
/** Store all results found to some output_iterator.
sysRoot / "etc/products.d" );
* \endcode
*/
- template<class _OutputIterator>
+ template<class TOutputIterator>
struct GetAll
{
- GetAll( _OutputIterator result_r )
+ GetAll( TOutputIterator result_r )
: _result( result_r )
{}
- template<class _Tp>
- bool operator()( const _Tp & val_r ) const
+ template<class Tp>
+ bool operator()( const Tp & val_r ) const
{ *(_result++) = val_r; return true; }
private:
- mutable _OutputIterator _result;
+ mutable TOutputIterator _result;
};
/** Convenience function for creating \ref GetAll. */
- template<class _OutputIterator>
- GetAll<_OutputIterator> getAll( _OutputIterator result_r )
- { return GetAll<_OutputIterator>( result_r ); }
+ template<class TOutputIterator>
+ GetAll<TOutputIterator> getAll( TOutputIterator result_r )
+ { return GetAll<TOutputIterator>( result_r ); }
//@}
///////////////////////////////////////////////////////////////////
#define _(MSG) ::zypp::gettext::dgettext( MSG )
/** Return translated text (plural form). */
-#define _PL(MSG1,MSG2,N) ::zypp::gettext::dngettext( MSG1, MSG2, N )
+#define PL_(MSG1,MSG2,N) ::zypp::gettext::dngettext( MSG1, MSG2, N )
#else
#define _(MSG) ::gettext( MSG )
-#define _PL(MSG1,MSG2,N) ::ngettext( MSG1, MSG2, N )
+#define PL_(MSG1,MSG2,N) ::ngettext( MSG1, MSG2, N )
#endif
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
//
- // CLASS NAME : fXstream<class _BStr,class _SBuf>
+ // CLASS NAME : fXstream<class TBStr,class TSBuf>
/**
* @short Common template to define ifgzstream/ofgzstream
* reading/writing gzip files.
* @ref ofgzstream. fXstream is just to avoid almost
* duplicate code.
**/
- template<class _BStream,class _StreamBuf>
- class fXstream : public _BStream
+ template<class TBStream,class TStreamBuf>
+ class fXstream : public TBStream
{
public:
typedef gzstream_detail::ZlibError ZlibError;
- typedef _BStream stream_type;
- typedef _StreamBuf streambuf_type;
+ typedef TBStream stream_type;
+ typedef TStreamBuf streambuf_type;
fXstream()
: stream_type( NULL )
*/
#define ZYPP_DEFINE_ID_HASHABLE(C) \
namespace std { \
- template<class _Tp> struct hash; \
+ template<class Tp> struct hash; \
template<> struct hash<C> \
{ \
size_t operator()( const C & __s ) const \
namespace std
{
/** clone function for RW_pointer */
- template<class _D>
- inline unordered_set<_D> * rwcowClone( const std::unordered_set<_D> * rhs )
- { return new std::unordered_set<_D>( *rhs ); }
+ template<class D>
+ inline unordered_set<D> * rwcowClone( const std::unordered_set<D> * rhs )
+ { return new std::unordered_set<D>( *rhs ); }
/** clone function for RW_pointer */
- template<class _K, class _V>
- inline std::unordered_map<_K,_V> * rwcowClone( const std::unordered_map<_K,_V> * rhs )
- { return new std::unordered_map<_K,_V>( *rhs ); }
+ template<class K, class V>
+ inline std::unordered_map<K,V> * rwcowClone( const std::unordered_map<K,V> * rhs )
+ { return new std::unordered_map<K,V>( *rhs ); }
} // namespace std
///////////////////////////////////////////////////////////////////
#endif // ZYPP_BASE_HASH_H
/// };
/// \endcode
///////////////////////////////////////////////////////////////////
- template <class _Iterator>
+ template <class TIterator>
class Iterable
{
public:
typedef size_t size_type;
- typedef _Iterator iterator_type;
+ typedef TIterator iterator_type;
typedef typename std::iterator_traits<iterator_type>::value_type value_type;
typedef typename std::iterator_traits<iterator_type>::difference_type difference_type;
typedef typename std::iterator_traits<iterator_type>::pointer pointer;
};
/** \relates Iterable convenient construction. */
- template <class _Iterator>
- Iterable<_Iterator> makeIterable( _Iterator && begin_r, _Iterator && end_r )
- { return Iterable<_Iterator>( std::forward<_Iterator>(begin_r), std::forward<_Iterator>(end_r) ); }
+ template <class TIterator>
+ Iterable<TIterator> makeIterable( TIterator && begin_r, TIterator && end_r )
+ { return Iterable<TIterator>( std::forward<TIterator>(begin_r), std::forward<TIterator>(end_r) ); }
} // namespace zypp
///////////////////////////////////////////////////////////////////
using boost::make_filter_iterator;
/** Convenience to create filter_iterator from container::begin(). */
- template<class _Filter, class _Container>
- filter_iterator<_Filter, typename _Container::const_iterator>
- make_filter_begin( _Filter f, const _Container & c )
+ template<class TFilter, class TContainer>
+ filter_iterator<TFilter, typename TContainer::const_iterator>
+ make_filter_begin( TFilter f, const TContainer & c )
{
return make_filter_iterator( f, c.begin(), c.end() );
}
/** Convenience to create filter_iterator from container::begin(). */
- template<class _Filter, class _Container>
- filter_iterator<_Filter, typename _Container::const_iterator>
- make_filter_begin( const _Container & c )
+ template<class TFilter, class TContainer>
+ filter_iterator<TFilter, typename TContainer::const_iterator>
+ make_filter_begin( const TContainer & c )
{
- return make_filter_iterator( _Filter(), c.begin(), c.end() );
+ return make_filter_iterator( TFilter(), c.begin(), c.end() );
}
/** Convenience to create filter_iterator from container::end(). */
- template<class _Filter, class _Container>
- filter_iterator<_Filter, typename _Container::const_iterator>
- make_filter_end( _Filter f, const _Container & c )
+ template<class TFilter, class TContainer>
+ filter_iterator<TFilter, typename TContainer::const_iterator>
+ make_filter_end( TFilter f, const TContainer & c )
{
return make_filter_iterator( f, c.end(), c.end() );
}
/** Convenience to create filter_iterator from container::end(). */
- template<class _Filter, class _Container>
- filter_iterator<_Filter, typename _Container::const_iterator>
- make_filter_end( const _Container & c )
+ template<class TFilter, class TContainer>
+ filter_iterator<TFilter, typename TContainer::const_iterator>
+ make_filter_end( const TContainer & c )
{
- return make_filter_iterator( _Filter(), c.end(), c.end() );
+ return make_filter_iterator( TFilter(), c.end(), c.end() );
}
/** \class transform_iterator
/** Functor taking a \c std::pair returning \c std::pair.first.
* \see MapKVIteratorTraits
*/
- template<class _Pair>
- struct GetPairFirst : public std::unary_function<_Pair, const typename _Pair::first_type &>
+ template<class TPair>
+ struct GetPairFirst : public std::unary_function<TPair, const typename TPair::first_type &>
{
- const typename _Pair::first_type & operator()( const _Pair & pair_r ) const
+ const typename TPair::first_type & operator()( const TPair & pair_r ) const
{ return pair_r.first; }
};
/** Functor taking a \c std::pair returning \c std::pair.second .
* \see MapKVIteratorTraits
*/
- template<class _Pair>
- struct GetPairSecond : public std::unary_function<_Pair, const typename _Pair::second_type &>
+ template<class TPair>
+ struct GetPairSecond : public std::unary_function<TPair, const typename TPair::second_type &>
{
- const typename _Pair::second_type & operator()( const _Pair & pair_r ) const
+ const typename TPair::second_type & operator()( const TPair & pair_r ) const
{ return pair_r.second; }
};
* std::for_each( make_map_value_begin( mymap ), make_map_value_end( mymap ), DoSomething() );
* \endcode
*/
- template<class _Map>
+ template<class TMap>
struct MapKVIteratorTraits
{
/** The map type */
- typedef _Map MapType;
+ typedef TMap MapType;
/** The maps key type */
- typedef typename _Map::key_type KeyType;
+ typedef typename TMap::key_type KeyType;
/** The key iterator type */
typedef transform_iterator<GetPairFirst<typename MapType::value_type>,
typename MapType::const_iterator> Key_const_iterator;
/** The maps value (mapped) type */
- typedef typename _Map::mapped_type ValueType;
+ typedef typename TMap::mapped_type ValueType;
/** The value iterator type */
typedef transform_iterator<GetPairSecond<typename MapType::value_type>,
typename MapType::const_iterator> Value_const_iterator;
};
/** Convenience to create the key iterator from container::begin() */
- template<class _Map>
- inline typename MapKVIteratorTraits<_Map>::Key_const_iterator make_map_key_begin( const _Map & map_r )
- { return make_transform_iterator( map_r.begin(), GetPairFirst<typename _Map::value_type>() ); }
+ template<class TMap>
+ inline typename MapKVIteratorTraits<TMap>::Key_const_iterator make_map_key_begin( const TMap & map_r )
+ { return make_transform_iterator( map_r.begin(), GetPairFirst<typename TMap::value_type>() ); }
/** Convenience to create the key iterator from container::end() */
- template<class _Map>
- inline typename MapKVIteratorTraits<_Map>::Key_const_iterator make_map_key_end( const _Map & map_r )
- { return make_transform_iterator( map_r.end(), GetPairFirst<typename _Map::value_type>() ); }
+ template<class TMap>
+ inline typename MapKVIteratorTraits<TMap>::Key_const_iterator make_map_key_end( const TMap & map_r )
+ { return make_transform_iterator( map_r.end(), GetPairFirst<typename TMap::value_type>() ); }
/** Convenience to create the value iterator from container::begin() */
- template<class _Map>
- inline typename MapKVIteratorTraits<_Map>::Value_const_iterator make_map_value_begin( const _Map & map_r )
- { return make_transform_iterator( map_r.begin(), GetPairSecond<typename _Map::value_type>() ); }
+ template<class TMap>
+ inline typename MapKVIteratorTraits<TMap>::Value_const_iterator make_map_value_begin( const TMap & map_r )
+ { return make_transform_iterator( map_r.begin(), GetPairSecond<typename TMap::value_type>() ); }
/** Convenience to create the value iterator from container::end() */
- template<class _Map>
- inline typename MapKVIteratorTraits<_Map>::Value_const_iterator make_map_value_end( const _Map & map_r )
- { return make_transform_iterator( map_r.end(), GetPairSecond<typename _Map::value_type>() ); }
+ template<class TMap>
+ inline typename MapKVIteratorTraits<TMap>::Value_const_iterator make_map_value_end( const TMap & map_r )
+ { return make_transform_iterator( map_r.end(), GetPairSecond<typename TMap::value_type>() ); }
/** Convenience to create the key iterator from container::lower_bound() */
- template<class _Map>
- inline typename MapKVIteratorTraits<_Map>::Key_const_iterator make_map_key_lower_bound( const _Map & map_r, const typename _Map::key_type & key_r )
- { return make_transform_iterator( map_r.lower_bound( key_r ), GetPairFirst<typename _Map::value_type>() ); }
+ template<class TMap>
+ inline typename MapKVIteratorTraits<TMap>::Key_const_iterator make_map_key_lower_bound( const TMap & map_r, const typename TMap::key_type & key_r )
+ { return make_transform_iterator( map_r.lower_bound( key_r ), GetPairFirst<typename TMap::value_type>() ); }
/** Convenience to create the key iterator from container::upper_bound() */
- template<class _Map>
- inline typename MapKVIteratorTraits<_Map>::Key_const_iterator make_map_key_upper_bound( const _Map & map_r, const typename _Map::key_type & key_r )
- { return make_transform_iterator( map_r.upper_bound( key_r ), GetPairFirst<typename _Map::value_type>() ); }
+ template<class TMap>
+ inline typename MapKVIteratorTraits<TMap>::Key_const_iterator make_map_key_upper_bound( const TMap & map_r, const typename TMap::key_type & key_r )
+ { return make_transform_iterator( map_r.upper_bound( key_r ), GetPairFirst<typename TMap::value_type>() ); }
/** Convenience to create the value iterator from container::lower_bound() */
- template<class _Map>
- inline typename MapKVIteratorTraits<_Map>::Value_const_iterator make_map_value_lower_bound( const _Map & map_r, const typename _Map::key_type & key_r )
- { return make_transform_iterator( map_r.lower_bound( key_r ), GetPairSecond<typename _Map::value_type>() ); }
+ template<class TMap>
+ inline typename MapKVIteratorTraits<TMap>::Value_const_iterator make_map_value_lower_bound( const TMap & map_r, const typename TMap::key_type & key_r )
+ { return make_transform_iterator( map_r.lower_bound( key_r ), GetPairSecond<typename TMap::value_type>() ); }
/** Convenience to create the value iterator from container::upper_bound() */
- template<class _Map>
- inline typename MapKVIteratorTraits<_Map>::Value_const_iterator make_map_value_upper_bound( const _Map & map_r, const typename _Map::key_type & key_r )
- { return make_transform_iterator( map_r.upper_bound( key_r ), GetPairSecond<typename _Map::value_type>() ); }
+ template<class TMap>
+ inline typename MapKVIteratorTraits<TMap>::Value_const_iterator make_map_value_upper_bound( const TMap & map_r, const typename TMap::key_type & key_r )
+ { return make_transform_iterator( map_r.upper_bound( key_r ), GetPairSecond<typename TMap::value_type>() ); }
/** \class function_output_iterator
* An output iterator wrapping a unary function object; each time an
* TmpLineWriter mylw( new log::StderrLineWriter );
* \endcode
*/
- template<class _LineWriter>
- TmpLineWriter( _LineWriter * _allocated_r )
+ template<class TLineWriter>
+ TmpLineWriter( TLineWriter * _allocated_r )
: _writer( LogControl::instance().getLineWriter() )
{ LogControl::instance().setLineWriter( shared_ptr<LineWriter>( _allocated_r ) ); }
* // (1, 2, 3)
* \endcode
*/
- template<class _Iterator>
+ template<class TIterator>
std::ostream & dumpRange( std::ostream & str,
- _Iterator begin, _Iterator end,
+ TIterator begin, TIterator end,
const std::string & intro = "{",
const std::string & pfx = "\n ",
const std::string & sep = "\n ",
/** Print range defined by iterators (single line style).
* \see dumpRange
*/
- template<class _Iterator>
+ template<class TIterator>
std::ostream & dumpRangeLine( std::ostream & str,
- _Iterator begin, _Iterator end )
+ TIterator begin, TIterator end )
{ return dumpRange( str, begin, end, "(", "", ", ", "", ")" ); }
- template<class _Tp>
- std::ostream & operator<<( std::ostream & str, const std::vector<_Tp> & obj )
+ template<class Tp>
+ std::ostream & operator<<( std::ostream & str, const std::vector<Tp> & obj )
{ return dumpRange( str, obj.begin(), obj.end() ); }
- template<class _Tp, class _Cmp, class _Alloc>
- std::ostream & operator<<( std::ostream & str, const std::set<_Tp,_Cmp,_Alloc> & obj )
+ template<class Tp, class TCmp, class TAlloc>
+ std::ostream & operator<<( std::ostream & str, const std::set<Tp,TCmp,TAlloc> & obj )
{ return dumpRange( str, obj.begin(), obj.end() ); }
- template<class _Tp>
- std::ostream & operator<<( std::ostream & str, const std::unordered_set<_Tp> & obj )
+ template<class Tp>
+ std::ostream & operator<<( std::ostream & str, const std::unordered_set<Tp> & obj )
{ return dumpRange( str, obj.begin(), obj.end() ); }
- template<class _Tp>
- std::ostream & operator<<( std::ostream & str, const std::multiset<_Tp> & obj )
+ template<class Tp>
+ std::ostream & operator<<( std::ostream & str, const std::multiset<Tp> & obj )
{ return dumpRange( str, obj.begin(), obj.end() ); }
- template<class _Tp>
- std::ostream & operator<<( std::ostream & str, const std::list<_Tp> & obj )
+ template<class Tp>
+ std::ostream & operator<<( std::ostream & str, const std::list<Tp> & obj )
{ return dumpRange( str, obj.begin(), obj.end() ); }
///////////////////////////////////////////////////////////////////
* used in a std::map. The mapped std::pair is printed as
* <tt>[key] = value</tt>.
*/
- template<class _Pair>
+ template<class TPair>
class MapEntry
{
public:
- MapEntry( const _Pair & pair_r )
+ MapEntry( const TPair & pair_r )
: _pair( &pair_r )
{}
- const _Pair & pair() const
+ const TPair & pair() const
{ return *_pair; }
private:
- const _Pair *const _pair;
+ const TPair *const _pair;
};
/** \relates MapEntry Stream output. */
- template<class _Pair>
- std::ostream & operator<<( std::ostream & str, const MapEntry<_Pair> & obj )
+ template<class TPair>
+ std::ostream & operator<<( std::ostream & str, const MapEntry<TPair> & obj )
{
return str << '[' << obj.pair().first << "] = " << obj.pair().second;
}
/** \relates MapEntry Convenience function to create MapEntry from std::pair. */
- template<class _Pair>
- MapEntry<_Pair> mapEntry( const _Pair & pair_r )
- { return MapEntry<_Pair>( pair_r ); }
+ template<class TPair>
+ MapEntry<TPair> mapEntry( const TPair & pair_r )
+ { return MapEntry<TPair>( pair_r ); }
///////////////////////////////////////////////////////////////////
// dumpMap
* Uses a transform_iterator to wrap the std::pair into MapEntry.
*
*/
- template<class _Map>
+ template<class TMap>
class DumpMap
{
public:
- typedef _Map MapType;
- typedef typename _Map::value_type PairType;
+ typedef TMap MapType;
+ typedef typename TMap::value_type PairType;
typedef MapEntry<PairType> MapEntryType;
struct Transformer : public std::unary_function<PairType, MapEntryType>
MapEntry_const_iterator;
public:
- DumpMap( const _Map & map_r )
+ DumpMap( const TMap & map_r )
: _map( &map_r )
{}
- const _Map & map() const
+ const TMap & map() const
{ return *_map; }
MapEntry_const_iterator begin() const
{ return make_transform_iterator( map().end(), Transformer() );}
private:
- const _Map *const _map;
+ const TMap *const _map;
};
/** \relates DumpMap Stream output. */
- template<class _Map>
- std::ostream & operator<<( std::ostream & str, const DumpMap<_Map> & obj )
+ template<class TMap>
+ std::ostream & operator<<( std::ostream & str, const DumpMap<TMap> & obj )
{ return dumpRange( str, obj.begin(), obj.end() ); }
/** \relates DumpMap Convenience function to create DumpMap from std::map. */
- template<class _Map>
- DumpMap<_Map> dumpMap( const _Map & map_r )
- { return DumpMap<_Map>( map_r ); }
+ template<class TMap>
+ DumpMap<TMap> dumpMap( const TMap & map_r )
+ { return DumpMap<TMap>( map_r ); }
///////////////////////////////////////////////////////////////////
// dumpKeys
* std::cout << dumpKeys(mymap) << std::endl;
* \endcode
*/
- template<class _Map>
+ template<class TMap>
class DumpKeys
{
public:
- typedef typename MapKVIteratorTraits<_Map>::Key_const_iterator MapKey_const_iterator;
+ typedef typename MapKVIteratorTraits<TMap>::Key_const_iterator MapKey_const_iterator;
public:
- DumpKeys( const _Map & map_r )
+ DumpKeys( const TMap & map_r )
: _map( &map_r )
{}
- const _Map & map() const
+ const TMap & map() const
{ return *_map; }
MapKey_const_iterator begin() const
{ return make_map_key_end( map() ); }
private:
- const _Map *const _map;
+ const TMap *const _map;
};
/** \relates DumpKeys Stream output. */
- template<class _Map>
- std::ostream & operator<<( std::ostream & str, const DumpKeys<_Map> & obj )
+ template<class TMap>
+ std::ostream & operator<<( std::ostream & str, const DumpKeys<TMap> & obj )
{ return dumpRange( str, obj.begin(), obj.end() ); }
/** \relates DumpKeys Convenience function to create DumpKeys from std::map. */
- template<class _Map>
- DumpKeys<_Map> dumpKeys( const _Map & map_r )
- { return DumpKeys<_Map>( map_r ); }
+ template<class TMap>
+ DumpKeys<TMap> dumpKeys( const TMap & map_r )
+ { return DumpKeys<TMap>( map_r ); }
///////////////////////////////////////////////////////////////////
// dumpValues
* std::cout << dumpValues(mymap) << std::endl;
* \endcode
*/
- template<class _Map>
+ template<class TMap>
class DumpValues
{
public:
- typedef typename MapKVIteratorTraits<_Map>::Value_const_iterator MapValue_const_iterator;
+ typedef typename MapKVIteratorTraits<TMap>::Value_const_iterator MapValue_const_iterator;
public:
- DumpValues( const _Map & map_r )
+ DumpValues( const TMap & map_r )
: _map( &map_r )
{}
- const _Map & map() const
+ const TMap & map() const
{ return *_map; }
MapValue_const_iterator begin() const
{ return make_map_value_end( map() ); }
private:
- const _Map *const _map;
+ const TMap *const _map;
};
/** \relates DumpValues Stream output. */
- template<class _Map>
- std::ostream & operator<<( std::ostream & str, const DumpValues<_Map> & obj )
+ template<class TMap>
+ std::ostream & operator<<( std::ostream & str, const DumpValues<TMap> & obj )
{ return dumpRange( str, obj.begin(), obj.end() ); }
/** \relates DumpValues Convenience function to create DumpValues from std::map. */
- template<class _Map>
- DumpValues<_Map> dumpValues( const _Map & map_r )
- { return DumpValues<_Map>( map_r ); }
+ template<class TMap>
+ DumpValues<TMap> dumpValues( const TMap & map_r )
+ { return DumpValues<TMap>( map_r ); }
/////////////////////////////////////////////////////////////////
} // namespace _logtoolsdetail
using _logtoolsdetail::dumpKeys; // dumpRange keys
using _logtoolsdetail::dumpValues; // dumpRange values
- template<class _Key, class _Tp>
- std::ostream & operator<<( std::ostream & str, const std::map<_Key, _Tp> & obj )
+ template<class TKey, class Tp>
+ std::ostream & operator<<( std::ostream & str, const std::map<TKey, Tp> & obj )
{ return str << dumpMap( obj ); }
- template<class _Key, class _Tp>
- std::ostream & operator<<( std::ostream & str, const std::unordered_map<_Key, _Tp> & obj )
+ template<class TKey, class Tp>
+ std::ostream & operator<<( std::ostream & str, const std::unordered_map<TKey, Tp> & obj )
{ return str << dumpMap( obj ); }
- template<class _Key, class _Tp>
- std::ostream & operator<<( std::ostream & str, const std::multimap<_Key, _Tp> & obj )
+ template<class TKey, class Tp>
+ std::ostream & operator<<( std::ostream & str, const std::multimap<TKey, Tp> & obj )
{ return str << dumpMap( obj ); }
/** Print stream status bits.
namespace detail
{
- template<class _Tp>
+ template<class Tp>
struct Dump
{
- Dump( const _Tp & obj_r ) : _obj( obj_r ) {}
- const _Tp & _obj;
+ Dump( const Tp & obj_r ) : _obj( obj_r ) {}
+ const Tp & _obj;
};
- template<class _Tp>
- std::ostream & operator<<( std::ostream & str, const Dump<_Tp> & obj )
+ template<class Tp>
+ std::ostream & operator<<( std::ostream & str, const Dump<Tp> & obj )
{ return dumpOn( str, obj._obj ); }
}
- template<class _Tp>
- detail::Dump<_Tp> dump( const _Tp & obj_r )
- { return detail::Dump<_Tp>(obj_r); }
+ template<class Tp>
+ detail::Dump<Tp> dump( const Tp & obj_r )
+ { return detail::Dump<Tp>(obj_r); }
/////////////////////////////////////////////////////////////////
* to return the log stream.
*
* @code
- * _DBG("foo") << ....
+ * L_DBG("foo") << ....
* @endcode
* Logs a debug message for group @a "foo".
*
#define ZYPP_BASE_LOGGER_LOGGROUP "DEFINE_LOGGROUP"
#endif
-#define XXX _XXX( ZYPP_BASE_LOGGER_LOGGROUP )
-#define DBG _DBG( ZYPP_BASE_LOGGER_LOGGROUP )
-#define MIL _MIL( ZYPP_BASE_LOGGER_LOGGROUP )
-#define WAR _WAR( ZYPP_BASE_LOGGER_LOGGROUP )
-#define ERR _ERR( ZYPP_BASE_LOGGER_LOGGROUP )
-#define SEC _SEC( ZYPP_BASE_LOGGER_LOGGROUP )
-#define INT _INT( ZYPP_BASE_LOGGER_LOGGROUP )
-#define USR _USR( ZYPP_BASE_LOGGER_LOGGROUP )
+#define XXX L_XXX( ZYPP_BASE_LOGGER_LOGGROUP )
+#define DBG L_DBG( ZYPP_BASE_LOGGER_LOGGROUP )
+#define MIL L_MIL( ZYPP_BASE_LOGGER_LOGGROUP )
+#define WAR L_WAR( ZYPP_BASE_LOGGER_LOGGROUP )
+#define ERR L_ERR( ZYPP_BASE_LOGGER_LOGGROUP )
+#define SEC L_SEC( ZYPP_BASE_LOGGER_LOGGROUP )
+#define INT L_INT( ZYPP_BASE_LOGGER_LOGGROUP )
+#define USR L_USR( ZYPP_BASE_LOGGER_LOGGROUP )
-#define _XXX(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_XXX )
-#define _DBG(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP"++", zypp::base::logger::E_MIL )
-#define _MIL(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_MIL )
-#define _WAR(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_WAR )
-#define _ERR(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_ERR )
-#define _SEC(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_SEC )
-#define _INT(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_INT )
-#define _USR(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_USR )
+#define L_XXX(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_XXX )
+#define L_DBG(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP"++", zypp::base::logger::E_MIL )
+#define L_MIL(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_MIL )
+#define L_WAR(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_WAR )
+#define L_ERR(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_ERR )
+#define L_SEC(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_SEC )
+#define L_INT(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_INT )
+#define L_USR(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_USR )
-#define _BASEFILE ( *__FILE__ == '/' ? strrchr( __FILE__, '/' ) + 1 : __FILE__ )
+#define L_BASEFILE ( *__FILE__ == '/' ? strrchr( __FILE__, '/' ) + 1 : __FILE__ )
/** Actual call to @ref getStream. */
#define ZYPP_BASE_LOGGER_LOG(GROUP,LEVEL) \
- zypp::base::logger::getStream( GROUP, LEVEL, _BASEFILE, __FUNCTION__, __LINE__ )
+ zypp::base::logger::getStream( GROUP, LEVEL, L_BASEFILE, __FUNCTION__, __LINE__ )
/*@}*/
, _seq ( 0 )
{
_glevel += "..";
- INT << _level << "START MEASURE(" << _ident << ")" << endl;
+ log() << _level << "START MEASURE(" << _ident << ")" << endl;
_start.get();
}
{
_stop.get();
++_seq;
- std::ostream & str( INT << _level << "MEASURE(" << _ident << ") " );
+ std::ostream & str( log() << _level << "MEASURE(" << _ident << ") " );
dumpMeasure( str );
_glevel.erase( 0, 2 );
}
void restart()
{
- INT << _level << "RESTART MEASURE(" << _ident << ")" << endl;
+ log() << _level << "RESTART MEASURE(" << _ident << ")" << endl;
_start = _stop;
}
- void elapsed() const
+ void elapsed( const std::string & tag_r = std::string() ) const
{
_stop.get();
++_seq;
- std::ostream & str( INT << _level << "ELAPSED(" << _ident << ") " );
- dumpMeasure( str );
+ std::ostream & str( log() << _level << "ELAPSED(" << _ident << ") " );
+ dumpMeasure( str, tag_r );
_elapsed = _stop;
}
private:
- std::ostream & dumpMeasure( std::ostream & str_r ) const
+ /** Return the log stream. */
+ std::ostream & log() const
+ { return INT; }
+
+ std::ostream & dumpMeasure( std::ostream & str_r, const std::string & tag_r = std::string() ) const
{
str_r << ( _stop - _start );
if ( _seq > 1 ) // diff to previous _elapsed
{
str_r << " [" << ( _stop - _elapsed ) << "]";
}
+ if ( ! tag_r.empty() )
+ str_r << " - " << tag_r;
return str_r << endl;
}
{}
void Measure::start( const std::string & ident_r )
- {
- stop();
- _pimpl.reset( new Impl( ident_r ) );
- }
+ { stop(); _pimpl.reset( new Impl( ident_r ) ); }
void Measure::restart()
- {
- _pimpl->restart();
- }
+ { _pimpl->restart(); }
void Measure::elapsed() const
- {
- if ( _pimpl )
- _pimpl->elapsed();
- }
+ { if ( _pimpl ) _pimpl->elapsed(); }
+ void Measure::elapsed( const std::string & tag_r ) const
+ { if ( _pimpl ) _pimpl->elapsed( tag_r ); }
+ void Measure::elapsed( long tag_r ) const
+ { if ( _pimpl ) _pimpl->elapsed( asString( tag_r ) ); }
void Measure::stop()
- {
- _pimpl.reset();
- }
+ { _pimpl.reset(); }
/////////////////////////////////////////////////////////////////
} // namespace debug
* Timer keeps on running.
*/
void elapsed() const;
+ /** \overload Tagging the time with some text
+ * \code
+ * elapsed( "after action foo..." );
+ * \endcode
+ */
+ void elapsed( const std::string & tag_r ) const;
+ /** \overload Tagging the time with e.g. a line number
+ * \code
+ * elapsed( __LINE__ );
+ * \endcode
+ */
+ void elapsed( long tag_r ) const;
/** Stop a running timer. */
void stop();
/// Commands cmd( clist.getValue( "second" ) );
/// \endcode
///////////////////////////////////////////////////////////////////
- template< class _Tp, const bool _WithAlias = true >
+ template< class Tp, const bool _tWithAlias = true >
class NamedValue
{
- typedef std::map< std::string, _Tp > NameMap;
- typedef std::map< _Tp, std::string > ValueMap;
+ typedef std::map< std::string, Tp > NameMap;
+ typedef std::map< Tp, std::string > ValueMap;
public:
/** Whether not initialized (no (name,value) pair remembered) */
/** Get value mapped for name or alias.
* \return \c true if name or alias was found.
*/
- bool getValue( const std::string & name_r, _Tp & value_r ) const
+ bool getValue( const std::string & name_r, Tp & value_r ) const
{
typename NameMap::const_iterator it( _nameMap.find( name_r ) );
if ( it == _nameMap.end() )
return true;
}
/** \overload \throws std::out_of_range exception if \a name_r was not found. */
- const _Tp & getValue( const std::string & name_r ) const
+ const Tp & getValue( const std::string & name_r ) const
{ return _nameMap.at( name_r ); }
//@}
/** Get name of value.
* \return \c true if name or alias was found.
*/
- bool getName( const _Tp & value_r, std::string & name_r ) const
+ bool getName( const Tp & value_r, std::string & name_r ) const
{
typename ValueMap::const_iterator it( _valueMap.find( value_r ) );
if ( it == _valueMap.end() )
return true;
}
/** \overload \throws std::out_of_range exception if \a value_r was not found. */
- const std::string & getName( const _Tp & value_r ) const
+ const std::string & getName( const Tp & value_r ) const
{ return _valueMap.at( value_r ); }
//@}
/** \name Inserter
*/
//@{
- class _Inserter
+ class TInserter
{
public:
- _Inserter( NamedValue & parent_r, const _Tp & value_r )
+ TInserter( NamedValue & parent_r, const Tp & value_r )
: _parent( &parent_r )
, _value( value_r )
{}
- _Inserter & operator|( const std::string & name_r )
+ TInserter & operator|( const std::string & name_r )
{ _parent->insert( _value, name_r ); return *this; }
private:
NamedValue * _parent;
- _Tp _value;
+ Tp _value;
};
- _Inserter operator()( const _Tp & value_r )
- { return _Inserter( *this, value_r ); }
+ TInserter operator()( const Tp & value_r )
+ { return TInserter( *this, value_r ); }
//@}
/** Remember name (1st call) or alias (subsequent calls).
* \return \C true if this is the 1st call for \a value_r.
* \throws std::logic_error if \a name_r is already used as name or alias.
- * \throws std::logic_error if \c _WithAlias is \c false and a name for \a value_r is already defined.
+ * \throws std::logic_error if \c _tWithAlias is \c false and a name for \a value_r is already defined.
*/
- bool insert( const _Tp & value_r, const std::string & name_r )
+ bool insert( const Tp & value_r, const std::string & name_r )
{
typename NameMap::const_iterator nit( _nameMap.find( name_r ) );
if ( nit != _nameMap.end() ) // duplicate name
typename ValueMap::const_iterator tit( _valueMap.find( value_r ) );
if ( tit != _valueMap.end() ) // duplicate value, i.e. an alias
{
- if ( !_WithAlias )
+ if ( !_tWithAlias )
throw std::logic_error( "NamedValue::insert alias" );
_nameMap[name_r] = value_r;
* foo.numericId(); // returns foo's NumericId.
* \endcode
*/
- template<class _Derived, class _NumericIdType>
+ template<class TDerived, class TNumericIdType>
struct ProvideNumericId
{
public:
/** \return The objects numeric Id. */
- _NumericIdType numericId() const
+ TNumericIdType numericId() const
{ return _numericId; }
protected:
{}
private:
/** Provide the next Id to use. */
- static _NumericIdType nextId()
+ static TNumericIdType nextId()
{
- static _NumericIdType _staticCounter = 0;
+ static TNumericIdType _staticCounter = 0;
// Assert not returning 0
return ++_staticCounter;
}
/** */
- const _NumericIdType _numericId;
+ const TNumericIdType _numericId;
};
///////////////////////////////////////////////////////////////////
// as the typedef (else g++ will just print the pointer value).
/** \relates zypp::shared_ptr Stream output. */
- template<class _D>
- inline std::ostream & operator<<( std::ostream & str, const zypp::shared_ptr<_D> & obj )
+ template<class D>
+ inline std::ostream & operator<<( std::ostream & str, const zypp::shared_ptr<D> & obj )
{
if ( obj )
return str << *obj;
}
/** \relates zypp::shared_ptr Stream output. */
- template<class _D>
- inline std::ostream & dumpOn( std::ostream & str, const zypp::shared_ptr<_D> & obj )
+ template<class D>
+ inline std::ostream & dumpOn( std::ostream & str, const zypp::shared_ptr<D> & obj )
{
if ( obj )
return dumpOn( str, *obj );
{ return str << obj; }
/** \relates zypp::intrusive_ptr Stream output. */
- template<class _D>
- inline std::ostream & operator<<( std::ostream & str, const zypp::intrusive_ptr<_D> & obj )
+ template<class D>
+ inline std::ostream & operator<<( std::ostream & str, const zypp::intrusive_ptr<D> & obj )
{
if ( obj )
return str << *obj;
return str << std::string("NULL");
}
/** \relates zypp::intrusive_ptr Stream output. */
- template<class _D>
- inline std::ostream & dumpOn( std::ostream & str, const zypp::intrusive_ptr<_D> & obj )
+ template<class D>
+ inline std::ostream & dumpOn( std::ostream & str, const zypp::intrusive_ptr<D> & obj )
{
if ( obj )
return dumpOn( str, *obj );
//
///////////////////////////////////////////////////////////////////
/**
- * Don't forgett to provide versions for _Ptr and _constPtr,
+ * Don't forgett to provide versions for PtrType and constPtrType,
* esp. if creation a of temporary is not acceptable (eg. when
* checking the ref count value).
*/
namespace rw_pointer {
- template<class _D>
+ template<class D>
struct Shared
{
- typedef shared_ptr<_D> _Ptr;
- typedef shared_ptr<const _D> _constPtr;
+ typedef shared_ptr<D> PtrType;
+ typedef shared_ptr<const D> constPtrType;
/** Check whether pointer is not shared. */
- bool unique( const _constPtr & ptr_r )
+ bool unique( const constPtrType & ptr_r )
{ return !ptr_r || ptr_r.unique(); }
- bool unique( const _Ptr & ptr_r )
+ bool unique( const PtrType & ptr_r )
{ return !ptr_r || ptr_r.unique(); }
/** Return number of references. */
- long use_count( const _constPtr & ptr_r ) const
+ long use_count( const constPtrType & ptr_r ) const
{ return ptr_r.use_count(); }
- long use_count( const _Ptr & ptr_r ) const
+ long use_count( const PtrType & ptr_r ) const
{ return ptr_r.use_count(); }
};
- template<class _D>
+ template<class D>
struct Intrusive
{
- typedef intrusive_ptr<_D> _Ptr;
- typedef intrusive_ptr<const _D> _constPtr;
+ typedef intrusive_ptr<D> PtrType;
+ typedef intrusive_ptr<const D> constPtrType;
/** Check whether pointer is not shared. */
- bool unique( const _constPtr & ptr_r )
+ bool unique( const constPtrType & ptr_r )
{ return !ptr_r || (ptr_r->refCount() <= 1); }
- bool unique( const _Ptr & ptr_r )
+ bool unique( const PtrType & ptr_r )
{ return !ptr_r || (ptr_r->refCount() <= 1); }
/** Return number of references. */
- long use_count( const _constPtr & ptr_r ) const
+ long use_count( const constPtrType & ptr_r ) const
{ return ptr_r ? ptr_r->refCount() : 0; }
- long use_count( const _Ptr & ptr_r ) const
+ long use_count( const PtrType & ptr_r ) const
{ return ptr_r ? ptr_r->refCount() : 0; }
};
- template<class _D>
+ template<class D>
struct Scoped
{
- typedef scoped_ptr<_D> _Ptr;
- typedef scoped_ptr<const _D> _constPtr;
+ typedef scoped_ptr<D> PtrType;
+ typedef scoped_ptr<const D> constPtrType;
/** Check whether pointer is not shared. */
- bool unique( const _constPtr & ptr_r )
+ bool unique( const constPtrType & ptr_r )
{ return true; }
- bool unique( const _Ptr & ptr_r )
+ bool unique( const PtrType & ptr_r )
{ return true; }
/** Return number of references. */
- long use_count( const _constPtr & ptr_r ) const
+ long use_count( const constPtrType & ptr_r ) const
{ return ptr_r ? 1 : 0; }
- long use_count( const _Ptr & ptr_r ) const
+ long use_count( const PtrType & ptr_r ) const
{ return ptr_r ? 1 : 0; }
};
//
/** Wrapper for \c const correct access via \ref ZYPP_SMART_PTR.
*
- * zypp::RW_pointer<tt>\<_D,_Traits></tt> stores a \ref ZYPP_SMART_PTR
- * of type \c _Traits::_Ptr, which must be convertible into a <tt>_D *</tt>.
- * Pointer style access (via \c -> and \c *) offers a <tt>const _D *</tt> in const
- * a context, otherwise a <tt>_D *</tt>. Thus \em RW_ means \em read/write,
+ * zypp::RW_pointer<tt>\<D,DTraits></tt> stores a \ref ZYPP_SMART_PTR
+ * of type \c DTraits::PtrType, which must be convertible into a <tt>D *</tt>.
+ * Pointer style access (via \c -> and \c *) offers a <tt>const D *</tt> in const
+ * a context, otherwise a <tt>D *</tt>. Thus \em RW_ means \em read/write,
* as you get a different type, dependent on whether you're allowed to
* read or write.
*
* nonconst implementation methods.
*
* The second template argument defaults to
- * <tt>_Traits = rw_pointer::Shared<_D></tt> thus wraping a
- * <tt>shared_ptr<_D></tt>. To wrap an <tt>intrusive_ptr<_D></tt>
- * use <tt>rw_pointer::Intrusive<_D></tt>.
+ * <tt>DTraits = rw_pointer::Shared<D></tt> thus wraping a
+ * <tt>shared_ptr<D></tt>. To wrap an <tt>intrusive_ptr<D></tt>
+ * use <tt>rw_pointer::Intrusive<D></tt>.
*
* \see zypp::RWCOW_pointer for 'copy on write' functionality.
*
* };
* \endcode
*/
- template<class _D, class _Traits = rw_pointer::Shared<_D> >
+ template<class D, class DTraits = rw_pointer::Shared<D> >
struct RW_pointer
{
- typedef typename _Traits::_Ptr _Ptr;
- typedef typename _Traits::_constPtr _constPtr;
+ typedef typename DTraits::PtrType PtrType;
+ typedef typename DTraits::constPtrType constPtrType;
RW_pointer()
{}
{}
explicit
- RW_pointer( typename _Ptr::element_type * dptr )
+ RW_pointer( typename PtrType::element_type * dptr )
: _dptr( dptr )
{}
explicit
- RW_pointer( _Ptr dptr )
+ RW_pointer( PtrType dptr )
: _dptr( dptr )
{}
{ reset(); return *this; }
void reset()
- { _Ptr().swap( _dptr ); }
+ { PtrType().swap( _dptr ); }
- void reset( typename _Ptr::element_type * dptr )
- { _Ptr( dptr ).swap( _dptr ); }
+ void reset( typename PtrType::element_type * dptr )
+ { PtrType( dptr ).swap( _dptr ); }
void swap( RW_pointer & rhs )
{ _dptr.swap( rhs._dptr ); }
- void swap( _Ptr & rhs )
+ void swap( PtrType & rhs )
{ _dptr.swap( rhs ); }
explicit operator bool() const
{ return _dptr.get() != nullptr; }
- const _D & operator*() const
+ const D & operator*() const
{ return *_dptr; };
- const _D * operator->() const
+ const D * operator->() const
{ return _dptr.operator->(); }
- const _D * get() const
+ const D * get() const
{ return _dptr.get(); }
- _D & operator*()
+ D & operator*()
{ return *_dptr; }
- _D * operator->()
+ D * operator->()
{ return _dptr.operator->(); }
- _D * get()
+ D * get()
{ return _dptr.get(); }
public:
bool unique() const
- { return _Traits().unique( _dptr ); }
+ { return DTraits().unique( _dptr ); }
long use_count() const
- { return _Traits().use_count( _dptr ); }
+ { return DTraits().use_count( _dptr ); }
- _constPtr getPtr() const
+ constPtrType getPtr() const
{ return _dptr; }
- _Ptr getPtr()
+ PtrType getPtr()
{ return _dptr; }
- _constPtr cgetPtr()
+ constPtrType cgetPtr()
{ return _dptr; }
private:
- _Ptr _dptr;
+ PtrType _dptr;
};
///////////////////////////////////////////////////////////////////
/** \relates RW_pointer Stream output.
*
- * Print the \c _D object the RW_pointer refers, or \c "NULL"
+ * Print the \c D object the RW_pointer refers, or \c "NULL"
* if the pointer is \c NULL.
*/
- template<class _D, class _Ptr>
- inline std::ostream & operator<<( std::ostream & str, const RW_pointer<_D, _Ptr> & obj )
+ template<class D, class DPtr>
+ inline std::ostream & operator<<( std::ostream & str, const RW_pointer<D, DPtr> & obj )
{
if ( obj.get() )
return str << *obj.get();
}
/** \relates RW_pointer */
- template<class _D, class _Ptr>
- inline bool operator==( const RW_pointer<_D, _Ptr> & lhs, const RW_pointer<_D, _Ptr> & rhs )
+ template<class D, class DPtr>
+ inline bool operator==( const RW_pointer<D, DPtr> & lhs, const RW_pointer<D, DPtr> & rhs )
{ return( lhs.get() == rhs.get() ); }
/** \relates RW_pointer */
- template<class _D, class _Ptr>
- inline bool operator==( const RW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_Ptr & rhs )
+ template<class D, class DPtr>
+ inline bool operator==( const RW_pointer<D, DPtr> & lhs, const typename DPtr::PtrType & rhs )
{ return( lhs.get() == rhs.get() ); }
/** \relates RW_pointer */
- template<class _D, class _Ptr>
- inline bool operator==( const typename _Ptr::_Ptr & lhs, const RW_pointer<_D, _Ptr> & rhs )
+ template<class D, class DPtr>
+ inline bool operator==( const typename DPtr::PtrType & lhs, const RW_pointer<D, DPtr> & rhs )
{ return( lhs.get() == rhs.get() ); }
/** \relates RW_pointer */
- template<class _D, class _Ptr>
- inline bool operator==( const RW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_constPtr & rhs )
+ template<class D, class DPtr>
+ inline bool operator==( const RW_pointer<D, DPtr> & lhs, const typename DPtr::constPtrType & rhs )
{ return( lhs.get() == rhs.get() ); }
/** \relates RW_pointer */
- template<class _D, class _Ptr>
- inline bool operator==( const typename _Ptr::_constPtr & lhs, const RW_pointer<_D, _Ptr> & rhs )
+ template<class D, class DPtr>
+ inline bool operator==( const typename DPtr::constPtrType & lhs, const RW_pointer<D, DPtr> & rhs )
{ return( lhs.get() == rhs.get() ); }
/** \relates RW_pointer */
- template<class _D, class _Ptr>
- inline bool operator==( const RW_pointer<_D, _Ptr> & lhs, std::nullptr_t )
+ template<class D, class DPtr>
+ inline bool operator==( const RW_pointer<D, DPtr> & lhs, std::nullptr_t )
{ return( lhs.get() == nullptr ); }
/** \relates RW_pointer */
- template<class _D, class _Ptr>
- inline bool operator==( std::nullptr_t, const RW_pointer<_D, _Ptr> & rhs )
+ template<class D, class DPtr>
+ inline bool operator==( std::nullptr_t, const RW_pointer<D, DPtr> & rhs )
{ return( nullptr == rhs.get() ); }
/** \relates RW_pointer */
- template<class _D, class _Ptr>
- inline bool operator!=( const RW_pointer<_D, _Ptr> & lhs, const RW_pointer<_D, _Ptr> & rhs )
+ template<class D, class DPtr>
+ inline bool operator!=( const RW_pointer<D, DPtr> & lhs, const RW_pointer<D, DPtr> & rhs )
{ return ! ( lhs == rhs ); }
/** \relates RW_pointer */
- template<class _D, class _Ptr>
- inline bool operator!=( const RW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_Ptr & rhs )
+ template<class D, class DPtr>
+ inline bool operator!=( const RW_pointer<D, DPtr> & lhs, const typename DPtr::PtrType & rhs )
{ return ! ( lhs == rhs ); }
/** \relates RW_pointer */
- template<class _D, class _Ptr>
- inline bool operator!=( const typename _Ptr::_Ptr & lhs, const RW_pointer<_D, _Ptr> & rhs )
+ template<class D, class DPtr>
+ inline bool operator!=( const typename DPtr::PtrType & lhs, const RW_pointer<D, DPtr> & rhs )
{ return ! ( lhs == rhs ); }
/** \relates RW_pointer */
- template<class _D, class _Ptr>
- inline bool operator!=( const RW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_constPtr & rhs )
+ template<class D, class DPtr>
+ inline bool operator!=( const RW_pointer<D, DPtr> & lhs, const typename DPtr::constPtrType & rhs )
{ return ! ( lhs == rhs ); }
/** \relates RW_pointer */
- template<class _D, class _Ptr>
- inline bool operator!=( const typename _Ptr::_constPtr & lhs, const RW_pointer<_D, _Ptr> & rhs )
+ template<class D, class DPtr>
+ inline bool operator!=( const typename DPtr::constPtrType & lhs, const RW_pointer<D, DPtr> & rhs )
{ return ! ( lhs == rhs ); }
/** \relates RW_pointer */
- template<class _D, class _Ptr>
- inline bool operator!=( const RW_pointer<_D, _Ptr> & lhs, std::nullptr_t )
+ template<class D, class DPtr>
+ inline bool operator!=( const RW_pointer<D, DPtr> & lhs, std::nullptr_t )
{ return( lhs.get() != nullptr ); }
/** \relates RW_pointer */
- template<class _D, class _Ptr>
- inline bool operator!=( std::nullptr_t, const RW_pointer<_D, _Ptr> & rhs )
+ template<class D, class DPtr>
+ inline bool operator!=( std::nullptr_t, const RW_pointer<D, DPtr> & rhs )
{ return( nullptr != rhs.get() ); }
///////////////////////////////////////////////////////////////////
/** \relates RWCOW_pointer Clone the underlying object.
* Calls \a rhs <tt>-\>clone()</tt>. Being defined as a
* function outside \ref RWCOW_pointer allows to overload
- * it, in case a specific \a _D does not have <tt>clone()</tt>.
+ * it, in case a specific \a D does not have <tt>clone()</tt>.
*/
- template<class _D>
- inline _D * rwcowClone( const _D * rhs )
+ template<class D>
+ inline D * rwcowClone( const D * rhs )
{ return rhs->clone(); }
///////////////////////////////////////////////////////////////////
*
* See \ref RW_pointer.
*/
- template<class _D, class _Traits = rw_pointer::Shared<_D> >
+ template<class D, class DTraits = rw_pointer::Shared<D> >
struct RWCOW_pointer
{
- typedef typename _Traits::_Ptr _Ptr;
- typedef typename _Traits::_constPtr _constPtr;
+ typedef typename DTraits::PtrType PtrType;
+ typedef typename DTraits::constPtrType constPtrType;
RWCOW_pointer()
{}
{}
explicit
- RWCOW_pointer( typename _Ptr::element_type * dptr )
+ RWCOW_pointer( typename PtrType::element_type * dptr )
: _dptr( dptr )
{}
explicit
- RWCOW_pointer( _Ptr dptr )
+ RWCOW_pointer( PtrType dptr )
: _dptr( dptr )
{}
{ reset(); return *this; }
void reset()
- { _Ptr().swap( _dptr ); }
+ { PtrType().swap( _dptr ); }
- void reset( typename _Ptr::element_type * dptr )
- { _Ptr( dptr ).swap( _dptr ); }
+ void reset( typename PtrType::element_type * dptr )
+ { PtrType( dptr ).swap( _dptr ); }
void swap( RWCOW_pointer & rhs )
{ _dptr.swap( rhs._dptr ); }
- void swap( _Ptr & rhs )
+ void swap( PtrType & rhs )
{ _dptr.swap( rhs ); }
explicit operator bool() const
{ return _dptr.get() != nullptr; }
- const _D & operator*() const
+ const D & operator*() const
{ return *_dptr; };
- const _D * operator->() const
+ const D * operator->() const
{ return _dptr.operator->(); }
- const _D * get() const
+ const D * get() const
{ return _dptr.get(); }
- _D & operator*()
+ D & operator*()
{ assertUnshared(); return *_dptr; }
- _D * operator->()
+ D * operator->()
{ assertUnshared(); return _dptr.operator->(); }
- _D * get()
+ D * get()
{ assertUnshared(); return _dptr.get(); }
public:
bool unique() const
- { return _Traits().unique( _dptr ); }
+ { return DTraits().unique( _dptr ); }
long use_count() const
- { return _Traits().use_count( _dptr ); }
+ { return DTraits().use_count( _dptr ); }
- _constPtr getPtr() const
+ constPtrType getPtr() const
{ return _dptr; }
- _Ptr getPtr()
+ PtrType getPtr()
{ assertUnshared(); return _dptr; }
- _constPtr cgetPtr()
+ constPtrType cgetPtr()
{ return _dptr; }
private:
void assertUnshared()
{
if ( !unique() )
- _Ptr( rwcowClone( _dptr.get() ) ).swap( _dptr );
+ PtrType( rwcowClone( _dptr.get() ) ).swap( _dptr );
}
private:
- _Ptr _dptr;
+ PtrType _dptr;
};
///////////////////////////////////////////////////////////////////
/** \relates RWCOW_pointer Stream output.
*
- * Print the \c _D object the RWCOW_pointer refers, or \c "NULL"
+ * Print the \c D object the RWCOW_pointer refers, or \c "NULL"
* if the pointer is \c NULL.
*/
- template<class _D, class _Ptr>
- inline std::ostream & operator<<( std::ostream & str, const RWCOW_pointer<_D, _Ptr> & obj )
+ template<class D, class DPtr>
+ inline std::ostream & operator<<( std::ostream & str, const RWCOW_pointer<D, DPtr> & obj )
{
if ( obj.get() )
return str << *obj.get();
}
/** \relates RWCOW_pointer */
- template<class _D, class _Ptr>
- inline bool operator==( const RWCOW_pointer<_D, _Ptr> & lhs, const RWCOW_pointer<_D, _Ptr> & rhs )
+ template<class D, class DPtr>
+ inline bool operator==( const RWCOW_pointer<D, DPtr> & lhs, const RWCOW_pointer<D, DPtr> & rhs )
{ return( lhs.get() == rhs.get() ); }
/** \relates RWCOW_pointer */
- template<class _D, class _Ptr>
- inline bool operator==( const RWCOW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_Ptr & rhs )
+ template<class D, class DPtr>
+ inline bool operator==( const RWCOW_pointer<D, DPtr> & lhs, const typename DPtr::PtrType & rhs )
{ return( lhs.get() == rhs.get() ); }
/** \relates RWCOW_pointer */
- template<class _D, class _Ptr>
- inline bool operator==( const typename _Ptr::_Ptr & lhs, const RWCOW_pointer<_D, _Ptr> & rhs )
+ template<class D, class DPtr>
+ inline bool operator==( const typename DPtr::PtrType & lhs, const RWCOW_pointer<D, DPtr> & rhs )
{ return( lhs.get() == rhs.get() ); }
/** \relates RWCOW_pointer */
- template<class _D, class _Ptr>
- inline bool operator==( const RWCOW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_constPtr & rhs )
+ template<class D, class DPtr>
+ inline bool operator==( const RWCOW_pointer<D, DPtr> & lhs, const typename DPtr::constPtrType & rhs )
{ return( lhs.get() == rhs.get() ); }
/** \relates RWCOW_pointer */
- template<class _D, class _Ptr>
- inline bool operator==( const typename _Ptr::_constPtr & lhs, const RWCOW_pointer<_D, _Ptr> & rhs )
+ template<class D, class DPtr>
+ inline bool operator==( const typename DPtr::constPtrType & lhs, const RWCOW_pointer<D, DPtr> & rhs )
{ return( lhs.get() == rhs.get() ); }
/** \relates RWCOW_pointer */
- template<class _D, class _Ptr>
- inline bool operator==( const RWCOW_pointer<_D, _Ptr> & lhs, std::nullptr_t )
+ template<class D, class DPtr>
+ inline bool operator==( const RWCOW_pointer<D, DPtr> & lhs, std::nullptr_t )
{ return( lhs.get() == nullptr ); }
/** \relates RWCOW_pointer */
- template<class _D, class _Ptr>
- inline bool operator==( std::nullptr_t, const RWCOW_pointer<_D, _Ptr> & rhs )
+ template<class D, class DPtr>
+ inline bool operator==( std::nullptr_t, const RWCOW_pointer<D, DPtr> & rhs )
{ return( nullptr == rhs.get() ); }
/** \relates RWCOW_pointer */
- template<class _D, class _Ptr>
- inline bool operator!=( const RWCOW_pointer<_D, _Ptr> & lhs, const RWCOW_pointer<_D, _Ptr> & rhs )
+ template<class D, class DPtr>
+ inline bool operator!=( const RWCOW_pointer<D, DPtr> & lhs, const RWCOW_pointer<D, DPtr> & rhs )
{ return ! ( lhs == rhs ); }
/** \relates RWCOW_pointer */
- template<class _D, class _Ptr>
- inline bool operator!=( const RWCOW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_Ptr & rhs )
+ template<class D, class DPtr>
+ inline bool operator!=( const RWCOW_pointer<D, DPtr> & lhs, const typename DPtr::PtrType & rhs )
{ return ! ( lhs == rhs ); }
/** \relates RWCOW_pointer */
- template<class _D, class _Ptr>
- inline bool operator!=( const typename _Ptr::_Ptr & lhs, const RWCOW_pointer<_D, _Ptr> & rhs )
+ template<class D, class DPtr>
+ inline bool operator!=( const typename DPtr::PtrType & lhs, const RWCOW_pointer<D, DPtr> & rhs )
{ return ! ( lhs == rhs ); }
/** \relates RWCOW_pointer */
- template<class _D, class _Ptr>
- inline bool operator!=( const RWCOW_pointer<_D, _Ptr> & lhs, const typename _Ptr::_constPtr & rhs )
+ template<class D, class DPtr>
+ inline bool operator!=( const RWCOW_pointer<D, DPtr> & lhs, const typename DPtr::constPtrType & rhs )
{ return ! ( lhs == rhs ); }
/** \relates RWCOW_pointer */
- template<class _D, class _Ptr>
- inline bool operator!=( const typename _Ptr::_constPtr & lhs, const RWCOW_pointer<_D, _Ptr> & rhs )
+ template<class D, class DPtr>
+ inline bool operator!=( const typename DPtr::constPtrType & lhs, const RWCOW_pointer<D, DPtr> & rhs )
{ return ! ( lhs == rhs ); }
/** \relates RWCOW_pointer */
- template<class _D, class _Ptr>
- inline bool operator!=( const RWCOW_pointer<_D, _Ptr> & lhs, std::nullptr_t )
+ template<class D, class DPtr>
+ inline bool operator!=( const RWCOW_pointer<D, DPtr> & lhs, std::nullptr_t )
{ return( lhs.get() != nullptr ); }
/** \relates RWCOW_pointer */
- template<class _D, class _Ptr>
- inline bool operator!=( std::nullptr_t, const RWCOW_pointer<_D, _Ptr> & rhs )
+ template<class D, class DPtr>
+ inline bool operator!=( std::nullptr_t, const RWCOW_pointer<D, DPtr> & rhs )
{ return( nullptr != rhs.get() ); }
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
namespace zypp
{
- const std::string & _SetCompareDef::asString( Enum val_r )
+ const std::string & ESetCompareDef::asString( Enum val_r )
{
static std::map<Enum,std::string> _table = {
{ uncomparable, "{?}" },
return _table[val_r];
}
- const std::string & _SetRelationDef::asString( Enum val_r )
+ const std::string & ESetRelationDef::asString( Enum val_r )
{
static std::map<Enum,std::string> _table = {
{ uncomparable, "{??}" },
namespace zypp
{
///////////////////////////////////////////////////////////////////
- /// \class _SetCompareDef
+ /// \class ESetCompareDef
/// \brief Result of set comparison (use like 'enum class \ref SetCompare')
/// This is the type a \c compare function should return.
///////////////////////////////////////////////////////////////////
- struct _SetCompareDef {
+ struct ESetCompareDef {
enum Enum {
uncomparable = 0, ///< "{?}"
equal = (1<<0), ///< "{=}"
/** String representantion */
static const std::string & asString( Enum val_r );
};
- /** \relates _SetCompareDef typedef 'enum class SetCompare' */
- typedef base::EnumClass<_SetCompareDef> SetCompare;
+ /** \relates ESetCompareDef typedef 'enum class SetCompare' */
+ typedef base::EnumClass<ESetCompareDef> SetCompare;
/** \relates SetCompare Stream output */
inline std::ostream & operator<<( std::ostream & str, const SetCompare::Enum & obj )
{ return str << obj.asEnum(); }
///////////////////////////////////////////////////////////////////
- /// \class _SetRelationDef
+ /// \class ESetRelationDef
/// \brief Set Relation based on \ref SetCompare (use like 'enum class \ref SetRelation')
/// Comparison (\c== \c!=) between \ref SetRelation and \ref SetCompare
/// is defined to let \c SetRelation::subset match \c SetCompare::equal
/// as well as \c SetCompare::properSubset. Accordingly \c SetRelation::subset
/// matches \c SetCompare::equal as well as \c SetCompare::properSuperset.
///////////////////////////////////////////////////////////////////
- struct _SetRelationDef {
+ struct ESetRelationDef {
enum Enum {
uncomparable = SetCompare::uncomparable, ///< "{??}"
equal = SetCompare::equal, ///< "{==}"
/** String representantion */
static const std::string & asString( Enum val_r );
};
- /** \relates _SetRelationDef typedef 'enum class SetRelation' */
- typedef base::EnumClass<_SetRelationDef> SetRelation;
+ /** \relates ESetRelationDef typedef 'enum class SetRelation' */
+ typedef base::EnumClass<ESetRelationDef> SetRelation;
/** \relates SetRelation Stream output */
inline std::ostream & operator<<( std::ostream & str, const SetRelation::Enum & obj )
///
/// \note The tracking API expects the template arg to have set semantic.
///////////////////////////////////////////////////////////////////
- template <class _Set>
+ template <class TSet>
struct SetTracker
{
- typedef _Set set_type;
- typedef typename _Set::key_type key_type;
- typedef typename _Set::value_type value_type;
+ typedef TSet set_type;
+ typedef typename TSet::key_type key_type;
+ typedef typename TSet::value_type value_type;
/** Default Ctor: empty set */
SetTracker()
static bool find( const set_type & set_r, const key_type & key_r )
{ return set_r.find( key_r ) != set_r.end(); }
- template <class _ORDERED_SET, typename enable_if = typename _ORDERED_SET::key_compare>
- static void setDifference( const _ORDERED_SET & lhs, const _ORDERED_SET & rhs, _ORDERED_SET & result_r )
+ template <class TORDERED_SET, typename enable_if = typename TORDERED_SET::key_compare>
+ static void setDifference( const TORDERED_SET & lhs, const TORDERED_SET & rhs, TORDERED_SET & result_r )
{
// std::set_difference requires ordered sets!
std::set_difference( lhs.begin(), lhs.end(), rhs.begin(), rhs.end(),
std::inserter( result_r, result_r.end() ),
- typename _ORDERED_SET::key_compare() );
+ typename TORDERED_SET::key_compare() );
}
- template <class _UNORDERED_SET, typename enable_if = typename _UNORDERED_SET::hasher, typename = void>
- static void setDifference( const _UNORDERED_SET & lhs, const _UNORDERED_SET & rhs, _UNORDERED_SET & result_r )
+ template <class TUNORDERED_SET, typename enable_if = typename TUNORDERED_SET::hasher, typename = void>
+ static void setDifference( const TUNORDERED_SET & lhs, const TUNORDERED_SET & rhs, TUNORDERED_SET & result_r )
{
// std::set_difference requires ordered sets!
for ( const auto & l : lhs )
};
/** \relates SetTracker Stream output */
- template <class _Set>
- std::ostream & operator<<( std::ostream & str, const SetTracker<_Set> & obj )
+ template <class TSet>
+ std::ostream & operator<<( std::ostream & str, const SetTracker<TSet> & obj )
{ return str << "set(" << obj.current().size() << "|+" << obj.added().size() << "|-" << obj.removed().size() << ')'; }
} // namespace base
#include "zypp/base/String.h"
#include "zypp/base/StrMatcher.h"
+#include "zypp/sat/detail/PoolMember.h"
using std::endl;
if ( _flags.mode() == Match::OTHER )
ZYPP_THROW( MatchUnknownModeException( _flags, _search ) );
- _matcher.reset( new ::_Datamatcher );
+ _matcher.reset( new sat::detail::CDatamatcher );
int res = ::datamatcher_init( _matcher.get(), _search.c_str(), _flags.get() );
if ( res )
{
private:
std::string _search;
Match _flags;
- mutable scoped_ptr< ::_Datamatcher> _matcher;
+ mutable scoped_ptr< sat::detail::CDatamatcher> _matcher;
private:
friend Impl * rwcowClone<Impl>( const Impl * rhs );
* (\c std::string, \ref Pathname, \ref IdString, ...).
* \Note \c NULL never matches.
*/
- template<class _Tp>
- bool operator()( const _Tp & string_r ) const
+ template<class Tp>
+ bool operator()( const Tp & string_r ) const
{ return doMatch( string_r.c_str() ); }
/** \overload */
bool operator()( const char * string_r ) const
///////////////////////////////////////////////////////////////////
namespace zypp
{
- /** Request a human readable (translated) string representation of _Tp [_Tp.asUserString()]
+ /** Request a human readable (translated) string representation of Tp [Tp.asUserString()]
* Classes may implement a default as member function.
*/
- template <class _Tp>
- std::string asUserString( const _Tp & val_r )
+ template <class Tp>
+ std::string asUserString( const Tp & val_r )
{ return val_r.asUserString(); }
}// namespace zypp
MessageString( const char * str_r ) : std::string( str_r ? str_r : "" ) {}
MessageString( const std::string & str_r ) : std::string( str_r ) {}
// boost::format, std::ostringstream, str::Str ...
- template<class _Str>
- MessageString( const _Str & str_r ) : std::string( str_r.str() ) {}
+ template<class TStr>
+ MessageString( const TStr & str_r ) : std::string( str_r.str() ) {}
};
/** Convenience \c char* constructible from \c std::string and \c char*,
inline std::string asString( char * t )
{ return t; }
- template<class _T>
- inline std::string asString( const _T &t )
+ template<class Tp>
+ inline std::string asString( const Tp &t )
{ return t.asString(); }
- template<class _T>
- inline std::string asString( const intrusive_ptr<_T> &p )
+ template<class Tp>
+ inline std::string asString( const intrusive_ptr<Tp> &p )
{ return p->asString(); }
- template<class _T>
- inline std::string asString( const weak_ptr<_T> &p )
+ template<class Tp>
+ inline std::string asString( const weak_ptr<Tp> &p )
{ return p->asString(); }
template<>
*/
struct Str
{
- template<class _Tp>
- Str & operator<<( const _Tp & val )
+ template<class Tp>
+ Str & operator<<( const Tp & val )
{ _str << val; return *this; }
Str & operator<<( std::ostream& (*iomanip)( std::ostream& ) )
* time_t t = strtonum<time_t>( "42" );
* \endcode
*/
- template<typename _It>
- _It strtonum( const C_Str & str );
+ template<typename TInt>
+ TInt strtonum( const C_Str & str );
template<>
inline short strtonum( const C_Str & str ) { return ::strtol ( str, NULL, 0 ); }
* time_t t; strtonum( "42", t );
* \endcode
*/
- template<typename _It>
- inline _It strtonum( const C_Str & str, _It & i )
- { return i = strtonum<_It>( str ); }
+ template<typename TInt>
+ inline TInt strtonum( const C_Str & str, TInt & i )
+ { return i = strtonum<TInt>( str ); }
//@}
///////////////////////////////////////////////////////////////////
* \endcode
*
*/
- template<class _OutputIterator>
- unsigned split( const C_Str & line_r,
- _OutputIterator result_r,
- const C_Str & sepchars_r = " \t" )
+ template<class TOutputIterator>
+ unsigned split( const C_Str & line_r, TOutputIterator result_r, const C_Str & sepchars_r = " \t" )
{
const char * beg = line_r;
const char * cur = beg;
*
* \endcode
*/
- template<class _OutputIterator>
- unsigned splitEscaped( const C_Str & line_r,
- _OutputIterator result_r,
- const C_Str & sepchars_r = " \t",
- bool withEmpty = false)
+ template<class TOutputIterator>
+ unsigned splitEscaped( const C_Str & line_r, TOutputIterator result_r, const C_Str & sepchars_r = " \t", bool withEmpty = false)
{
const char * beg = line_r;
const char * cur = beg;
* \endcode
*
*/
- template<class _OutputIterator>
- unsigned splitFields( const C_Str & line_r,
- _OutputIterator result_r,
- const C_Str & sepchars_r = ":" )
+ template<class TOutputIterator>
+ unsigned splitFields( const C_Str & line_r, TOutputIterator result_r, const C_Str & sepchars_r = ":" )
{
const char * beg = line_r;
const char * cur = beg;
* \see splitFields()
* \see splitEscaped()
*/
- template<class _OutputIterator>
- unsigned splitFieldsEscaped( const C_Str & line_r,
- _OutputIterator result_r,
- const C_Str & sepchars_r = ":" )
+ template<class TOutputIterator>
+ unsigned splitFieldsEscaped( const C_Str & line_r, TOutputIterator result_r, const C_Str & sepchars_r = ":" )
{
- return
- splitEscaped( line_r, result_r, sepchars_r, true /* withEmpty */ );
+ return splitEscaped( line_r, result_r, sepchars_r, true /* withEmpty */ );
}
//@}
/** \name Join. */
//@{
/** Join strings using separator \a sep_r (defaults to BLANK). */
- template <class _Iterator>
- std::string join( _Iterator begin, _Iterator end,
- const C_Str & sep_r = " " )
+ template <class TIterator>
+ std::string join( TIterator begin, TIterator end, const C_Str & sep_r = " " )
{
std::string res;
- for ( _Iterator iter = begin; iter != end; ++ iter )
+ for ( TIterator iter = begin; iter != end; ++ iter )
{
if ( iter != begin )
res += sep_r;
}
/** Join strings using separator \a sep_r (defaults to BLANK). */
- template <class _Container>
- std::string join( const _Container & cont_r,
- const C_Str & sep_r = " " )
+ template <class TContainer>
+ std::string join( const TContainer & cont_r, const C_Str & sep_r = " " )
{ return join( cont_r.begin(), cont_r.end(), sep_r ); }
/** Join strings using separator \a sep_r, quoting or escaping the values.
* Separator defaults to BLANK. Use \ref splitEscaped to restore the
* values.
*/
- template <class _Iterator>
- std::string joinEscaped( _Iterator begin, _Iterator end,
- const char sep_r = ' ' )
+ template <class TIterator>
+ std::string joinEscaped( TIterator begin, TIterator end, const char sep_r = ' ' )
{
std::vector<char> buf;
- for ( _Iterator iter = begin; iter != end; ++ iter )
+ for ( TIterator iter = begin; iter != end; ++ iter )
{
if ( iter != begin )
buf.push_back( sep_r );
///////////////////////////////////////////////////////////////////
namespace _detail
{
- template<typename _Tp>
+ template<typename Tp>
struct _has_type_const_iterator
{
private:
template<typename C> static std::true_type test( typename C::const_iterator * );
template<typename C> static std::false_type test(...);
public:
- static constexpr bool value = decltype(test<_Tp>(nullptr))::value;
+ static constexpr bool value = decltype(test<Tp>(nullptr))::value;
};
- template <typename _Tp>
+ template <typename Tp>
struct _has_container_begin_end
{
private:
template<typename C> static std::false_type testEnd(...);
public:
- static constexpr bool beg_value = decltype(testBeg<_Tp>(nullptr))::value;
- static constexpr bool end_value = decltype(testEnd<_Tp>(nullptr))::value;
+ static constexpr bool beg_value = decltype(testBeg<Tp>(nullptr))::value;
+ static constexpr bool end_value = decltype(testEnd<Tp>(nullptr))::value;
static constexpr bool value = beg_value && end_value;
};
} // namespace _detail
///////////////////////////////////////////////////////////////////
- /** Whether \a _Tp defines type \a _Tp::const_iterator */
- template<typename _Tp>
+ /** Whether \a Tp defines type \a Tp::const_iterator */
+ template<typename Tp>
struct has_type_const_iterator
- : public std::integral_constant<bool, _detail::has_type_const_iterator<_Tp>::value>
+ : public std::integral_constant<bool, _detail::has_type_const_iterator<Tp>::value>
{};
- /** Whether \a _Tp defines methods <tt>_Tp::const_iterator begin/end() const</tt> */
- template<typename _Tp>
+ /** Whether \a Tp defines methods <tt>Tp::const_iterator begin/end() const</tt> */
+ template<typename Tp>
struct has_container_begin_end
- : public std::integral_constant<bool, _detail::_has_container_begin_end<_Tp>::value>
+ : public std::integral_constant<bool, _detail::_has_container_begin_end<Tp>::value>
{};
- /** Whether \a _Tp is a container (begin/end iterabel, but not plain std::string) */
- template<typename _Tp>
+ /** Whether \a Tp is a container (begin/end iterabel, but not plain std::string) */
+ template<typename Tp>
struct is_container
- : public std::integral_constant<bool, !std::is_same<_Tp, std::string>::value && has_container_begin_end<_Tp>::value>
+ : public std::integral_constant<bool, !std::is_same<Tp, std::string>::value && has_container_begin_end<Tp>::value>
{};
///
/// Used e.g. vor variable replaced config strings.
///////////////////////////////////////////////////////////////////
- template<class _Tp, class _UnaryFunction>
+ template<class Tp, class TUnaryFunction>
struct ValueTransform
{
- typedef _Tp RawType;
- typedef _UnaryFunction Transformator;
+ typedef Tp RawType;
+ typedef TUnaryFunction Transformator;
typedef typename Transformator::result_type TransformedType;
public:
///
/// Offers iterating over transformed strings in the list.
///////////////////////////////////////////////////////////////////
- template<class _Container, class _UnaryFunction>
+ template<class TContainer, class TUnaryFunction>
struct ContainerTransform
{
- typedef _Container Container;
- typedef _UnaryFunction Transformator;
+ typedef TContainer Container;
+ typedef TUnaryFunction Transformator;
typedef typename Container::size_type size_type;
typedef typename Container::value_type RawType;
typedef typename Transformator::result_type TransformedType;
using xml::unescape;
/** \relates NodeAttr NODE ATTRIBUTE representation of types [asString] */
- template <class _Tp>
- std::string asXmlNodeAttr( const _Tp & val_r )
+ template <class Tp>
+ std::string asXmlNodeAttr( const Tp & val_r )
{ return asString( val_r ); }
///////////////////////////////////////////////////////////////////
{
typedef std::pair<std::string,std::string> Pair;
- template <typename _Type>
- NodeAttr( std::string key_r, const _Type & val_r )
+ template <typename Tp>
+ NodeAttr( std::string key_r, const Tp & val_r )
: Pair( std::move(key_r), asXmlNodeAttr(val_r) )
{}
/// \name Default dumpAsXmlOn based on asString.
///
//@{
- template <class _Tp>
- inline std::ostream & dumpAsXmlOn( std::ostream & str, const _Tp & obj, const std::string & name_r )
+ template <class Tp>
+ inline std::ostream & dumpAsXmlOn( std::ostream & str, const Tp & obj, const std::string & name_r )
{
xmlout::Node guard( str, name_r, xmlout::Node::optionalContent );
const std::string & content( asString( obj ) );
const bool does_download_r )
: _mediaSource()
, _attachPoint( new AttachPoint())
- , _AttachPointHint()
+ , _attachPointHint()
, _relativeRoot( urlpath_below_attachpoint_r)
, _does_download( does_download_r )
, _attach_mtime(0)
void
MediaHandler::attachPointHint(const Pathname &path, bool temporary)
{
- _AttachPointHint.path = path;
- _AttachPointHint.temp = temporary;
+ _attachPointHint.path = path;
+ _attachPointHint.temp = temporary;
}
///////////////////////////////////////////////////////////////////
AttachPoint
MediaHandler::attachPointHint() const
{
- return _AttachPointHint;
+ return _attachPointHint;
}
///////////////////////////////////////////////////////////////////
*
* dir, false => user specified attach point (not removed)
*/
- AttachPoint _AttachPointHint;
+ AttachPoint _attachPointHint;
/**
* The relative root directory of the data on the media.
shared_ptr<ProxyInfo::Impl> ProxyInfo::Impl::_nullimpl;
ProxyInfo::ProxyInfo()
-#ifdef _WITH_LIBPROXY_SUPPORT_
+#ifdef WITH_LIBPROXY_SUPPORT
: _pimpl( new ProxyInfoLibproxy() )
#else
: _pimpl( new ProxyInfoSysconfig("proxy") )
#include <list>
#include "zypp/media/proxyinfo/ProxyInfoSysconfig.h"
-#ifdef _WITH_LIBPROXY_SUPPORT_
+#ifdef WITH_LIBPROXY_SUPPORT
#include "zypp/media/proxyinfo/ProxyInfoLibproxy.h"
#endif
/** Parse xml \c input_r and store data in \c data_r.
*
- * \c _Data must be defaultconstructible and assignable.
+ * \c TData must be defaultconstructible and assignable.
*
- * \c _Data::RootNode must be a \ref xml::ParseDef constructible
- * from \c _Data&.
+ * \c TData::RootNode must be a \ref xml::ParseDef constructible
+ * from \c TData&.
*
* \throws ParseDefException on parse errors.
*
* xmlData.parse( "/tmp/mytest.xml" );
* \endcode
*/
- template<class _Data>
- inline void rnParse( const InputStream & input_r, _Data & data_r )
+ template<class TData>
+ inline void rnParse( const InputStream & input_r, TData & data_r )
{
- typedef typename _Data::RootNode RootNode;
- _Data pdata;
+ typedef typename TData::RootNode RootNode;
+ TData pdata;
xml::Reader reader( input_r );
RootNode rootNode( pdata );
/** \ref parseDefAssign exposed details */
namespace parse_def_assign
{ /////////////////////////////////////////////////////////////////
- template <class _Type> struct Assigner;
+ template <class Tp> struct Assigner;
typedef shared_ptr<Assigner<void> > AssignerRef;
/** Common interface to all Assigner types. */
template <>
- struct Assigner<void>
+ struct Assigner<void>
{
virtual ~Assigner()
{}
};
/** Assigner assigns text to types constructible from \c char*.
- * \see \ref assigner consvenience constructor.
+ * \see \ref assigner convenience constructor.
*/
- template <class _Type>
- struct Assigner : public Assigner<void>
+ template <class Tp>
+ struct Assigner : public Assigner<void>
{
- Assigner(_Type & value_r )
+ Assigner( Tp & value_r )
: _value( &value_r )
{}
virtual void assign( const char * text_r )
- { *_value = _Type( text_r ); }
+ { *_value = Tp( text_r ); }
private:
- _Type * _value;
+ Tp * _value;
};
/** \name Assigner specialisation for numeric and boolean values.
inline void Assigner<unsigned long>::assign( const char * text_r ) { str::strtonum( text_r, *_value ); }
template <>
inline void Assigner<unsigned long long>::assign( const char * text_r ) { str::strtonum( text_r, *_value ); }
-
template <>
- inline void Assigner<bool>::assign( const char * text_r ) { str::strToBoolNodefault( text_r, *_value ); }
+ inline void Assigner<bool>::assign( const char * text_r ) { str::strToBoolNodefault( text_r, *_value ); }
//@}
/** \name \relates Assigner Convenience constructor */
//@{
- template <class _Type>
- inline AssignerRef assigner( _Type & value_r )
- { return AssignerRef( new Assigner<_Type>( value_r ) ); }
+ template <class Tp>
+ inline AssignerRef assigner( Tp & value_r )
+ { return AssignerRef( new Assigner<Tp>( value_r ) ); }
- template <class _Tp, _Tp _Initial>
- inline AssignerRef assigner( DefaultIntegral<_Tp,_Initial> & value_r )
- { return AssignerRef( new Assigner<_Tp>( value_r.get() ) ); }
+ template <class Tp, Tp TInitial>
+ inline AssignerRef assigner( DefaultIntegral<Tp,TInitial> & value_r )
+ { return AssignerRef( new Assigner<Tp>( value_r.get() ) ); }
//@}
private:
std::unordered_map<std::string, std::vector<AssignerRef> > _attr;
- std::vector<AssignerRef> _text;
- function<void ( const Node & )> _pre;
- function<void ( const Node & )> _post;
+ std::vector<AssignerRef> _text;
+ function<void ( const Node & )> _pre;
+ function<void ( const Node & )> _post;
};
/** Helper class to build a \ref Consumer.
{}
/** Contruct \ref Consumer. */
- template <class _Type>
- Builder( _Type & value_r )
+ template <class Tp>
+ Builder( Tp & value_r )
: _ptr( new Consumer )
{ operator()( value_r ); }
/** Contruct \ref Consumer. */
- template <class _Type>
- Builder( const std::string & attr_r, _Type & value_r )
+ template <class Tp>
+ Builder( const std::string & attr_r, Tp & value_r )
: _ptr( new Consumer )
{ operator()( attr_r, value_r ); }
/** Extend \ref Consumer. */
- template <class _Type>
- Builder & operator()( _Type & value_r )
+ template <class Tp>
+ Builder & operator()( Tp & value_r )
{ _ptr->add( assigner( value_r ) ); return *this; }
/** Extend \ref Consumer. */
- template <class _Type>
- Builder & operator()( const std::string & attr_r, _Type & value_r )
+ template <class Tp>
+ Builder & operator()( const std::string & attr_r, Tp & value_r )
{ _ptr->add( attr_r, assigner( value_r ) ); return *this; }
/** Set pre notification callback. */
inline parse_def_assign::Builder parseDefAssign()
{ return parse_def_assign::Builder(); }
- template <class _Type>
- inline parse_def_assign::Builder parseDefAssign( _Type & value_r )
+ template <class Tp>
+ inline parse_def_assign::Builder parseDefAssign( Tp & value_r )
{ return parse_def_assign::Builder( value_r ); }
- template <class _Type>
- inline parse_def_assign::Builder parseDefAssign( const std::string & attr_r, _Type & value_r )
+ template <class Tp>
+ inline parse_def_assign::Builder parseDefAssign( const std::string & attr_r, Tp & value_r )
{ return parse_def_assign::Builder( attr_r, value_r ); }
//@}
* number of ResObjects per Kind in a container.
* Fits container of ResObject::Ptr or PoolItem.
*/
- template <class _Iterator>
+ template <class TIterator>
std::ostream & dumpPoolStats( std::ostream & str,
- _Iterator begin_r, _Iterator end_r )
+ TIterator begin_r, TIterator end_r )
{
pool::PoolStats stats;
std::for_each( begin_r, end_r,
/** In CXX0X std::_Select2nd does no longer derive from std::unary_function
*/
- template<typename _Pair>
- struct P_Select2nd : public std::unary_function<_Pair, typename _Pair::second_type>
+ template<typename TPair>
+ struct P_Select2nd : public std::unary_function<TPair, typename TPair::second_type>
{
- typename _Pair::second_type&
- operator()(_Pair& __x) const
+ typename TPair::second_type&
+ operator()(TPair& __x) const
{ return __x.second; }
- const typename _Pair::second_type&
- operator()(const _Pair& __x) const
+ const typename TPair::second_type&
+ operator()(const TPair& __x) const
{ return __x.second; }
};
const_iterator end() const { return reinterpret_cast<const_iterator>(Queue::end()); }
public:
- using Queue::operator struct ::_Queue *; ///< libsolv backdoor
- using Queue::operator const struct ::_Queue *; ///< libsolv backdoor
+ using Queue::operator detail::CQueue *; ///< libsolv backdoor
+ using Queue::operator const detail::CQueue *; ///< libsolv backdoor
};
/** \relates FileConflicts Stream output */
///////////////////////////////////////////////////////////////////
- bool LookupAttr::iterator::dip_equal( const ::_Dataiterator & lhs, const ::_Dataiterator & rhs ) const
+ bool LookupAttr::iterator::dip_equal( const detail::CDataiterator & lhs, const detail::CDataiterator & rhs ) const
{
// Iterator equal is same position in same container.
// Here: same attribute in same solvable.
std::ostream & operator<<( std::ostream & str, const LookupAttr::iterator & obj )
{
- const ::_Dataiterator * dip = obj.get();
+ const detail::CDataiterator * dip = obj.get();
if ( ! dip )
return str << "EndOfQuery";
} // namespace zypp
///////////////////////////////////////////////////////////////////
-std::ostream & operator<<( std::ostream & str, const ::_Dataiterator * obj )
+std::ostream & operator<<( std::ostream & str, const zypp::sat::detail::CDataiterator * obj )
{
- str << "::_Dataiterator(";
+ str << "detail::CDataiterator(";
if ( ! obj )
{
str << "NULL";
#ifndef ZYPP_SAT_LOOKUPATTR_H
#define ZYPP_SAT_LOOKUPATTR_H
-extern "C"
-{
-struct _Dataiterator;
-}
#include <iosfwd>
#include "zypp/base/PtrTypes.h"
*/
size_type size() const;
- /** TransformIterator returning an \ref iterator vaue of type \c _ResultT. */
- template<class _ResultT, class _AttrT = _ResultT> class transformIterator;
+ /** TransformIterator returning an \ref iterator vaue of type \c TResult. */
+ template<class TResult, class TAttr = TResult>
+ class TransformIterator;
//@}
public:
namespace detail
{
- /** Wrapper around sat \c ::_Dataiterator.
+ /** Wrapper around sat \c detail::CDataiterator.
*
* Manages copy and assign, and release of allocated
* resources like datamatcher inside the dataiterator.
class DIWrap
{
public:
- /** \c NULL \c ::_Dataiterator */
+ /** \c NULL \c detail::CDataiterator */
DIWrap()
: _dip( 0 )
{}
{ return _dip; }
public:
- ::_Dataiterator * operator->() const { return _dip; }
- ::_Dataiterator * get() const { return _dip; }
+ detail::CDataiterator * operator->() const { return _dip; }
+ detail::CDataiterator * get() const { return _dip; }
const std::string & getstr() const { return _mstring; }
private:
- ::_Dataiterator * _dip;
+ detail::CDataiterator * _dip;
std::string _mstring;
};
/** \relates DIWrap Stream output. */
*/
class LookupAttr::iterator : public boost::iterator_adaptor<
iterator // Derived
- , ::_Dataiterator * // Base
+ , detail::CDataiterator * // Base
, detail::IdType // Value
, boost::forward_traversal_tag // CategoryOrTraversal
, detail::IdType // Reference
*
* Should be specialized for supported types above.
*/
- template<class _Tp> _Tp asType() const { return _Tp(id()); }
+ template<class Tp> Tp asType() const { return Tp(id()); }
//@}
///////////////////////////////////////////////////////////////////
public:
/**
- * C-tor taking over ownership of the passed \c ::_Dataiterator
+ * C-tor taking over ownership of the passed \c detail::CDataiterator
* and doing it's first iteration (::dataiterator_step)
*/
iterator( detail::DIWrap & dip_r );
&& ( ! base() || dip_equal( *base(), *rhs.base() ) );
}
- bool dip_equal( const ::_Dataiterator & lhs, const ::_Dataiterator & rhs ) const;
+ bool dip_equal( const detail::CDataiterator & lhs, const detail::CDataiterator & rhs ) const;
detail::IdType dereference() const;
public:
/** Expert backdoor. */
- ::_Dataiterator * get() const
+ detail::CDataiterator * get() const
{ return _dip.get(); }
private:
detail::DIWrap _dip;
template<> inline IdString LookupAttr::iterator::asType<IdString>() const { return idStr(); }
template<> CheckSum LookupAttr::iterator::asType<CheckSum>() const;
- template<class _ResultT, class _AttrT>
+ template<class TResult, class TAttr>
class ArrayAttr;
//@}
///////////////////////////////////////////////////////////////////
/** \relates LookupAttr::iterator Stream output of the underlying iterator for debug. */
-std::ostream & operator<<( std::ostream & str, const ::_Dataiterator * obj );
+std::ostream & operator<<( std::ostream & str, const zypp::sat::detail::CDataiterator * obj );
/** \relates LookupAttr::iterator Stream output of the underlying iterator for debug. */
-inline std::ostream & operator<<( std::ostream & str, const ::_Dataiterator & obj )
+inline std::ostream & operator<<( std::ostream & str, const zypp::sat::detail::CDataiterator & obj )
{ return str << &obj; }
#endif // ZYPP_SAT_LOOKUPATTR_H
///////////////////////////////////////////////////////////////////
//
- // CLASS NAME : LookupAttr::transformIterator
+ // CLASS NAME : LookupAttr::TransformIterator
//
- /** TransformIterator returning an \ref iterator value of type \c _ResultT.
+ /** TransformIterator returning an \ref iterator value of type \c TResult.
*
- * The underlying LookupAttr::iterators value is retrieved \ref asType<_AttrT>
+ * The underlying LookupAttr::iterators value is retrieved \ref asType<TAttr>
* and the returned \ref ResultT is constructed fron that value.
*
* \code
* {}
*
* public:
- * typedef sat::LookupAttr::transformIterator<PackageKeyword,IdString> iterator;
+ * typedef sat::LookupAttr::TransformIterator<PackageKeyword,IdString> iterator;
*
* iterator begin() const { return iterator( _q.begin() ); }
* iterator end() const { return iterator( _q.end() ); }
*
* \see \ref ArrayAttr.
*/
- template<class _ResultT, class _AttrT>
- class LookupAttr::transformIterator : public boost::iterator_adaptor<
- transformIterator<_ResultT,_AttrT> // Derived
+ template<class TResult, class TAttr>
+ class LookupAttr::TransformIterator : public boost::iterator_adaptor<
+ TransformIterator<TResult,TAttr> // Derived
, LookupAttr::iterator // Base
- , _ResultT // Value
+ , TResult // Value
, boost::forward_traversal_tag // CategoryOrTraversal
- , _ResultT // Reference
+ , TResult // Reference
>
{
public:
- transformIterator()
+ TransformIterator()
{}
explicit
- transformIterator( const LookupAttr::iterator & val_r )
+ TransformIterator( const LookupAttr::iterator & val_r )
{ this->base_reference() = val_r; }
public:
private:
friend class boost::iterator_core_access;
- _ResultT dereference() const
+ TResult dereference() const
{
const LookupAttr::iterator lit( this->base_reference() );
- return _ResultT( lit.asType<_AttrT>() );
+ return TResult( lit.asType<TAttr>() );
}
};
///////////////////////////////////////////////////////////////////
- template<class _ResultT, class _AttrT>
+ template<class TResult, class TAttr>
class ArrayAttr;
- template<class _ResultT, class _AttrT>
- std::ostream & operator<<( std::ostream & str, const ArrayAttr<_ResultT,_AttrT> & obj );
+ template<class TResult, class TAttr>
+ std::ostream & operator<<( std::ostream & str, const ArrayAttr<TResult,TAttr> & obj );
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : ArrayAttr
//
- /** \ref LookupAttr::transformIterator based container to retrieve list attributes.
+ /** \ref LookupAttr::TransformIterator based container to retrieve list attributes.
*
* You may pass \ref LookupAttr::REPO_ATTR as \ref LookupAttr::Location argument,
* to lookup attributes associated with the \ref Repository as a whole
*
* \todo Maybe add some way to unify the result.
*/
- template<class _ResultT, class _AttrT>
+ template<class TResult, class TAttr>
class ArrayAttr
{
- friend std::ostream & operator<< <_ResultT,_AttrT>( std::ostream & str, const ArrayAttr<_ResultT,_AttrT> & obj );
+ friend std::ostream & operator<< <TResult,TAttr>( std::ostream & str, const ArrayAttr<TResult,TAttr> & obj );
public:
ArrayAttr()
{}
public:
- typedef LookupAttr::transformIterator<_ResultT,_AttrT> iterator;
+ typedef LookupAttr::TransformIterator<TResult,TAttr> iterator;
typedef LookupAttr::size_type size_type;
iterator begin() const
public:
- iterator find( const _ResultT & key_r ) const
+ iterator find( const TResult & key_r ) const
{
for_( it, begin(), end() )
{
///////////////////////////////////////////////////////////////////
/** \relates LookupAttr::iterator Stream output. */
- template<class _ResultT, class _AttrT>
- inline std::ostream & operator<<( std::ostream & str, const ArrayAttr<_ResultT,_AttrT> & obj )
+ template<class TResult, class TAttr>
+ inline std::ostream & operator<<( std::ostream & str, const ArrayAttr<TResult,TAttr> & obj )
{ return dumpOn( str, obj._q ); }
/////////////////////////////////////////////////////////////////
{ /////////////////////////////////////////////////////////////////
template<>
- struct ::_Map * rwcowClone<struct ::_Map>( const struct ::_Map * rhs )
+ sat::detail::CMap * rwcowClone<sat::detail::CMap>( const sat::detail::CMap * rhs )
{
- struct ::_Map * ret = new ::_Map;
- ::map_init_clone( ret, const_cast<struct ::_Map *>(rhs) );
+ sat::detail::CMap * ret = new sat::detail::CMap;
+ ::map_init_clone( ret, const_cast<sat::detail::CMap *>(rhs) );
return ret;
}
{ /////////////////////////////////////////////////////////////////
Map::Map()
- : _pimpl( new ::_Map )
+ : _pimpl( new detail::CMap )
{ ::map_init( _pimpl.get(), 0 ); }
Map::Map( size_type size_r )
- : _pimpl( new ::_Map )
+ : _pimpl( new detail::CMap )
{ ::map_init( _pimpl.get(), size_r ); }
Map::Map( PoolSizeType )
- : _pimpl( new ::_Map )
+ : _pimpl( new detail::CMap )
{ ::map_init( _pimpl.get(), Pool::instance().capacity() ); }
Map::~Map()
return ret;
}
- Map::operator struct ::_Map *() // COW: nonconst version can't be inlined
- { return _pimpl.get(); } // without exposing struct ::_Map
+ Map::operator detail::CMap *() // COW: nonconst version can't be inlined
+ { return _pimpl.get(); } // without exposing detail::CMap
bool operator==( const Map & lhs, const Map & rhs )
{
- const struct ::_Map * l = lhs;
- const struct ::_Map * r = rhs;
+ const detail::CMap * l = lhs;
+ const detail::CMap * r = rhs;
return( l == r || ( l->size == r->size && ::memcmp( l->map, r->map, l->size ) == 0 ) );
}
#ifndef ZYPP_SAT_MAP_H
#define ZYPP_SAT_MAP_H
-extern "C"
-{
- struct _Map;
-}
#include <iosfwd>
#include <string>
#include "zypp/base/PtrTypes.h"
+#include "zypp/sat/detail/PoolMember.h"
///////////////////////////////////////////////////////////////////
namespace zypp
std::string asString( const char on_r = '1', const char off_r = '0' ) const;
public:
- operator struct ::_Map *(); ///< libsolv backdoor
- operator const struct ::_Map *() const ///< libsolv backdoor
+ operator detail::CMap *(); ///< libsolv backdoor
+ operator const detail::CMap *() const ///< libsolv backdoor
{ return _pimpl.get(); }
private:
- RWCOW_pointer<struct ::_Map> _pimpl; ///< Pointer to implementation
+ RWCOW_pointer<detail::CMap> _pimpl; ///< Pointer to implementation
};
/** \relates Map Stream output */
///////////////////////////////////////////////////////////////////
/** \relates Map Clone function for RWCOW_pointer */
- template<> struct ::_Map * rwcowClone<struct ::_Map>( const struct ::_Map * rhs );
+ template<> sat::detail::CMap * rwcowClone<sat::detail::CMap>( const sat::detail::CMap * rhs );
typedef sat::Map Bitmap;
const std::string & Pool::systemRepoAlias()
{ return detail::PoolImpl::systemRepoAlias(); }
- ::_Pool * Pool::get() const
+ detail::CPool * Pool::get() const
{ return myPool().getPool(); }
Pool::size_type Pool::capacity() const
std::ofstream idx( solvidxfile.c_str() );
- ::_Pool * _pool = ::pool_create();
- ::_Repo * _repo = ::repo_create( _pool, "" );
+ detail::CPool * _pool = ::pool_create();
+ detail::CRepo * _repo = ::repo_create( _pool, "" );
if ( ::repo_add_solv( _repo, solv, 0 ) == 0 )
{
int _id = 0;
- ::_Solvable * _solv = nullptr;
+ detail::CSolvable * _solv = nullptr;
FOR_REPO_SOLVABLES( _repo, _id, _solv )
{
if ( _solv )
{ return makeIterable( solvablesBegin(), solvablesEnd() ); }
public:
- /** \name Iterate all Solvables matching a \c _Filter. */
+ /** \name Iterate all Solvables matching a \c TFilter. */
//@{
- template<class _Filter>
- filter_iterator<_Filter,SolvableIterator> filterBegin( const _Filter & filter_r ) const
+ template<class TFilter>
+ filter_iterator<TFilter,SolvableIterator> filterBegin( const TFilter & filter_r ) const
{ return make_filter_iterator( filter_r, solvablesBegin(), solvablesEnd() ); }
- template<class _Filter>
- filter_iterator<_Filter,SolvableIterator> filterEnd( const _Filter & filter_r ) const
+ template<class TFilter>
+ filter_iterator<TFilter,SolvableIterator> filterEnd( const TFilter & filter_r ) const
{ return make_filter_iterator( filter_r, solvablesEnd(), solvablesEnd() ); }
//@}
public:
/** Expert backdoor. */
- ::_Pool * get() const;
+ detail::CPool * get() const;
private:
/** Default ctor */
Pool() {}
{
template<>
- struct ::_Queue * rwcowClone<struct ::_Queue>( const struct ::_Queue * rhs )
+ sat::detail::CQueue * rwcowClone<sat::detail::CQueue>( const sat::detail::CQueue * rhs )
{
- struct ::_Queue * ret = new ::_Queue;
- ::queue_init_clone( ret, const_cast<struct ::_Queue *>(rhs) );
+ sat::detail::CQueue * ret = new sat::detail::CQueue;
+ ::queue_init_clone( ret, const_cast<sat::detail::CQueue *>(rhs) );
return ret;
}
{
Queue::Queue()
- : _pimpl( new ::_Queue )
+ : _pimpl( new detail::CQueue )
{ ::queue_init( _pimpl.get() ); }
Queue::~Queue()
Queue::value_type Queue::pop_front()
{ return ::queue_shift( _pimpl.get() ); }
- Queue::operator struct ::_Queue *() // COW: nonconst version can't be inlined
- { return _pimpl.get(); } // without exposing struct ::_Queue
+ Queue::operator detail::CQueue *() // COW: nonconst version can't be inlined
+ { return _pimpl.get(); } // without exposing detail::CQueue
std::ostream & operator<<( std::ostream & str, const Queue & obj )
{ return dumpRangeLine( str << "Queue ", obj.begin(), obj.end() ); }
bool operator==( const Queue & lhs, const Queue & rhs )
{
- const struct ::_Queue * l = lhs;
- const struct ::_Queue * r = rhs;
+ const detail::CQueue * l = lhs;
+ const detail::CQueue * r = rhs;
return( l == r || ( l->count == r->count && ::memcmp( l->elements, r->elements, l->count ) == 0 ) );
}
#ifndef ZYPP_SAT_QUEUE_H
#define ZYPP_SAT_QUEUE_H
-extern "C"
-{
- struct _Queue;
-}
#include <iosfwd>
#include "zypp/base/PtrTypes.h"
value_type pop_front();
public:
- operator struct ::_Queue *(); ///< libsolv backdoor
- operator const struct ::_Queue *() const ///< libsolv backdoor
+ operator detail::CQueue *(); ///< libsolv backdoor
+ operator const detail::CQueue *() const ///< libsolv backdoor
{ return _pimpl.get(); }
private:
- RWCOW_pointer<struct ::_Queue> _pimpl; ///< Pointer to implementation
+ RWCOW_pointer<detail::CQueue> _pimpl; ///< Pointer to implementation
};
/** \relates Queue Stream output */
///////////////////////////////////////////////////////////////////
/** \relates Queue Clone function for RWCOW_pointer */
- template<> struct ::_Queue * rwcowClone<struct ::_Queue>( const struct ::_Queue * rhs );
+ template<> sat::detail::CQueue * rwcowClone<sat::detail::CQueue>( const sat::detail::CQueue * rhs );
} // namespace zypp
///////////////////////////////////////////////////////////////////
{ size_type s = 0; for_( it, self().begin(), self().end() ) ++s; return s;}
/** Whether collection contains a specific \ref Solvable. */
- template<class _Solv>
- bool contains( const _Solv & solv_r ) const
+ template<class TSolv>
+ bool contains( const TSolv & solv_r ) const
{
Solvable solv( asSolvable()( solv_r ) );
for_( it, self().begin(), self().end() )
/////////////////////////////////////////////////////////////////
- ::_Solvable * Solvable::get() const
+ detail::CSolvable * Solvable::get() const
{ return myPool().getSolvable( _id ); }
#define NO_SOLVABLE_RETURN( VAL ) \
- ::_Solvable * _solvable( get() ); \
+ detail::CSolvable * _solvable( get() ); \
if ( ! _solvable ) return VAL
Solvable Solvable::nextInPool() const
NO_SOLVABLE_RETURN( noSolvable );
for ( detail::SolvableIdType next = _id+1; next < unsigned(_solvable->repo->end); ++next )
{
- ::_Solvable * nextS( myPool().getSolvable( next ) );
+ detail::CSolvable * nextS( myPool().getSolvable( next ) );
if ( nextS && nextS->repo == _solvable->repo )
{
return Solvable( next );
bool Solvable::identical( const Solvable & rhs ) const
{
NO_SOLVABLE_RETURN( ! rhs.get() );
- ::_Solvable * rhssolvable( rhs.get() );
+ detail::CSolvable * rhssolvable( rhs.get() );
return rhssolvable && ( _solvable == rhssolvable || ::solvable_identical( _solvable, rhssolvable ) );
}
LocaleSet Solvable::getSupportedLocales() const
{
LocaleSet ret;
- invokeOnEachSupportedLocale( supplements(), functor::Collector( std::inserter( ret, ret.begin() ) ) );
+ invokeOnEachSupportedLocale( supplements(), functor::collector( std::inserter( ret, ret.begin() ) ) );
return ret;
}
*/
bool isKind( const ResKind & kind_r ) const;
/** \overload */
- template<class _Res>
+ template<class TRes>
bool isKind() const
- { return isKind( resKind<_Res>() ); }
+ { return isKind( resKind<TRes>() ); }
/** \overload Extend the test to a range of \ref ResKind. */
- template<class _Iterator>
- bool isKind( _Iterator begin, _Iterator end ) const
+ template<class TIterator>
+ bool isKind( TIterator begin, TIterator end ) const
{ for_( it, begin, end ) if ( isKind( *it ) ) return true; return false; }
/** The name (without any ResKind prefix). */
/** Return next Solvable in \ref Repo (or \ref noSolvable). */
Solvable nextInRepo() const;
/** Expert backdoor. */
- ::_Solvable * get() const;
+ detail::CSolvable * get() const;
/** Expert backdoor. */
IdType id() const { return _id; }
{ return lhs.get() < rhs.get(); }
/** \relates Solvable Test whether a \ref Solvable is of a certain Kind. */
- template<class _Res>
+ template<class TRes>
inline bool isKind( const Solvable & solvable_r )
- { return solvable_r.isKind( ResTraits<_Res>::kind ); }
+ { return solvable_r.isKind( ResTraits<TRes>::kind ); }
/** \relates Solvable Test for same content. */
inline bool identical( const Solvable & lhs, const Solvable & rhs )
/** */
class SolvableIterator : public boost::iterator_adaptor<
SolvableIterator // Derived
- , ::_Solvable* // Base
+ , CSolvable* // Base
, const Solvable // Value
, boost::forward_traversal_tag // CategoryOrTraversal
, const Solvable // Reference
{}
/** Ctor building a set from a range. */
- template<class _InputIterator>
- SolvableSet( _InputIterator begin_r, _InputIterator end_r )
+ template<class TInputIterator>
+ SolvableSet( TInputIterator begin_r, TInputIterator end_r )
: _pimpl( new Container( begin_r, end_r ) )
{}
{ return _pimpl->size(); }
/** */
- template<class _Solv>
- bool contains( const _Solv & solv_r ) const
+ template<class TSolv>
+ bool contains( const TSolv & solv_r ) const
{ return( get().count( asSolvable()( solv_r ) ) ); }
/** Iterator pointing to the first \ref Solvable. */
/** Insert a Solvable.
* \return \c true if it was actually inserted, or \c false if already present.
*/
- template<class _Solv>
- bool insert( const _Solv & solv_r )
+ template<class TSolv>
+ bool insert( const TSolv & solv_r )
{ return get().insert( asSolvable()( solv_r ) ).second; }
public:
ResKind kind() const { return satSolvable().kind(); }
bool isKind( const ResKind & kind_r ) const { return satSolvable().isKind( kind_r ); }
- template<class _Res>
- bool isKind() const { return satSolvable().isKind<_Res>(); }
- template<class _Iterator>
- bool isKind( _Iterator begin, _Iterator end ) const { return satSolvable().isKind( begin, end ); }
+ template<class TRes>
+ bool isKind() const { return satSolvable().isKind<TRes>(); }
+ template<class TIterator>
+ bool isKind( TIterator begin, TIterator end ) const { return satSolvable().isKind( begin, end ); }
std::string name() const { return satSolvable().name(); }
Edition edition() const { return satSolvable().edition(); }
{ return lhs < rhs.satSolvable(); }
/** \relates SolvableType Test whether the \ref Solvable is of a certain \ref ResKind. */
- template<class _Res, class Derived>
+ template<class TRes, class Derived>
inline bool isKind( const SolvableType<Derived> & solvable_r )
- { return isKind<_Res>( solvable_r.satSolvable() ); }
+ { return isKind<TRes>( solvable_r.satSolvable() ); }
/** \relates SolvableType Test for same content. */
template <class LDerived, class RDerived>
\---------------------------------------------------------------------*/
/** \file zypp/sat/Transaction.h
*/
-extern "C"
-{
- struct _Transaction;
-}
#ifndef ZYPP_SAT_TRANSACTION_H
#define ZYPP_SAT_TRANSACTION_H
WhatObsoletes( const ResObject_constPtr item_r );
/** Ctor from a range of \ref Solvable, \ref PoolItem or \ref ResObject::constPtr. */
- template <class _Iterator>
- WhatObsoletes( _Iterator begin, _Iterator end )
+ template <class TIterator>
+ WhatObsoletes( TIterator begin, TIterator end )
: _begin( 0 )
{
for_( it, begin, end )
/////////////////////////////////////////////////////////////////
- static void logSat( struct _Pool *, void *data, int type, const char *logString )
+ static void logSat( CPool *, void *data, int type, const char *logString )
{
if ( type & (SOLV_FATAL|SOLV_ERROR) ) {
- _ERR("libsolv") << logString;
+ L_ERR("libsolv") << logString;
} else if ( type & SOLV_DEBUG_STATS ) {
- _DBG("libsolv") << logString;
+ L_DBG("libsolv") << logString;
} else {
- _MIL("libsolv") << logString;
+ L_MIL("libsolv") << logString;
}
}
- detail::IdType PoolImpl::nsCallback( struct _Pool *, void * data, detail::IdType lhs, detail::IdType rhs )
+ detail::IdType PoolImpl::nsCallback( CPool *, void * data, detail::IdType lhs, detail::IdType rhs )
{
// lhs: the namespace identifier, e.g. NAMESPACE:MODALIAS
// rhs: the value, e.g. pci:v0000104Cd0000840[01]sv*sd*bc*sc*i*
///////////////////////////////////////////////////////////////////
- ::_Repo * PoolImpl::_createRepo( const std::string & name_r )
+ CRepo * PoolImpl::_createRepo( const std::string & name_r )
{
setDirty(__FUNCTION__, name_r.c_str() );
- ::_Repo * ret = ::repo_create( _pool, name_r.c_str() );
+ CRepo * ret = ::repo_create( _pool, name_r.c_str() );
if ( ret && name_r == systemRepoAlias() )
::pool_set_installed( _pool, ret );
return ret;
}
- void PoolImpl::_deleteRepo( ::_Repo * repo_r )
+ void PoolImpl::_deleteRepo( CRepo * repo_r )
{
setDirty(__FUNCTION__, repo_r->name );
if ( isSystemRepo( repo_r ) )
::repo_free( repo_r, /*reuseids*/false );
}
- int PoolImpl::_addSolv( ::_Repo * repo_r, FILE * file_r )
+ int PoolImpl::_addSolv( CRepo * repo_r, FILE * file_r )
{
setDirty(__FUNCTION__, repo_r->name );
int ret = ::repo_add_solv( repo_r, file_r, 0 );
return ret;
}
- int PoolImpl::_addHelix( ::_Repo * repo_r, FILE * file_r )
+ int PoolImpl::_addHelix( CRepo * repo_r, FILE * file_r )
{
setDirty(__FUNCTION__, repo_r->name );
int ret = ::repo_add_helix( repo_r, file_r, 0 );
return 0;
}
- void PoolImpl::_postRepoAdd( ::_Repo * repo_r )
+ void PoolImpl::_postRepoAdd( CRepo * repo_r )
{
if ( ! isSystemRepo( repo_r ) )
{
unsigned blockSize = 0;
for ( detail::IdType i = repo_r->start; i < repo_r->end; ++i )
{
- ::_Solvable * s( _pool->solvables + i );
+ CSolvable * s( _pool->solvables + i );
if ( s->repo == repo_r && sysids.find( s->arch ) == sysids.end() )
{
// Remember an unwanted arch entry:
}
}
- detail::SolvableIdType PoolImpl::_addSolvables( ::_Repo * repo_r, unsigned count_r )
+ detail::SolvableIdType PoolImpl::_addSolvables( CRepo * repo_r, unsigned count_r )
{
setDirty(__FUNCTION__, repo_r->name );
return ::repo_add_solvable_block( repo_r, count_r );
void PoolImpl::setRepoInfo( RepoIdType id_r, const RepoInfo & info_r )
{
- ::_Repo * repo( getRepo( id_r ) );
+ CRepo * repo( getRepo( id_r ) );
if ( repo )
{
bool dirty = false;
~PoolImpl();
/** Pointer style access forwarded to sat-pool. */
- ::_Pool * operator->()
+ CPool * operator->()
{ return _pool; }
public:
void depSetDirty( const char * a1 = 0, const char * a2 = 0, const char * a3 = 0 );
/** Callback to resolve namespace dependencies (language, modalias, filesystem, etc.). */
- static detail::IdType nsCallback( ::_Pool *, void * data, detail::IdType lhs, detail::IdType rhs );
+ static detail::IdType nsCallback( CPool *, void * data, detail::IdType lhs, detail::IdType rhs );
public:
/** Reserved system repository alias \c @System. */
static const std::string & systemRepoAlias();
- bool isSystemRepo( ::_Repo * repo_r ) const
+ bool isSystemRepo( CRepo * repo_r ) const
{ return repo_r && _pool->installed == repo_r; }
- ::_Repo * systemRepo() const
+ CRepo * systemRepo() const
{ return _pool->installed; }
/** Get rootdir (for file conflicts check) */
*/
//@{
/** Creating a new repo named \a name_r. */
- ::_Repo * _createRepo( const std::string & name_r );
+ CRepo * _createRepo( const std::string & name_r );
/** Creating a new repo named \a name_r. */
- void _deleteRepo( ::_Repo * repo_r );
+ void _deleteRepo( CRepo * repo_r );
/** Adding solv file to a repo.
* Except for \c isSystemRepo_r, solvables of incompatible architecture
* are filtered out.
*/
- int _addSolv( ::_Repo * repo_r, FILE * file_r );
+ int _addSolv( CRepo * repo_r, FILE * file_r );
/** Adding helix file to a repo.
* Except for \c isSystemRepo_r, solvables of incompatible architecture
* are filtered out.
*/
- int _addHelix( ::_Repo * repo_r, FILE * file_r );
+ int _addHelix( CRepo * repo_r, FILE * file_r );
/** Adding Solvables to a repo. */
- detail::SolvableIdType _addSolvables( ::_Repo * repo_r, unsigned count_r );
+ detail::SolvableIdType _addSolvables( CRepo * repo_r, unsigned count_r );
//@}
/** Helper postprocessing the repo after adding solv or helix files. */
- void _postRepoAdd( ::_Repo * repo_r );
+ void _postRepoAdd( CRepo * repo_r );
public:
/** a \c valid \ref Solvable has a non NULL repo pointer. */
- bool validSolvable( const ::_Solvable & slv_r ) const
+ bool validSolvable( const CSolvable & slv_r ) const
{ return slv_r.repo; }
/** \overload Check also for id_r being in range of _pool->solvables. */
bool validSolvable( SolvableIdType id_r ) const
{ return id_r < unsigned(_pool->nsolvables) && validSolvable( _pool->solvables[id_r] ); }
/** \overload Check also for slv_r being in range of _pool->solvables. */
- bool validSolvable( const ::_Solvable * slv_r ) const
+ bool validSolvable( const CSolvable * slv_r ) const
{ return _pool->solvables <= slv_r && slv_r <= _pool->solvables+_pool->nsolvables && validSolvable( *slv_r ); }
public:
- ::_Pool * getPool() const
+ CPool * getPool() const
{ return _pool; }
/** \todo a quick check whether the repo was meanwhile deleted. */
- ::_Repo * getRepo( RepoIdType id_r ) const
+ CRepo * getRepo( RepoIdType id_r ) const
{ return id_r; }
/** Return pointer to the sat-solvable or NULL if it is not valid.
* \see \ref validSolvable.
*/
- ::_Solvable * getSolvable( SolvableIdType id_r ) const
+ CSolvable * getSolvable( SolvableIdType id_r ) const
{
if ( validSolvable( id_r ) )
return &_pool->solvables[id_r];
private:
/** sat-pool. */
- ::_Pool * _pool;
+ CPool * _pool;
/** Serial number. */
SerialNumber _serial;
/** Watch serial number. */
extern "C"
{
-struct _Solvable;
-struct _Repo;
-struct _Pool;
+ // Those _Type names are exposed as sat::detail::CType below!
+ struct _Dataiterator;
+ struct _Datamatcher;
+ struct _Map;
+ struct _Pool;
+ struct _Queue;
+ struct _Repo;
+ struct _Solvable;
+ struct _Solver;
+ struct _Transaction;
}
///////////////////////////////////////////////////////////////////
namespace sat
{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace detail
+ {
+ typedef ::_Dataiterator CDataiterator; ///< Wrapped libsolv C data type exposed as backdoor
+ typedef ::_Datamatcher CDatamatcher; ///< Wrapped libsolv C data type exposed as backdoor
+ typedef ::_Map CMap; ///< Wrapped libsolv C data type exposed as backdoor
+ typedef ::_Pool CPool; ///< Wrapped libsolv C data type exposed as backdoor
+ typedef ::_Queue CQueue; ///< Wrapped libsolv C data type exposed as backdoor
+ typedef ::_Repo CRepo; ///< Wrapped libsolv C data type exposed as backdoor
+ typedef ::_Solvable CSolvable; ///< Wrapped libsolv C data type exposed as backdoor
+ typedef ::_Solver CSolver; ///< Wrapped libsolv C data type exposed as backdoor
+ typedef ::_Transaction CTransaction; ///< Wrapped libsolv C data type exposed as backdoor
+ } // namespace detail
+ ///////////////////////////////////////////////////////////////////
+
class Pool;
class Solvable;
#include "zypp/sat/detail/PoolImpl.h"
-#define _XDEBUG(x) do { if (base::logger::isExcessive()) XXX << x << std::endl;} while (0)
+#define XDEBUG(x) do { if (base::logger::isExcessive()) XXX << x << std::endl;} while (0)
/////////////////////////////////////////////////////////////////////////
namespace zypp
// Callbacks for SAT policies
//---------------------------------------------------------------------------
-int vendorCheck( Pool *pool, Solvable *solvable1, Solvable *solvable2 )
+int vendorCheck( sat::detail::CPool *pool, Solvable *solvable1, Solvable *solvable2 )
{
return VendorAttr::instance().equivalent( IdString(solvable1->vendor),
IdString(solvable2->vendor) ) ? 0 : 1;
SATResolver::dumpOn( std::ostream & os ) const
{
os << "<resolver>" << endl;
- if (_solv) {
-#define OUTS(X) os << " " << #X << "\t= " << solver_get_flag(_solv, SOLVER_FLAG_##X) << endl
+ if (_satSolver) {
+#define OUTS(X) os << " " << #X << "\t= " << solver_get_flag(_satSolver, SOLVER_FLAG_##X) << endl
OUTS( ALLOW_DOWNGRADE );
OUTS( ALLOW_ARCHCHANGE );
OUTS( ALLOW_VENDORCHANGE );
//---------------------------------------------------------------------------
-SATResolver::SATResolver (const ResPool & pool, Pool *SATPool)
- : _pool (pool)
- , _SATPool (SATPool)
- , _solv(NULL)
+SATResolver::SATResolver (const ResPool & pool, sat::detail::CPool *satPool)
+ : _pool(pool)
+ , _satPool(satPool)
+ , _satSolver(NULL)
, _fixsystem(false)
, _allowdowngrade(false)
, _allowarchchange(false)
return _pool;
}
-void
-SATResolver::resetItemTransaction (PoolItem item)
-{
- bool found = false;
- for (PoolItemList::const_iterator iter = _items_to_remove.begin();
- iter != _items_to_remove.end(); ++iter) {
- if (*iter == item) {
- _items_to_remove.remove(*iter);
- found = true;
- break;
- }
- }
- if (!found) {
- for (PoolItemList::const_iterator iter = _items_to_install.begin();
- iter != _items_to_install.end(); ++iter) {
- if (*iter == item) {
- _items_to_install.remove(*iter);
- found = true;
- break;
- }
- }
- }
- if (!found) {
- for (PoolItemList::const_iterator iter = _items_to_keep.begin();
- iter != _items_to_keep.end(); ++iter) {
- if (*iter == item) {
- _items_to_keep.remove(*iter);
- found = true;
- break;
- }
- }
- }
- if (!found) {
- for (PoolItemList::const_iterator iter = _items_to_lock.begin();
- iter != _items_to_lock.end(); ++iter) {
- if (*iter == item) {
- _items_to_lock.remove(*iter);
- found = true;
- break;
- }
- }
- }
-}
-
-
-void
-SATResolver::addPoolItemToInstall (PoolItem item)
-{
- resetItemTransaction (item);
- _items_to_install.push_back (item);
- _items_to_install.unique ();
-}
-
-
-void
-SATResolver::addPoolItemsToInstallFromList (PoolItemList & rl)
-{
- for (PoolItemList::const_iterator iter = rl.begin(); iter != rl.end(); iter++) {
- addPoolItemToInstall (*iter);
- }
-}
-
-
-void
-SATResolver::addPoolItemToRemove (PoolItem item)
-{
- resetItemTransaction (item);
- _items_to_remove.push_back (item);
- _items_to_remove.unique ();
-}
-
-
-void
-SATResolver::addPoolItemsToRemoveFromList (PoolItemList & rl)
-{
- for (PoolItemList::const_iterator iter = rl.begin(); iter != rl.end(); iter++) {
- addPoolItemToRemove (*iter);
- }
-}
-
-void
-SATResolver::addPoolItemToLock (PoolItem item)
-{
- resetItemTransaction (item);
- _items_to_lock.push_back (item);
- _items_to_lock.unique ();
-}
-
-void
-SATResolver::addPoolItemToKeep (PoolItem item)
-{
- resetItemTransaction (item);
- _items_to_keep.push_back (item);
- _items_to_keep.unique ();
-}
-
//---------------------------------------------------------------------------
// copy marked item from solution back to pool
// installation/deletion
if (status.isToBeInstalled()) {
r = item.status().setToBeInstalled (causer);
- _XDEBUG("SATSolutionToPool install returns " << item << ", " << r);
+ XDEBUG("SATSolutionToPool install returns " << item << ", " << r);
}
else if (status.isToBeUninstalledDueToUpgrade()) {
r = item.status().setToBeUninstalledDueToUpgrade (causer);
- _XDEBUG("SATSolutionToPool upgrade returns " << item << ", " << r);
+ XDEBUG("SATSolutionToPool upgrade returns " << item << ", " << r);
}
else if (status.isToBeUninstalled()) {
r = item.status().setToBeUninstalled (causer);
- _XDEBUG("SATSolutionToPool remove returns " << item << ", " << r);
+ XDEBUG("SATSolutionToPool remove returns " << item << ", " << r);
}
return;
// resolvePool
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
-
-//----------------------------------------------------------------------------
-// Helper functions for the ZYPP-Pool
-//----------------------------------------------------------------------------
-
-
-//------------------------------------------------------------------------------------------------------------
-// This function loops over the pool and grabs all items
-// It clears all previous bySolver() states also
-//
-// Every toBeInstalled is passed to zypp::solver:detail::Resolver.addPoolItemToInstall()
-// Every toBeUninstalled is passed to zypp::solver:detail::Resolver.addPoolItemToRemove()
-//
-// Solver results must be written back to the pool.
-//------------------------------------------------------------------------------------------------------------
-
-
+/////////////////////////////////////////////////////////////////////////
+/// \class SATCollectTransact
+/// \brief Commit helper functor distributing PoolItem by status into lists
+///
+/// On the fly it clears all PoolItem bySolver/ByApplLow status.
+/// The lists are cleared in the Ctor, populated by \ref operator().
+/////////////////////////////////////////////////////////////////////////
struct SATCollectTransact : public resfilter::PoolItemFilterFunctor
{
- SATResolver & resolver;
+ SATCollectTransact( PoolItemList & items_to_install_r,
+ PoolItemList & items_to_remove_r,
+ PoolItemList & items_to_lock_r,
+ PoolItemList & items_to_keep_r,
+ bool solveSrcPackages_r )
+ : _items_to_install( items_to_install_r )
+ , _items_to_remove( items_to_remove_r )
+ , _items_to_lock( items_to_lock_r )
+ , _items_to_keep( items_to_keep_r )
+ , _solveSrcPackages( solveSrcPackages_r )
+ {
+ _items_to_install.clear();
+ _items_to_remove.clear();
+ _items_to_lock.clear();
+ _items_to_keep.clear();
+ }
- SATCollectTransact (SATResolver & r)
- : resolver (r)
- { }
+ bool operator()( const PoolItem & item_r )
+ {
+
+ ResStatus & itemStatus( item_r.status() );
+ bool by_solver = ( itemStatus.isBySolver() || itemStatus.isByApplLow() );
- bool operator()( PoolItem item ) // only transacts() items go here
+ if ( by_solver )
{
- ResStatus status = item.status();
- bool by_solver = (status.isBySolver() || status.isByApplLow());
+ // Clear former solver/establish resultd
+ itemStatus.resetTransact( ResStatus::APPL_LOW );
+ return true; // -> back out here, don't re-queue former results
+ }
- if (by_solver) {
- item.status().resetTransact( ResStatus::APPL_LOW );// clear any solver/establish transactions
- return true; // back out here, dont re-queue former solver result
- }
+ if ( !_solveSrcPackages && item_r.isKind<SrcPackage>() )
+ {
+ // Later we may continue on a per source package base.
+ return true; // dont process this source package.
+ }
- if ( item.satSolvable().isKind<SrcPackage>() && ! resolver.solveSrcPackages() )
- {
- // Later we may continue on a per source package base.
- return true; // dont process this source package.
- }
+ switch ( itemStatus.getTransactValue() )
+ {
+ case ResStatus::TRANSACT:
+ itemStatus.isUninstalled() ? _items_to_install.push_back( item_r )
+ : _items_to_remove.push_back( item_r ); break;
+ case ResStatus::LOCKED: _items_to_lock.push_back( item_r ); break;
+ case ResStatus::KEEP_STATE: _items_to_keep.push_back( item_r ); break;
+ }
+ return true;
+ }
- if (status.isToBeInstalled()) {
- resolver.addPoolItemToInstall(item); // -> install!
- }
- else if (status.isToBeUninstalled()) {
- resolver.addPoolItemToRemove(item); // -> remove !
- }
- else if (status.isLocked()
- && !by_solver) {
- resolver.addPoolItemToLock (item);
- }
- else if (status.isKept()
- && !by_solver) {
- resolver.addPoolItemToKeep (item);
- }
+private:
+ PoolItemList & _items_to_install;
+ PoolItemList & _items_to_remove;
+ PoolItemList & _items_to_lock;
+ PoolItemList & _items_to_keep;
+ bool _solveSrcPackages;
- return true;
- }
};
+/////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------
SATResolver::solving(const CapabilitySet & requires_caps,
const CapabilitySet & conflict_caps)
{
- _solv = solver_create( _SATPool );
- ::pool_set_custom_vendorcheck( _SATPool, &vendorCheck );
+ _satSolver = solver_create( _satPool );
+ ::pool_set_custom_vendorcheck( _satPool, &vendorCheck );
if (_fixsystem) {
queue_push( &(_jobQueue), SOLVER_VERIFY|SOLVER_SOLVABLE_ALL);
queue_push( &(_jobQueue), 0 );
queue_push( &(_jobQueue), SOLVER_DROP_ORPHANED|SOLVER_SOLVABLE_ALL);
queue_push( &(_jobQueue), 0 );
}
- solver_set_flag(_solv, SOLVER_FLAG_ADD_ALREADY_RECOMMENDED, !_ignorealreadyrecommended);
- solver_set_flag(_solv, SOLVER_FLAG_ALLOW_DOWNGRADE, _allowdowngrade);
- solver_set_flag(_solv, SOLVER_FLAG_ALLOW_UNINSTALL, _allowuninstall);
- solver_set_flag(_solv, SOLVER_FLAG_ALLOW_ARCHCHANGE, _allowarchchange);
- solver_set_flag(_solv, SOLVER_FLAG_ALLOW_VENDORCHANGE, _allowvendorchange);
- solver_set_flag(_solv, SOLVER_FLAG_SPLITPROVIDES, _dosplitprovides);
- solver_set_flag(_solv, SOLVER_FLAG_NO_UPDATEPROVIDE, _noupdateprovide);
- solver_set_flag(_solv, SOLVER_FLAG_IGNORE_RECOMMENDED, _onlyRequires);
- solver_set_flag(_solv, SOLVER_FLAG_DUP_ALLOW_DOWNGRADE, _dup_allowdowngrade );
- solver_set_flag(_solv, SOLVER_FLAG_DUP_ALLOW_NAMECHANGE, _dup_allownamechange );
- solver_set_flag(_solv, SOLVER_FLAG_DUP_ALLOW_ARCHCHANGE, _dup_allowarchchange );
- solver_set_flag(_solv, SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE, _dup_allowvendorchange );
+ solver_set_flag(_satSolver, SOLVER_FLAG_ADD_ALREADY_RECOMMENDED, !_ignorealreadyrecommended);
+ solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_DOWNGRADE, _allowdowngrade);
+ solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_UNINSTALL, _allowuninstall);
+ solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_ARCHCHANGE, _allowarchchange);
+ solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_VENDORCHANGE, _allowvendorchange);
+ solver_set_flag(_satSolver, SOLVER_FLAG_SPLITPROVIDES, _dosplitprovides);
+ solver_set_flag(_satSolver, SOLVER_FLAG_NO_UPDATEPROVIDE, _noupdateprovide);
+ solver_set_flag(_satSolver, SOLVER_FLAG_IGNORE_RECOMMENDED, _onlyRequires);
+ solver_set_flag(_satSolver, SOLVER_FLAG_DUP_ALLOW_DOWNGRADE, _dup_allowdowngrade );
+ solver_set_flag(_satSolver, SOLVER_FLAG_DUP_ALLOW_NAMECHANGE, _dup_allownamechange );
+ solver_set_flag(_satSolver, SOLVER_FLAG_DUP_ALLOW_ARCHCHANGE, _dup_allowarchchange );
+ solver_set_flag(_satSolver, SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE, _dup_allowvendorchange );
#if 1
-#define HACKENV(X,D) solver_set_flag(_solv, X, env::HACKENV( #X, D ) );
+#define HACKENV(X,D) solver_set_flag(_satSolver, X, env::HACKENV( #X, D ) );
HACKENV( SOLVER_FLAG_DUP_ALLOW_DOWNGRADE, _dup_allowdowngrade );
HACKENV( SOLVER_FLAG_DUP_ALLOW_NAMECHANGE, _dup_allownamechange );
HACKENV( SOLVER_FLAG_DUP_ALLOW_ARCHCHANGE, _dup_allowarchchange );
// Solve !
MIL << "Starting solving...." << endl;
MIL << *this;
- solver_solve( _solv, &(_jobQueue) );
+ solver_solve( _satSolver, &(_jobQueue) );
MIL << "....Solver end" << endl;
// copying solution back to zypp pool
/* solvables to be installed */
Queue decisionq;
queue_init(&decisionq);
- solver_get_decisionqueue(_solv, &decisionq);
+ solver_get_decisionqueue(_satSolver, &decisionq);
for ( int i = 0; i < decisionq.count; ++i )
{
sat::Solvable slv( decisionq.elements[i] );
PoolItem poolItem( slv );
SATSolutionToPool (poolItem, ResStatus::toBeInstalled, ResStatus::SOLVER);
- _result_items_to_install.push_back (poolItem);
+ _result_items_to_install.push_back( poolItem );
}
queue_free(&decisionq);
bool mustCheckObsoletes = false;
for_( it, systemRepo.solvablesBegin(), systemRepo.solvablesEnd() )
{
- if (solver_get_decisionlevel(_solv, it->id()) > 0)
+ if (solver_get_decisionlevel(_satSolver, it->id()) > 0)
continue;
// Check if this is an update
queue_init(&suggestions);
queue_init(&orphaned);
queue_init(&unneeded);
- solver_get_recommendations(_solv, &recommendations, &suggestions, 0);
- solver_get_orphaned(_solv, &orphaned);
- solver_get_unneeded(_solv, &unneeded, 1);
+ solver_get_recommendations(_satSolver, &recommendations, &suggestions, 0);
+ solver_get_orphaned(_satSolver, &orphaned);
+ solver_get_unneeded(_satSolver, &unneeded, 1);
/* solvables which are recommended */
for ( int i = 0; i < recommendations.count; ++i )
{
invokeOnEach( _pool.begin(),
_pool.end(),
functor::functorRef<bool,PoolItem> (collectPseudoInstalled) );
- solver_trivial_installable(_solv, &solvableQueue, &flags );
+ solver_trivial_installable(_satSolver, &solvableQueue, &flags );
for (int i = 0; i < solvableQueue.count; i++) {
PoolItem item = _pool.find (sat::Solvable(solvableQueue.elements[i]));
item.status().setUndetermined();
if (flags.elements[i] == -1) {
item.status().setNonRelevant();
- _XDEBUG("SATSolutionToPool(" << item << " ) nonRelevant !");
+ XDEBUG("SATSolutionToPool(" << item << " ) nonRelevant !");
} else if (flags.elements[i] == 1) {
item.status().setSatisfied();
- _XDEBUG("SATSolutionToPool(" << item << " ) satisfied !");
+ XDEBUG("SATSolutionToPool(" << item << " ) satisfied !");
} else if (flags.elements[i] == 0) {
item.status().setBroken();
- _XDEBUG("SATSolutionToPool(" << item << " ) broken !");
+ XDEBUG("SATSolutionToPool(" << item << " ) broken !");
}
}
queue_free(&(solvableQueue));
}
}
- if (solver_problem_count(_solv) > 0 )
+ if (solver_problem_count(_satSolver) > 0 )
{
ERR << "Solverrun finished with an ERROR" << endl;
return false;
void
SATResolver::solverInit(const PoolItemList & weakItems)
{
- SATCollectTransact info (*this);
MIL << "SATResolver::solverInit()" << endl;
// remove old stuff
solverEnd();
-
queue_init( &_jobQueue );
- _items_to_install.clear();
- _items_to_remove.clear();
- _items_to_lock.clear();
- _items_to_keep.clear();
- invokeOnEach ( _pool.begin(), _pool.end(),
- functor::functorRef<bool,PoolItem>(info) );
+ // clear and rebuild: _items_to_install, _items_to_remove, _items_to_lock, _items_to_keep
+ {
+ SATCollectTransact collector( _items_to_install, _items_to_remove, _items_to_lock, _items_to_keep, solveSrcPackages() );
+ invokeOnEach ( _pool.begin(), _pool.end(), functor::functorRef<bool,PoolItem>( collector ) );
+ }
for (PoolItemList::const_iterator iter = weakItems.begin(); iter != weakItems.end(); iter++) {
Id id = (*iter)->satSolvable().id();
queue_push( &(_jobQueue), solv.id() );
}
- ::pool_add_userinstalled_jobs(_SATPool, sat::Pool::instance().autoInstalled(), &(_jobQueue), GET_USERINSTALLED_NAMES|GET_USERINSTALLED_INVERTED);
+ ::pool_add_userinstalled_jobs(_satPool, sat::Pool::instance().autoInstalled(), &(_jobQueue), GET_USERINSTALLED_NAMES|GET_USERINSTALLED_INVERTED);
if ( _distupgrade )
{
SATResolver::solverEnd()
{
// cleanup
- if ( _solv )
+ if ( _satSolver )
{
- solver_free(_solv);
- _solv = NULL;
+ solver_free(_satSolver);
+ _satSolver = NULL;
queue_free( &(_jobQueue) );
}
}
// set locks for the solver
setLocks();
- _solv = solver_create( _SATPool );
- ::pool_set_custom_vendorcheck( _SATPool, &vendorCheck );
+ _satSolver = solver_create( _satPool );
+ ::pool_set_custom_vendorcheck( _satPool, &vendorCheck );
if (_fixsystem) {
queue_push( &(_jobQueue), SOLVER_VERIFY|SOLVER_SOLVABLE_ALL);
queue_push( &(_jobQueue), 0 );
queue_push( &(_jobQueue), SOLVER_DROP_ORPHANED|SOLVER_SOLVABLE_ALL);
queue_push( &(_jobQueue), 0 );
}
- solver_set_flag(_solv, SOLVER_FLAG_ADD_ALREADY_RECOMMENDED, !_ignorealreadyrecommended);
- solver_set_flag(_solv, SOLVER_FLAG_ALLOW_DOWNGRADE, _allowdowngrade);
- solver_set_flag(_solv, SOLVER_FLAG_ALLOW_UNINSTALL, _allowuninstall);
- solver_set_flag(_solv, SOLVER_FLAG_ALLOW_ARCHCHANGE, _allowarchchange);
- solver_set_flag(_solv, SOLVER_FLAG_ALLOW_VENDORCHANGE, _allowvendorchange);
- solver_set_flag(_solv, SOLVER_FLAG_SPLITPROVIDES, _dosplitprovides);
- solver_set_flag(_solv, SOLVER_FLAG_NO_UPDATEPROVIDE, _noupdateprovide);
- solver_set_flag(_solv, SOLVER_FLAG_IGNORE_RECOMMENDED, _onlyRequires);
+ solver_set_flag(_satSolver, SOLVER_FLAG_ADD_ALREADY_RECOMMENDED, !_ignorealreadyrecommended);
+ solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_DOWNGRADE, _allowdowngrade);
+ solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_UNINSTALL, _allowuninstall);
+ solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_ARCHCHANGE, _allowarchchange);
+ solver_set_flag(_satSolver, SOLVER_FLAG_ALLOW_VENDORCHANGE, _allowvendorchange);
+ solver_set_flag(_satSolver, SOLVER_FLAG_SPLITPROVIDES, _dosplitprovides);
+ solver_set_flag(_satSolver, SOLVER_FLAG_NO_UPDATEPROVIDE, _noupdateprovide);
+ solver_set_flag(_satSolver, SOLVER_FLAG_IGNORE_RECOMMENDED, _onlyRequires);
sat::Pool::instance().prepareForSolving();
// Solve !
MIL << "Starting solving for update...." << endl;
MIL << *this;
- solver_solve( _solv, &(_jobQueue) );
+ solver_solve( _satSolver, &(_jobQueue) );
MIL << "....Solver end" << endl;
// copying solution back to zypp pool
/* solvables to be installed */
Queue decisionq;
queue_init(&decisionq);
- solver_get_decisionqueue(_solv, &decisionq);
+ solver_get_decisionqueue(_satSolver, &decisionq);
for (int i = 0; i < decisionq.count; i++)
{
Id p;
p = decisionq.elements[i];
if (p < 0 || !sat::Solvable(p))
continue;
- if (sat::Solvable(p).repository().get() == _solv->pool->installed)
+ if (sat::Solvable(p).repository().get() == _satSolver->pool->installed)
continue;
PoolItem poolItem = _pool.find (sat::Solvable(p));
queue_free(&decisionq);
/* solvables to be erased */
- for (int i = _solv->pool->installed->start; i < _solv->pool->installed->start + _solv->pool->installed->nsolvables; i++)
+ for (int i = _satSolver->pool->installed->start; i < _satSolver->pool->installed->start + _satSolver->pool->installed->nsolvables; i++)
{
- if (solver_get_decisionlevel(_solv, i) > 0)
+ if (solver_get_decisionlevel(_satSolver, i) > 0)
continue;
PoolItem poolItem( _pool.find( sat::Solvable(i) ) );
string SATResolver::SATprobleminfoString(Id problem, string &detail, Id &ignoreId)
{
string ret;
- Pool *pool = _solv->pool;
+ sat::detail::CPool *pool = _satSolver->pool;
Id probr;
Id dep, source, target;
sat::Solvable s, s2;
// FIXME: solver_findallproblemrules to get all rules for this problem
// (the 'most relevabt' one returned by solver_findproblemrule is embedded
- probr = solver_findproblemrule(_solv, problem);
- switch (solver_ruleinfo(_solv, probr, &source, &target, &dep))
+ probr = solver_findproblemrule(_satSolver, problem);
+ switch (solver_ruleinfo(_satSolver, probr, &source, &target, &dep))
{
case SOLVER_RULE_DISTUPGRADE:
s = mapSolvable (source);
SATResolver::problems ()
{
ResolverProblemList resolverProblems;
- if (_solv && solver_problem_count(_solv)) {
- Pool *pool = _solv->pool;
+ if (_satSolver && solver_problem_count(_satSolver)) {
+ sat::detail::CPool *pool = _satSolver->pool;
int pcnt;
Id p, rp, what;
Id problem, solution, element;
MIL << "Encountered problems! Here are the solutions:\n" << endl;
pcnt = 1;
problem = 0;
- while ((problem = solver_next_problem(_solv, problem)) != 0) {
+ while ((problem = solver_next_problem(_satSolver, problem)) != 0) {
MIL << "Problem " << pcnt++ << ":" << endl;
MIL << "====================================" << endl;
string detail;
ResolverProblem_Ptr resolverProblem = new ResolverProblem (whatString, detail);
solution = 0;
- while ((solution = solver_next_solution(_solv, problem, solution)) != 0) {
+ while ((solution = solver_next_solution(_satSolver, problem, solution)) != 0) {
element = 0;
ProblemSolutionCombi *problemSolution = new ProblemSolutionCombi;
- while ((element = solver_next_solutionelement(_solv, problem, solution, element, &p, &rp)) != 0) {
+ while ((element = solver_next_solutionelement(_satSolver, problem, solution, element, &p, &rp)) != 0) {
if (p == SOLVER_SOLUTION_JOB) {
/* job, rp is index into job queue */
what = _jobQueue.elements[rp];
PoolItem itemTo = _pool.find (sd);
if (itemFrom && itemTo) {
problemSolution->addSingleAction (itemTo, INSTALL);
- int illegal = policy_is_illegal(_solv, s.get(), sd.get(), 0);
+ int illegal = policy_is_illegal(_satSolver, s.get(), sd.get(), 0);
if ((illegal & POLICY_ILLEGAL_DOWNGRADE) != 0)
{
sat::StringQueue SATResolver::autoInstalled() const
{
sat::StringQueue ret;
- if ( _solv )
- ::solver_get_userinstalled( _solv, ret, GET_USERINSTALLED_NAMES|GET_USERINSTALLED_INVERTED );
+ if ( _satSolver )
+ ::solver_get_userinstalled( _satSolver, ret, GET_USERINSTALLED_NAMES|GET_USERINSTALLED_INVERTED );
return ret;
}
sat::StringQueue SATResolver::userInstalled() const
{
sat::StringQueue ret;
- if ( _solv )
- ::solver_get_userinstalled( _solv, ret, GET_USERINSTALLED_NAMES );
+ if ( _satSolver )
+ ::solver_get_userinstalled( _satSolver, ret, GET_USERINSTALLED_NAMES );
return ret;
}
private:
ResPool _pool;
- Pool *_SATPool;
- Solver *_solv;
- Queue _jobQueue;
+ sat::detail::CPool *_satPool;
+ sat::detail::CSolver *_satSolver;
+ sat::detail::CQueue _jobQueue;
// list of problematic items (orphaned)
PoolItemList _problem_items;
public:
- SATResolver (const ResPool & pool, Pool *SATPool);
+ SATResolver (const ResPool & pool, sat::detail::CPool *satPool);
virtual ~SATResolver();
// ---------------------------------- I/O
ResolverProblemList problems ();
void applySolutions (const ProblemSolutionList &solutions);
- void addPoolItemToInstall (PoolItem item);
- void addPoolItemsToInstallFromList (PoolItemList & rl);
-
- void addPoolItemToLock (PoolItem item);
- void addPoolItemToKeep (PoolItem item);
-
- void addPoolItemToRemove (PoolItem item);
- void addPoolItemsToRemoveFromList (PoolItemList & rl);
-
bool fixsystem () const {return _fixsystem;}
void setFixsystem ( const bool fixsystem) { _fixsystem = fixsystem;}
void setCleandepsOnRemove( bool state_r ) { _cleandepsOnRemove = state_r; }
PoolItemList problematicUpdateItems( void ) const { return _problem_items; }
+ PoolItemList problematicUpdateItems() { return _problem_items; }
PoolItemList resultItemsToInstall () { return _result_items_to_install; }
PoolItemList resultItemsToRemove () { return _result_items_to_remove; }
- PoolItemList problematicUpdateItems() { return _problem_items; }
sat::StringQueue autoInstalled() const;
sat::StringQueue userInstalled() const;
#include "zypp/base/PtrTypes.h"
#include "zypp/ResPool.h"
-extern "C" {
- struct _Queue;
-}
-
/////////////////////////////////////////////////////////////////////////
namespace zypp
{ ///////////////////////////////////////////////////////////////////////
virtual SolverQueueItem_Ptr copy (void) const = 0;
- virtual bool addRule (_Queue & q) =0 ;
+ virtual bool addRule (sat::detail::CQueue & q) =0 ;
virtual int cmp (SolverQueueItem_constPtr item) const = 0;
int compare (SolverQueueItem_constPtr item) const { return CMP(_type, item->_type); }
//---------------------------------------------------------------------------
-bool SolverQueueItemDelete::addRule (_Queue & q)
+bool SolverQueueItemDelete::addRule (sat::detail::CQueue & q)
{
#define MAYBE_CLEANDEPS (pool().resolver().cleandepsOnRemove()?SOLVER_CLEANDEPS:0)
// ---------------------------------- methods
- virtual bool addRule (_Queue & q);
+ virtual bool addRule (sat::detail::CQueue & q);
virtual SolverQueueItem_Ptr copy (void) const;
virtual int cmp (SolverQueueItem_constPtr item) const;
};
//---------------------------------------------------------------------------
-bool SolverQueueItemInstall::addRule (_Queue & q)
+bool SolverQueueItemInstall::addRule (sat::detail::CQueue & q)
{
::Id id = IdString(_name).id();
if (_soft) {
// ---------------------------------- methods
- virtual bool addRule (_Queue & q);
+ virtual bool addRule (sat::detail::CQueue & q);
virtual SolverQueueItem_Ptr copy (void) const;
virtual int cmp (SolverQueueItem_constPtr item) const;
};
//---------------------------------------------------------------------------
-bool SolverQueueItemInstallOneOf::addRule (_Queue & q)
+bool SolverQueueItemInstallOneOf::addRule (sat::detail::CQueue & q)
{
bool ret = true;
MIL << "Install one of " << (_soft ? "(soft):" : ":")<< endl;
// ---------------------------------- methods
- virtual bool addRule (_Queue & q);
+ virtual bool addRule (sat::detail::CQueue & q);
virtual SolverQueueItem_Ptr copy (void) const;
virtual int cmp (SolverQueueItem_constPtr item) const;
};
//---------------------------------------------------------------------------
-bool SolverQueueItemLock::addRule (_Queue & q)
+bool SolverQueueItemLock::addRule (sat::detail::CQueue & q)
{
::Id id = _item.satSolvable().id();
if (id == ID_NULL) {
// ---------------------------------- methods
- virtual bool addRule (_Queue & q);
+ virtual bool addRule (sat::detail::CQueue & q);
virtual SolverQueueItem_Ptr copy (void) const;
virtual int cmp (SolverQueueItem_constPtr item) const;
};
//---------------------------------------------------------------------------
-bool SolverQueueItemUpdate::addRule (_Queue & q)
+bool SolverQueueItemUpdate::addRule (sat::detail::CQueue & q)
{
::Id id = _item.satSolvable().id();
if (id == ID_NULL) {
// ---------------------------------- methods
- virtual bool addRule (_Queue & q);
+ virtual bool addRule (sat::detail::CQueue & q);
virtual SolverQueueItem_Ptr copy (void) const;
virtual int cmp (SolverQueueItem_constPtr item) const;
};
/** Download(commit) sequence of solvables to compute read ahead. */
void setCommitList( std::vector<sat::Solvable> commitList_r );
/** \overload */
- template <class _Iterator>
- void setCommitList( _Iterator begin_r, _Iterator end_r )
+ template <class TIterator>
+ void setCommitList( TIterator begin_r, TIterator end_r )
{ setCommitList( std::vector<sat::Solvable>( begin_r, end_r ) ); }
/** Provide a package. */
/** libsolv::pool_findfileconflicts callback providing package header. */
struct FileConflictsCB
{
- FileConflictsCB( ::_Pool * pool_r, ProgressData & progress_r )
+ FileConflictsCB( sat::detail::CPool * pool_r, ProgressData & progress_r )
: _progress( progress_r )
, _state( ::rpm_state_create( pool_r, ::pool_get_rootdir(pool_r) ), ::rpm_state_free )
{}
- void * operator()( ::_Pool * pool_r, sat::detail::IdType id_r )
+ void * operator()( sat::detail::CPool * pool_r, sat::detail::IdType id_r )
{
void * ret = lookup( id_r );
const sat::Queue & noFilelist() const
{ return _noFilelist; }
- static void * invoke( ::_Pool * pool_r, sat::detail::IdType id_r, void * cbdata_r )
+ static void * invoke( sat::detail::CPool * pool_r, sat::detail::IdType id_r, void * cbdata_r )
{ return (*reinterpret_cast<FileConflictsCB*>(cbdata_r))( pool_r, id_r ); }
private:
#include "zypp/ZYppFactory.h"
#include "zypp/ZConfig.h"
-using namespace std;
+using std::endl;
using namespace zypp::filesystem;
#define WARNINGMAILPATH "/var/log/YaST2/"
#else
const char* quoteInFilename_m = " \t\'\"";
#endif
-inline string rpmQuoteFilename( const Pathname & path_r )
+inline std::string rpmQuoteFilename( const Pathname & path_r )
{
- string path( path_r.asString() );
- for ( string::size_type pos = path.find_first_of( quoteInFilename_m );
- pos != string::npos;
+ std::string path( path_r.asString() );
+ for ( std::string::size_type pos = path.find_first_of( quoteInFilename_m );
+ pos != std::string::npos;
pos = path.find_first_of( quoteInFilename_m, pos ) )
{
path.insert( pos, "\\" );
static shared_ptr<KeyRingSignalReceiver> sKeyRingReceiver;
-unsigned diffFiles(const string file1, const string file2, string& out, int maxlines)
+unsigned diffFiles(const std::string file1, const std::string file2, std::string& out, int maxlines)
{
const char* argv[] =
{
//if(!prog)
//return 2;
- string line;
+ std::string line;
int count = 0;
for (line = prog.receiveLine(), count=0;
!line.empty();
**
**
** FUNCTION NAME : stringPath
- ** FUNCTION TYPE : inline string
+ ** FUNCTION TYPE : inline std::string
*/
-inline string stringPath( const Pathname & root_r, const Pathname & sub_r )
+inline std::string stringPath( const Pathname & root_r, const Pathname & sub_r )
{
return librpmDb::stringPath( root_r, sub_r );
}
**
**
** FUNCTION NAME : operator<<
- ** FUNCTION TYPE : ostream &
+ ** FUNCTION TYPE : std::ostream &
*/
-ostream & operator<<( ostream & str, const RpmDb::DbStateInfoBits & obj )
+std::ostream & operator<<( std::ostream & str, const RpmDb::DbStateInfoBits & obj )
{
if ( obj == RpmDb::DbSI_NO_INIT )
{
//
//
// METHOD NAME : RpmDb::dumpOn
-// METHOD TYPE : ostream &
+// METHOD TYPE : std::ostream &
//
-ostream & RpmDb::dumpOn( ostream & str ) const
+std::ostream & RpmDb::dumpOn( std::ostream & str ) const
{
str << "RpmDb[";
process?process->getpid():0) )
+ "Packages" );
- string line;
- string errmsg;
+ std::string line;
+ std::string errmsg;
while ( systemReadLine( line ) )
{
if ( rpm_status != 0 )
{
//TranslatorExplanation after semicolon is error message
- ZYPP_THROW(RpmSubprocessException(string(_("RPM failed: ") +
- (errmsg.empty() ? error_message: errmsg))));
+ ZYPP_THROW(RpmSubprocessException(std::string(_("RPM failed: ")) + (errmsg.empty() ? error_message: errmsg) ) );
}
else
{
TmpFile tmpfile( getZYpp()->tmpPath() );
{
- ofstream tmpos( tmpfile.path().c_str() );
+ std::ofstream tmpos( tmpfile.path().c_str() );
for_( it, rpmKeys.begin(), rpmKeys.end() )
{
// we export the rpm key into a file
RpmHeader::constPtr result;
- getData( string("gpg-pubkey"), *it, result );
+ getData( "gpg-pubkey", *it, result );
tmpos << result->tag_description() << endl;
}
}
// check if the key is already in the rpm database
Edition keyEd( pubkey_r.gpgPubkeyVersion(), pubkey_r.gpgPubkeyRelease() );
- set<Edition> rpmKeys = pubkeyEditions();
+ std::set<Edition> rpmKeys = pubkeyEditions();
bool hasOldkeys = false;
for_( it, rpmKeys.begin(), rpmKeys.end() )
// rpm3 database, if the current database is a temporary one.
run_rpm( opts, ExternalProgram::Stderr_To_Stdout );
- string line;
+ std::string line;
while ( systemReadLine( line ) )
{
( str::startsWith( line, "error:" ) ? WAR : DBG ) << line << endl;
// rpm3 database, if the current database is a temporary one.
run_rpm( opts, ExternalProgram::Stderr_To_Stdout );
- string line;
+ std::string line;
while ( systemReadLine( line ) )
{
( str::startsWith( line, "error:" ) ? WAR : DBG ) << line << endl;
// check if the key is in the rpm database and just
// return if it does not.
- set<Edition> rpm_keys = pubkeyEditions();
- set<Edition>::const_iterator found_edition = rpm_keys.end();
+ std::set<Edition> rpm_keys = pubkeyEditions();
+ std::set<Edition>::const_iterator found_edition = rpm_keys.end();
std::string pubkeyVersion( pubkey_r.gpgPubkeyVersion() );
for_( it, rpm_keys.begin(), rpm_keys.end() )
return;
}
- string rpm_name("gpg-pubkey-" + found_edition->asString());
+ std::string rpm_name("gpg-pubkey-" + found_edition->asString());
RpmArgVec opts;
opts.push_back ( "-e" );
// rpm3 database, if the current database is a temporary one.
run_rpm( opts, ExternalProgram::Stderr_To_Stdout );
- string line;
+ std::string line;
while ( systemReadLine( line ) )
{
if ( line.substr( 0, 6 ) == "error:" )
//
//
// METHOD NAME : RpmDb::pubkeys
-// METHOD TYPE : set<Edition>
+// METHOD TYPE : std::set<Edition>
//
-list<PublicKey> RpmDb::pubkeys() const
+std::list<PublicKey> RpmDb::pubkeys() const
{
- list<PublicKey> ret;
+ std::list<PublicKey> ret;
librpmDb::db_const_iterator it;
- for ( it.findByName( string( "gpg-pubkey" ) ); *it; ++it )
+ for ( it.findByName( "gpg-pubkey" ); *it; ++it )
{
Edition edition = it->tag_edition();
if (edition != Edition::noedition)
{
// we export the rpm key into a file
RpmHeader::constPtr result;
- getData( string("gpg-pubkey"), edition, result );
+ getData( "gpg-pubkey", edition, result );
TmpFile file(getZYpp()->tmpPath());
- ofstream os;
+ std::ofstream os;
try
{
os.open(file.path().asString().c_str());
PublicKey key(file);
ret.push_back(key);
}
- catch (exception &e)
+ catch ( std::exception & e )
{
ERR << "Could not dump key " << edition.asString() << " in tmp file " << file.path() << endl;
// just ignore the key
return ret;
}
-set<Edition> RpmDb::pubkeyEditions() const
+std::set<Edition> RpmDb::pubkeyEditions() const
{
- set<Edition> ret;
+ std::set<Edition> ret;
librpmDb::db_const_iterator it;
- for ( it.findByName( string( "gpg-pubkey" ) ); *it; ++it )
+ for ( it.findByName( "gpg-pubkey" ); *it; ++it )
{
Edition edition = it->tag_edition();
if (edition != Edition::noedition)
//
// DESCRIPTION :
//
-list<FileInfo>
-RpmDb::fileList( const string & name_r, const Edition & edition_r ) const
+std::list<FileInfo>
+RpmDb::fileList( const std::string & name_r, const Edition & edition_r ) const
{
- list<FileInfo> result;
+ std::list<FileInfo> result;
librpmDb::db_const_iterator it;
bool found;
//
// DESCRIPTION :
//
-bool RpmDb::hasFile( const string & file_r, const string & name_r ) const
+bool RpmDb::hasFile( const std::string & file_r, const std::string & name_r ) const
{
librpmDb::db_const_iterator it;
bool res;
//
//
// METHOD NAME : RpmDb::whoOwnsFile
-// METHOD TYPE : string
+// METHOD TYPE : std::string
//
// DESCRIPTION :
//
-string RpmDb::whoOwnsFile( const string & file_r) const
+std::string RpmDb::whoOwnsFile( const std::string & file_r) const
{
librpmDb::db_const_iterator it;
if (it.findByFile( file_r ))
//
// DESCRIPTION :
//
-bool RpmDb::hasProvides( const string & tag_r ) const
+bool RpmDb::hasProvides( const std::string & tag_r ) const
{
librpmDb::db_const_iterator it;
return it.findByProvides( tag_r );
//
// DESCRIPTION :
//
-bool RpmDb::hasRequiredBy( const string & tag_r ) const
+bool RpmDb::hasRequiredBy( const std::string & tag_r ) const
{
librpmDb::db_const_iterator it;
return it.findByRequiredBy( tag_r );
//
// DESCRIPTION :
//
-bool RpmDb::hasConflicts( const string & tag_r ) const
+bool RpmDb::hasConflicts( const std::string & tag_r ) const
{
librpmDb::db_const_iterator it;
return it.findByConflicts( tag_r );
//
// DESCRIPTION :
//
-bool RpmDb::hasPackage( const string & name_r ) const
+bool RpmDb::hasPackage( const std::string & name_r ) const
{
librpmDb::db_const_iterator it;
return it.findPackage( name_r );
//
// DESCRIPTION :
//
-bool RpmDb::hasPackage( const string & name_r, const Edition & ed_r ) const
+bool RpmDb::hasPackage( const std::string & name_r, const Edition & ed_r ) const
{
librpmDb::db_const_iterator it;
return it.findPackage( name_r, ed_r );
//
// DESCRIPTION :
//
-void RpmDb::getData( const string & name_r,
+void RpmDb::getData( const std::string & name_r,
RpmHeader::constPtr & result_r ) const
{
librpmDb::db_const_iterator it;
//
// DESCRIPTION :
//
-void RpmDb::getData( const string & name_r, const Edition & ed_r,
+void RpmDb::getData( const std::string & name_r, const Edition & ed_r,
RpmHeader::constPtr & result_r ) const
{
librpmDb::db_const_iterator it;
// determine changed files of installed package
bool
-RpmDb::queryChangedFiles(FileList & fileList, const string& packageName)
+RpmDb::queryChangedFiles(FileList & fileList, const std::string& packageName)
{
bool ok = true;
M Mode (includes permissions and file type)
*/
- string line;
+ std::string line;
while (systemReadLine(line))
{
if (line.length() > 12 &&
(line[0] == '.' && line[7] == 'T')))
{
// file has been changed
- string filename;
+ std::string filename;
filename.assign(line, 11, line.length() - 11);
fileList.insert(filename);
/*--------------------------------------------------------------*/
/* Read a line from the rpm process */
/*--------------------------------------------------------------*/
-bool RpmDb::systemReadLine( string & line )
+bool RpmDb::systemReadLine( std::string & line )
{
line.erase();
{
if ( linebuffer[nread-1] == '\n' )
--nread;
- line += string( linebuffer, nread );
+ line += std::string( linebuffer, nread );
}
if ( ! ::ferror( inputfile ) || ::feof( inputfile ) )
// generate diff mails for config files
-void RpmDb::processConfigFiles(const string& line, const string& name, const char* typemsg, const char* difffailmsg, const char* diffgenmsg)
+void RpmDb::processConfigFiles(const std::string& line, const std::string& name, const char* typemsg, const char* difffailmsg, const char* diffgenmsg)
{
- string msg = line.substr(9);
- string::size_type pos1 = string::npos;
- string::size_type pos2 = string::npos;
- string file1s, file2s;
+ std::string msg = line.substr(9);
+ std::string::size_type pos1 = std::string::npos;
+ std::string::size_type pos2 = std::string::npos;
+ std::string file1s, file2s;
Pathname file1;
Pathname file2;
pos1 = msg.find (typemsg);
for (;;)
{
- if ( pos1 == string::npos )
+ if ( pos1 == std::string::npos )
break;
pos2 = pos1 + strlen (typemsg);
file2 = _root + file2;
}
- string out;
+ std::string out;
int ret = diffFiles (file1.asString(), file2.asString(), out, 25);
if (ret)
{
break;
}
file += Date(Date::now()).form("config_diff_%Y_%m_%d.log");
- ofstream notify(file.asString().c_str(), ios::out|ios::app);
+ std::ofstream notify(file.asString().c_str(), std::ios::out|std::ios::app);
if (!notify)
{
ERR << "Could not open " << file << endl;
{
out.replace(4, file1.asString().length(), file1s);
}
- string::size_type pos = out.find("\n+++ ");
- if (pos != string::npos)
+ std::string::size_type pos = out.find("\n+++ ");
+ if (pos != std::string::npos)
{
out.replace(pos+5, file2.asString().length(), file2s);
}
opts.push_back("--");
// rpm requires additional quoting of special chars:
- string quotedFilename( rpmQuoteFilename( workaroundRpmPwdBug( filename ) ) );
+ std::string quotedFilename( rpmQuoteFilename( workaroundRpmPwdBug( filename ) ) );
opts.push_back ( quotedFilename.c_str() );
modifyDatabase(); // BEFORE run_rpm
run_rpm( opts, ExternalProgram::Stderr_To_Stdout );
- string line;
- string rpmmsg;
- vector<string> configwarnings;
+ std::string line;
+ std::string rpmmsg;
+ std::vector<std::string> configwarnings;
unsigned linecnt = 0;
while (systemReadLine(line))
int rpm_status = systemStatus();
// evaluate result
- for (vector<string>::iterator it = configwarnings.begin();
+ for (std::vector<std::string>::iterator it = configwarnings.begin();
it != configwarnings.end(); ++it)
{
processConfigFiles(*it, Pathname::basename(filename), " saved as ",
historylog.comment(
str::form("%s install failed", Pathname::basename(filename).c_str()),
true /*timestamp*/);
- ostringstream sstr;
+ std::ostringstream sstr;
sstr << "rpm output:" << endl << rpmmsg << endl;
historylog.comment(sstr.str());
// TranslatorExplanation the colon is followed by an error message
- ZYPP_THROW(RpmSubprocessException(string(_("RPM failed: ")) +
- (rpmmsg.empty() ? error_message : rpmmsg)));
+ ZYPP_THROW(RpmSubprocessException(_("RPM failed: ") + (rpmmsg.empty() ? error_message : rpmmsg) ));
}
else if ( ! rpmmsg.empty() )
{
historylog.comment(
str::form("%s installed ok", Pathname::basename(filename).c_str()),
true /*timestamp*/);
- ostringstream sstr;
+ std::ostringstream sstr;
sstr << "Additional rpm output:" << endl << rpmmsg << endl;
historylog.comment(sstr.str());
// METHOD NAME : RpmDb::removePackage
// METHOD TYPE : PMError
//
-void RpmDb::removePackage( const string & name_r, RpmInstFlags flags )
+void RpmDb::removePackage( const std::string & name_r, RpmInstFlags flags )
{
callback::SendReport<RpmRemoveReport> report;
}
-void RpmDb::doRemovePackage( const string & name_r, RpmInstFlags flags, callback::SendReport<RpmRemoveReport> & report )
+void RpmDb::doRemovePackage( const std::string & name_r, RpmInstFlags flags, callback::SendReport<RpmRemoveReport> & report )
{
FAILIFNOTINITIALIZED;
HistoryLog historylog;
modifyDatabase(); // BEFORE run_rpm
run_rpm (opts, ExternalProgram::Stderr_To_Stdout);
- string line;
- string rpmmsg;
+ std::string line;
+ std::string rpmmsg;
// got no progress from command, so we fake it:
// 5 - command started
{
historylog.comment(
str::form("%s remove failed", name_r.c_str()), true /*timestamp*/);
- ostringstream sstr;
+ std::ostringstream sstr;
sstr << "rpm output:" << endl << rpmmsg << endl;
historylog.comment(sstr.str());
// TranslatorExplanation the colon is followed by an error message
- ZYPP_THROW(RpmSubprocessException(string(_("RPM failed: ")) +
- (rpmmsg.empty() ? error_message: rpmmsg)));
+ ZYPP_THROW(RpmSubprocessException(_("RPM failed: ") + (rpmmsg.empty() ? error_message: rpmmsg) ));
}
else if ( ! rpmmsg.empty() )
{
historylog.comment(
str::form("%s removed ok", name_r.c_str()), true /*timestamp*/);
- ostringstream sstr;
+ std::ostringstream sstr;
sstr << "Additional rpm output:" << endl << rpmmsg << endl;
historylog.comment(sstr.str());
// METHOD NAME : RpmDb::backupPackage
// METHOD TYPE : bool
//
-bool RpmDb::backupPackage(const string& packageName)
+bool RpmDb::backupPackage(const std::string& packageName)
{
HistoryLog progresslog;
bool ret = true;
return false;
}
- ofstream fp ( filestobackupfile.asString().c_str(), ios::out|ios::trunc );
+ std::ofstream fp ( filestobackupfile.asString().c_str(), std::ios::out|std::ios::trunc );
if (!fp)
{
for (FileList::const_iterator cit = fileList.begin();
cit != fileList.end(); ++cit)
{
- string name = *cit;
+ std::string name = *cit;
if ( name[0] == '/' )
{
// remove slash, file must be relative to -C parameter of tar
// execute tar in inst-sys (we dont know if there is a tar below _root !)
ExternalProgram tar(argv, ExternalProgram::Stderr_To_Stdout, false, -1, true);
- string tarmsg;
+ std::string tarmsg;
// TODO: its probably possible to start tar with -v and watch it adding
// files to report progress
- for (string output = tar.receiveLine(); output.length() ;output = tar.receiveLine())
+ for (std::string output = tar.receiveLine(); output.length() ;output = tar.receiveLine())
{
tarmsg+=output;
}
* Package::constPtr p( mySelectable.installedAsKind<Package>() );
* \endcode
*/
- template<class _Res>
- typename ResTraits<_Res>::constPtrType installedAsKind() const
- { return asKind<_Res>( candidateObj() ); }
+ template<class TRes>
+ typename ResTraits<TRes>::constPtrType installedAsKind() const
+ { return asKind<TRes>( candidateObj() ); }
/** Return the \ref candidateObj resolvable casted to a specific kind.
* \code
* Package::constPtr p( mySelectable.candidateAsKind<Package>() );
* \endcode
*/
- template<class _Res>
- typename ResTraits<_Res>::constPtrType candidateAsKind() const
- { return asKind<_Res>( candidateObj() ); }
+ template<class TRes>
+ typename ResTraits<TRes>::constPtrType candidateAsKind() const
+ { return asKind<TRes>( candidateObj() ); }
/** Set a candidate (out of available objects).
* \return The new candidate, or NULL if choice was invalid
typedef bool (StatusBackup::*Action)( const PoolItem &, Causer );
/** Highlevel action on range of items. */
- template <class _Iter>
- bool forEach( _Iter begin_r, _Iter end_r, Action action_r, Causer causer_r )
+ template <class TIter>
+ bool forEach( TIter begin_r, TIter end_r, Action action_r, Causer causer_r )
{
for_( it, begin_r, end_r )
if ( ! (this->*action_r)( *it, causer_r ) )
typedef SelectableTraits::PickList PickList;
public:
- template <class _Iterator>
+ template <class TIterator>
Impl( const ResKind & kind_r,
const std::string & name_r,
- _Iterator begin_r,
- _Iterator end_r )
+ TIterator begin_r,
+ TIterator end_r )
: _ident( sat::Solvable::SplitIdent( kind_r, name_r ).ident() )
, _kind( kind_r )
, _name( name_r )