Author: dmacvicar Date: Tue Feb 5 19:27:55 2008 New Revision: 8479 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8479&view=rev Log: - Use SolvAttr to keep the ids of attributes in a nice way - start playing with a way to get the data using resolvable interface - the most important goal for today (tonight) is the url/media so we can commit packages, and hopefully, description and summary Added: branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.cc - copied, changed from r8474, branches/tmp/ma/jump_sat/libzypp/zypp/Resolvable.cc branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.h Modified: branches/tmp/ma/jump_sat/libzypp/zypp/CMakeLists.txt branches/tmp/ma/jump_sat/libzypp/zypp/ResObject.cc branches/tmp/ma/jump_sat/libzypp/zypp/Resolvable.cc Modified: branches/tmp/ma/jump_sat/libzypp/zypp/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/CMakeLists.txt?rev=8479&r1=8478&r2=8479&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/CMakeLists.txt (original) +++ branches/tmp/ma/jump_sat/libzypp/zypp/CMakeLists.txt Tue Feb 5 19:27:55 2008 @@ -514,6 +514,7 @@ sat/Repo.cc sat/Solvable.cc sat/SATResolver.cc + sat/SolvAttr.cc ) SET( zypp_sat_HEADERS @@ -521,6 +522,7 @@ sat/Repo.h sat/Solvable.h sat/SATResolver.h + sat/SolvAttr.h ) INSTALL( FILES Modified: branches/tmp/ma/jump_sat/libzypp/zypp/ResObject.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/ResObject.cc?rev=8479&r1=8478&r2=8479&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/ResObject.cc (original) +++ branches/tmp/ma/jump_sat/libzypp/zypp/ResObject.cc Tue Feb 5 19:27:55 2008 @@ -11,6 +11,24 @@ */ #include "zypp/ResObject.h" #include "zypp/Repository.h" +#include "zypp/sat/SolvAttr.h" +extern "C" +{ +#include "satsolver/repo.h" +} + +class SearchQuery +{ + void search(Repo *repo, Id p, Id key, const char *match, int flags) + { + repo_search( repo, p, key, match, flags, SearchQuery::repo_search_cb, (void*) this); + } + + static int repo_search_cb(void *cbdata, ::Solvable *s, ::Repodata *data, ::Repokey *key, ::KeyValue *kv) + { + SearchQuery *q = (SearchQuery *) cbdata; + } +}; /////////////////////////////////////////////////////////////////// namespace zypp @@ -101,7 +119,7 @@ /////////////////////////////////////////////////////////////////// #include "zypp/ResObjects.h" - + /////////////////////////////////////////////////////////////////// namespace zypp { ///////////////////////////////////////////////////////////////// Modified: branches/tmp/ma/jump_sat/libzypp/zypp/Resolvable.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/Resolvable.cc?rev=8479&r1=8478&r2=8479&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/Resolvable.cc (original) +++ branches/tmp/ma/jump_sat/libzypp/zypp/Resolvable.cc Tue Feb 5 19:27:55 2008 @@ -11,7 +11,7 @@ */ #include "zypp/Resolvable.h" #include "zypp/ResObject.h" - + /////////////////////////////////////////////////////////////////// namespace zypp { ///////////////////////////////////////////////////////////////// Copied: branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.cc (from r8474, branches/tmp/ma/jump_sat/libzypp/zypp/Resolvable.cc) URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.cc?p2=branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.cc&p1=branches/tmp/ma/jump_sat/libzypp/zypp/Resolvable.cc&r1=8474&r2=8479&rev=8479&view=diff ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/Resolvable.cc (original) +++ branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.cc Tue Feb 5 19:27:55 2008 @@ -6,43 +6,28 @@ | /_____||_| |_| |_| | | | \---------------------------------------------------------------------*/ -/** \file zypp/Resolvable.cc +/** \file zypp/SolvAttr.cc * */ -#include "zypp/Resolvable.h" -#include "zypp/ResObject.h" +#include <iostream> + +#include "zypp/base/String.h" + +#include "zypp/sat/SolvAttr.h" + +using std::endl; /////////////////////////////////////////////////////////////////// namespace zypp { ///////////////////////////////////////////////////////////////// +namespace sat +{ ///////////////////////////////////////////////////////////////// - IMPL_PTR_TYPE(Resolvable); + const SolvAttr SolvAttr::summary ( "summary" ); + const SolvAttr SolvAttr::description ( "description" ); - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Resolvable::Resolvable - // METHOD TYPE : Ctor - // - Resolvable::Resolvable( const sat::Solvable & solvable_r ) - : sat::Solvable( solvable_r ) - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Resolvable::~Resolvable - // METHOD TYPE : Dtor - // - Resolvable::~Resolvable() - {} - - /////////////////////////////////////////////////////////////////// - // - // METHOD NAME : Resolvable::dumpOn - // METHOD TYPE : std::ostream & - // - std::ostream & Resolvable::dumpOn( std::ostream & str ) const - { return str << satSolvable(); } +} // namespace sat ///////////////////////////////////////////////////////////////// } // namespace zypp /////////////////////////////////////////////////////////////////// Added: branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.h URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.h?rev=8479&view=auto ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.h (added) +++ branches/tmp/ma/jump_sat/libzypp/zypp/sat/SolvAttr.h Tue Feb 5 19:27:55 2008 @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------\ +| ____ _ __ __ ___ | +| |__ / \ / / . \ . \ | +| / / \ V /| _/ _/ | +| / /__ | | | | | | | +| /_____||_| |_| |_| | +| | +\---------------------------------------------------------------------*/ +/** \file zypp/SolvAttr.h + * +*/ +#ifndef ZYPP_SolvAttr_H +#define ZYPP_SolvAttr_H + +#include <iosfwd> +#include <string> + +#include "zypp/base/String.h" +#include "zypp/IdStringType.h" + +/////////////////////////////////////////////////////////////////// +namespace zypp +{ ///////////////////////////////////////////////////////////////// +namespace sat +{ ///////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////// + // + // CLASS NAME : SolvAttr + // + /** Resolvable kinds. + * A \b lowercased string and used as identification. + * Comparison against string values is always case + * insensitive. + */ + class SolvAttr : public IdStringType<SolvAttr> + { + public: + /** \name Some builtin SolvAttr constants. */ + //@{ + /** Value representing \c nokind (<tt>""</tt>)*/ + static const SolvAttr noAttr; + static const SolvAttr summary; + static const SolvAttr description; + //@} + + public: + /** Default ctor: \ref nokind */ + SolvAttr() {} + + /** Ctor taking kind as string. */ + explicit SolvAttr( sat::detail::IdType id_r ) : _str( str::toLower(IdString(id_r).c_str()) ) {} + explicit SolvAttr( const IdString & idstr_r ) : _str( str::toLower(idstr_r.c_str()) ) {} + explicit SolvAttr( const std::string & str_r ) : _str( str::toLower(str_r) ) {} + explicit SolvAttr( const char * cstr_r ) : _str( str::toLower(cstr_r) ) {} + + public: + private: + static int _doCompare( const char * lhs, const char * rhs ) + { + if ( lhs == rhs ) return 0; + if ( lhs && rhs ) return ::strcasecmp( lhs, rhs ); + return( lhs ? 1 : -1 ); + } + + private: + friend class IdStringType<SolvAttr>; + IdString _str; + }; + + ///////////////////////////////////////////////////////////////// +} // namespace sat +} // namespace zypp +/////////////////////////////////////////////////////////////////// +#endif // ZYPP_SolvAttr_H -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org