Author: mlandres
Date: Thu Apr 3 18:24:46 2008
New Revision: 9360
URL: http://svn.opensuse.org/viewcvs/zypp?rev=9360&view=rev
Log:
backup sat::LookupAttr draft
Added:
trunk/libzypp/zypp/sat/LookupAttr.cc
trunk/libzypp/zypp/sat/LookupAttr.h
Modified:
trunk/libzypp/devel/devel.ma/NewPool.cc
trunk/libzypp/zypp/CMakeLists.txt
Modified: trunk/libzypp/devel/devel.ma/NewPool.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/NewPool.cc?rev=9360&r1=9359&r2=9360&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/NewPool.cc (original)
+++ trunk/libzypp/devel/devel.ma/NewPool.cc Thu Apr 3 18:24:46 2008
@@ -35,6 +35,7 @@
#include "zypp/sat/Pool.h"
#include "zypp/sat/LocaleSupport.h"
+#include "zypp/sat/LookupAttr.h"
#include "zypp/sat/detail/PoolImpl.h"
#include
@@ -505,12 +506,15 @@
{
namespace sat
{
-
+#if 0
class LookupAttr
{
public:
LookupAttr()
{}
+ LookupAttr( SolvAttr attr_r )
+ : _attr( attr_r )
+ {}
LookupAttr( SolvAttr attr_r, Repository repo_r )
: _attr( attr_r ), _repo( repo_r )
{}
@@ -519,7 +523,13 @@
{}
public:
- class iterator
+ class iterator : public boost::iterator_adaptor<
+ iterator // Derived
+ , RepoDataIterator * // Base
+ , const sat::Solvable // Value
+ , boost::forward_traversal_tag // CategoryOrTraversal
+ , const sat::Solvable & // Reference
+ >
{
friend bool operator==( const iterator & lhs, const iterator & rhs );
@@ -570,15 +580,16 @@
inline bool operator!=( const LookupAttr::iterator & lhs, const LookupAttr::iterator & rhs )
{ return ! (lhs == rhs); }
- }
+#endif
+ }
}
void ditest( sat::Solvable slv_r )
{
MIL << slv_r << endl;
-
+#if 0
sat::LookupAttr q( sat::SolvAttr::keywords, slv_r );
dumpRange( MIL, q.begin(), q.end() ) << endl;
sat::LookupAttr::iterator a1( q.begin() );
@@ -587,6 +598,7 @@
SEC << ( a1 == q.begin() ) << endl;
SEC << ( a1 == ++q.begin() ) << endl;
return;
+#endif
::_Pool * pool = sat::Pool::instance().get();
::_Repo * repo = slv_r.repository().get();
sat::SolvAttr attr( "susetags:datadir" );
Modified: trunk/libzypp/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/CMakeLists.txt?rev=9360&r1=9359&r2=9360&view=diff
==============================================================================
--- trunk/libzypp/zypp/CMakeLists.txt (original)
+++ trunk/libzypp/zypp/CMakeLists.txt Thu Apr 3 18:24:46 2008
@@ -514,6 +514,7 @@
sat/Solvable.cc
sat/WhatProvides.cc
sat/LocaleSupport.cc
+ sat/LookupAttr.cc
sat/SATResolver.cc
sat/SolvAttr.cc
)
@@ -523,6 +524,7 @@
sat/Solvable.h
sat/WhatProvides.h
sat/LocaleSupport.h
+ sat/LookupAttr.h
sat/SATResolver.h
sat/SolvAttr.h
)
@@ -876,7 +878,7 @@
TARGET_LINK_LIBRARIES(zypp ${LIBXML_LIBRARY} )
TARGET_LINK_LIBRARIES(zypp ${ZLIB_LIBRARY} )
TARGET_LINK_LIBRARIES(zypp ${SATSOLVER_LIBRARY} )
-TARGET_LINK_LIBRARIES(zypp ${OPENSSL_LIBRARIES})
+TARGET_LINK_LIBRARIES(zypp ${OPENSSL_LIBRARIES})
TARGET_LINK_LIBRARIES(zypp crypto)
INSTALL(TARGETS zypp LIBRARY DESTINATION ${LIB_INSTALL_DIR} )
Added: trunk/libzypp/zypp/sat/LookupAttr.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/LookupAttr.cc?rev=9360&view=auto
==============================================================================
--- trunk/libzypp/zypp/sat/LookupAttr.cc (added)
+++ trunk/libzypp/zypp/sat/LookupAttr.cc Thu Apr 3 18:24:46 2008
@@ -0,0 +1,72 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/sat/LookupAttr.cc
+ *
+*/
+#include <iostream>
+#include "zypp/base/Logger.h"
+
+#include "zypp/sat/detail/PoolImpl.h"
+
+#include "zypp/sat/LookupAttr.h"
+
+using std::endl;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace sat
+ { /////////////////////////////////////////////////////////////////
+
+ LookupAttr::iterator LookupAttr::begin() const
+ {
+#warning pool search still disabled.
+ if ( ! (_attr && _repo ) )
+ return iterator();
+
+ ::Dataiterator di;
+ if ( _solv )
+ ::dataiterator_init( &di, _solv.repository().id(), _solv.id(), _attr.id(), 0, SEARCH_NO_STORAGE_SOLVABLE );
+ else
+ ::dataiterator_init( &di, _repo.id(), 0, _attr.id(), 0, SEARCH_NO_STORAGE_SOLVABLE );
+ return iterator( /*di*/ );
+ }
+
+ LookupAttr::iterator LookupAttr::end() const
+ {
+ return iterator();
+ }
+
+ std::ostream & operator<<( std::ostream & str, const LookupAttr & obj )
+ {
+ if ( ! obj.attr() )
+ return str << "search nothing";
+
+ str << "seach " << obj.attr() << " in ";
+ if ( obj.solvable() )
+ return str << obj.solvable();
+ if ( obj.repo() )
+ return str << obj.repo();
+ return str << "pool";
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : LookupAttr::iterator
+ //
+ ///////////////////////////////////////////////////////////////////
+
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace sat
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
Added: trunk/libzypp/zypp/sat/LookupAttr.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/sat/LookupAttr.h?rev=9360&view=auto
==============================================================================
--- trunk/libzypp/zypp/sat/LookupAttr.h (added)
+++ trunk/libzypp/zypp/sat/LookupAttr.h Thu Apr 3 18:24:46 2008
@@ -0,0 +1,142 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/sat/LookupAttr.h
+ *
+*/
+#ifndef ZYPP_SAT_LOOKUPATTR_H
+#define ZYPP_SAT_LOOKUPATTR_H
+
+#include <iosfwd>
+
+#include "zypp/base/PtrTypes.h"
+#include "zypp/sat/Pool.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace sat
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : LookupAttr
+ //
+ /** Lightweight attribute lookup.
+ */
+ class LookupAttr
+ {
+ public:
+ /** Default ctor. */
+ LookupAttr()
+ {}
+ /** Lookup \ref SolvAttr in \ref Pool (all repositories). */
+ LookupAttr( SolvAttr attr_r )
+ : _attr( attr_r )
+ {}
+ /** Lookup \ref SolvAttr in one \ref Repository. */
+ LookupAttr( SolvAttr attr_r, Repository repo_r )
+ : _attr( attr_r ), _repo( repo_r )
+ {}
+ /** Lookup \ref SolvAttr in one \ref Solvable. */
+ LookupAttr( SolvAttr attr_r, Solvable solv_r )
+ : _attr( attr_r ), _solv( solv_r )
+ {}
+
+ public:
+ /** \name Search result. */
+ //@{
+ /** Result iterator. */
+ class iterator;
+
+ /** Iterator to the begin of query results. */
+ iterator begin() const;
+
+ /** Iterator behind the end of query results. */
+ iterator end() const;
+
+ //@}
+ public:
+ /** \name What to search. */
+ //@{
+
+ /** The \ref SolvAttr to search. */
+ SolvAttr attr() const
+ { return _attr; }
+
+ /** Set the \ref SolvAttr to search. */
+ void setAttr( SolvAttr attr_r )
+ { _attr = attr_r; }
+
+ //@}
+ public:
+ /** \name Where to search. */
+ //@{
+ /** Wheter to search in \ref Pool. */
+ bool pool() const
+ { return ! (_repo || _solv); }
+
+ /** Set search in \ref Pool (all repositories). */
+ void setPool()
+ {
+ _repo = Repository::noRepository;
+ _solv = Solvable::noSolvable;
+ }
+
+ /** Wheter to search in one \ref Repository. */
+ Repository repo() const
+ { return _repo; }
+
+ /** Set search in one \ref Repository. */
+ void setRepo( Repository repo_r )
+ {
+ _repo = repo_r;
+ _solv = Solvable::noSolvable;
+ }
+
+ /** Wheter to search in one \ref Solvable. */
+ Solvable solvable() const
+ { return _solv; }
+
+ /** Set search in one \ref Solvable. */
+ void setSolvable( Solvable solv_r )
+ {
+ _repo = Repository::noRepository;
+ _solv = solv_r;
+ }
+
+ //@}
+ private:
+ SolvAttr _attr;
+ Repository _repo;
+ Solvable _solv;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /** \relates Arch stream output. */
+ std::ostream & operator<<( std::ostream & str, const LookupAttr & obj );
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : LookupAttr::iterator
+ //
+ /** Result iterator.
+ */
+ struct LookupAttr::iterator
+ {
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace sat
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_SAT_LOOKUPATTR_H
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org