Author: aschnell
Date: Tue Jul 31 21:07:17 2007
New Revision: 6352
URL: http://svn.opensuse.org/viewcvs/zypp?rev=6352&view=rev
Log:
- restructuring
Modified:
trunk/libzypp-bindings/swig/CapSet.i
trunk/libzypp-bindings/swig/RepoInfo.i
trunk/libzypp-bindings/swig/RepoType.i
trunk/libzypp-bindings/swig/ResPool.i
trunk/libzypp-bindings/swig/ResStore.i
trunk/libzypp-bindings/swig/ZYppCommitPolicy.i
trunk/libzypp-bindings/swig/python/python.i
trunk/libzypp-bindings/swig/ruby/ruby.i
trunk/libzypp-bindings/swig/zypp.i
Modified: trunk/libzypp-bindings/swig/CapSet.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/CapSet.i?rev=6352&r1=6351&r2=6352&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/CapSet.i (original)
+++ trunk/libzypp-bindings/swig/CapSet.i Tue Jul 31 21:07:17 2007
@@ -6,6 +6,12 @@
};
+
+#ifdef SWIGRUBY
+iter3(CapSet, Capability*);
+#endif
+
+
// The ruby std_set.i can only handle one template parameter
// #ifdef SWIGPYTHON
@@ -13,3 +19,15 @@
// typedef std::set CapSetTemp;
// #endif
+#ifdef SWIGPYTHON
+%extend CapSet
+{
+ // just a test
+ const Capability* haha()
+ {
+ CapSet::iterator i = self->begin();
+ const Capability* tmp = &*i;
+ return tmp;
+ }
+}
+#endif
Modified: trunk/libzypp-bindings/swig/RepoInfo.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/RepoInfo.i?rev=6352&r1=6351&r2=6352&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/RepoInfo.i (original)
+++ trunk/libzypp-bindings/swig/RepoInfo.i Tue Jul 31 21:07:17 2007
@@ -134,3 +134,6 @@
typedef std::list<RepoInfo> RepoInfoList;
%template(RepoInfoList) std::list<RepoInfo>;
+#ifdef SWIGRUBY
+auto_iterator(std::list<RepoInfo>, RepoInfo);
+#endif
Modified: trunk/libzypp-bindings/swig/RepoType.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/RepoType.i?rev=6352&r1=6351&r2=6352&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/RepoType.i (original)
+++ trunk/libzypp-bindings/swig/RepoType.i Tue Jul 31 21:07:17 2007
@@ -1,10 +1,14 @@
+#ifdef SWIGRUBY
+%alias RepoType::asString "to_s";
+#endif
+
struct RepoType
- {
+{
static const RepoType RPMMD;
static const RepoType YAST2;
//static const RepoType NONE;
-
+
enum Type
{
NONE_e,
@@ -17,10 +21,10 @@
explicit RepoType(const std::string & strval_r);
const Type toEnum() const { return _type; }
-
+
RepoType::Type parse(const std::string & strval_r);
const std::string & asString() const;
Type _type;
- };
\ No newline at end of file
+};
Modified: trunk/libzypp-bindings/swig/ResPool.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/ResPool.i?rev=6352&r1=6351&r2=6352&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/ResPool.i (original)
+++ trunk/libzypp-bindings/swig/ResPool.i Tue Jul 31 21:07:17 2007
@@ -149,3 +149,43 @@
pool::PoolTraits::Impl_constPtr _pimpl;
};
+
+
+#ifdef SWIGRUBY
+
+iter3(ResPool, PoolItem_Ref*);
+
+// %extend ResPool {
+// void each()
+// {
+// ResPool::const_iterator i = self->begin();
+// while ( i != self->end() ) {
+// rb_yield( SWIG_NewPointerObj( (void *) &*i, SWIGTYPE_p_PoolItem_Ref, 0));
+// ++i;
+// }
+// }
+// }
+
+%extend ResPool {
+ void each_by_kind( const ResObject::Kind & kind_r )
+ {
+ ResPool::byKind_iterator i = self->byKindBegin( kind_r );
+ while ( i != self->byKindEnd( kind_r ) ) {
+ rb_yield( SWIG_NewPointerObj( (void *) &*i, SWIGTYPE_p_PoolItem_Ref, 0));
+ ++i;
+ }
+ }
+}
+
+%extend ResPool {
+ void each_by_name( const std::string &name )
+ {
+ ResPool::byName_iterator i = self->byNameBegin( name );
+ while ( i != self->byNameEnd( name ) ) {
+ rb_yield( SWIG_NewPointerObj( (void *) &*i, $descriptor(PoolItem_Ref), 0));
+ ++i;
+ }
+ }
+}
+
+#endif
Modified: trunk/libzypp-bindings/swig/ResStore.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/ResStore.i?rev=6352&r1=6351&r2=6352&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/ResStore.i (original)
+++ trunk/libzypp-bindings/swig/ResStore.i Tue Jul 31 21:07:17 2007
@@ -18,3 +18,19 @@
void clear();
};
+#ifdef SWIGRUBY
+iter2(ResStore, ResObject*);
+#endif
+
+#ifdef SWIGPYTHON
+%extend ResStore
+{
+ // just a test
+ const ResObject* haha()
+ {
+ ResStore::iterator i = self->begin();
+ const ResObject* tmp = &**i;
+ return tmp;
+ }
+}
+#endif
Modified: trunk/libzypp-bindings/swig/ZYppCommitPolicy.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/ZYppCommitPolicy.i?rev=6352&r1=6351&r2=6352&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/ZYppCommitPolicy.i (original)
+++ trunk/libzypp-bindings/swig/ZYppCommitPolicy.i Tue Jul 31 21:07:17 2007
@@ -1,5 +1,12 @@
+
+#ifdef SWIGRUBY
+%rename("dryRun=") ZYppCommitPolicy::dryRun(bool);
+%rename("rpmNoSignature=") ZYppCommitPolicy::rpmNoSignature(bool);
+%rename("syncPoolAfterCommit=") ZYppCommitPolicy::syncPoolAfterCommit(bool);
+#endif
+
class ZYppCommitPolicy
- {
+{
public:
ZYppCommitPolicy()
: _restrictToMedia ( 0 )
@@ -49,4 +56,4 @@
bool _dryRun;
bool _rpmNoSignature;
bool _syncPoolAfterCommit;
- };
\ No newline at end of file
+};
Modified: trunk/libzypp-bindings/swig/python/python.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/python/python.i?rev=6352&r1=6351&r2=6352&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/python/python.i (original)
+++ trunk/libzypp-bindings/swig/python/python.i Tue Jul 31 21:07:17 2007
@@ -11,27 +11,3 @@
};
%enddef
-
-%extend ResStore
-{
- // just a test
- const ResObject* haha()
- {
- ResStore::iterator i = self->begin();
- const ResObject* tmp = &**i;
- return tmp;
- }
-}
-
-
-%extend CapSet
-{
- // just a test
- const Capability* haha()
- {
- CapSet::iterator i = self->begin();
- const Capability* tmp = &*i;
- return tmp;
- }
-}
-
Modified: trunk/libzypp-bindings/swig/ruby/ruby.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/ruby/ruby.i?rev=6352&r1=6351&r2=6352&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/ruby/ruby.i (original)
+++ trunk/libzypp-bindings/swig/ruby/ruby.i Tue Jul 31 21:07:17 2007
@@ -1,39 +1,17 @@
-%rename("asString") to_s;
-
-#define auto_string( cl ) \
-%extend cl { \
- std::string to_s() { \
- return self->asString();\
- } \
-}
-
-
-// #define iter( cl, storetype ) \
-// %mixin cl "Enumerable"; \
-// %extend cl { \
-// void each() { \
-// cl::iterator i = self->begin(); \
-// while ( i != self->end() ) { \
-// rb_yield( SWIG_NewPointerObj( (void *) &*i, $descriptor(storetype), 1)); \
-// ++i; \
-// } \
-// } \
-// }
-
/*
* Extend cls with an ruby-like each iterator. Yields objects of type storetype.
* Parameter storetype must be a pointer type.
*/
-#define iter2( cls, storetype ) \
+#define iter2(cls, storetype) \
%mixin cls "Enumerable"; \
%extend cls { \
void each() { \
cls::const_iterator i = self->begin(); \
- while ( i != self->end() ) { \
+ while (i != self->end()) { \
const storetype tmp = &**i; \
- rb_yield( SWIG_NewPointerObj( (void*) tmp, $descriptor(storetype), 0)); \
+ rb_yield(SWIG_NewPointerObj((void*) tmp, $descriptor(storetype), 0)); \
++i; \
} \
} \
@@ -42,33 +20,20 @@
/*
* Like iter2, but does only one dereferencing from the iterator.
*/
-#define iter3( cls, storetype ) \
+#define iter3(cls, storetype) \
%mixin cls "Enumerable"; \
%extend cls { \
void each() { \
cls::const_iterator i = self->begin(); \
- while ( i != self->end() ) { \
+ while (i != self->end()) { \
const storetype tmp = &*i; \
- rb_yield( SWIG_NewPointerObj( (void*) tmp, $descriptor(storetype), 0)); \
+ rb_yield(SWIG_NewPointerObj((void*) tmp, $descriptor(storetype), 0)); \
++i; \
} \
} \
}
-// %mixin ResStore "Enumerable";
-// %extend ResStore {
-// void each() {
-// ResStore::iterator i = self->begin();
-// while ( i != self->end() ) {
-// const ResObject* tmp = &**i;
-// rb_yield( SWIG_NewPointerObj( (void*) tmp, $descriptor(ResObject*), 0));
-// ++i;
-// }
-// }
-// }
-
-
#define auto_iterator( cl, storetype ) \
%mixin cl "Enumerable"; \
%extend cl { \
@@ -81,55 +46,3 @@
} \
}
-
-%extend Target {
- void each_by_kind( const ResObject::Kind & kind_r )
- {
- ResStore::resfilter_const_iterator i = self->byKindBegin( kind_r );
- while ( i != self->byKindEnd( kind_r ) ) {
- rb_yield( SWIG_NewPointerObj( (void *) &*i, $descriptor(ResStore::Ptr), 0));
- ++i;
- }
- }
-}
-
-// %extend ResPool {
-// void each()
-// {
-// ResPool::const_iterator i = self->begin();
-// while ( i != self->end() ) {
-// rb_yield( SWIG_NewPointerObj( (void *) &*i, SWIGTYPE_p_PoolItem_Ref, 0));
-// ++i;
-// }
-// }
-// }
-
-%extend ResPool {
- void each_by_kind( const ResObject::Kind & kind_r )
- {
- ResPool::byKind_iterator i = self->byKindBegin( kind_r );
- while ( i != self->byKindEnd( kind_r ) ) {
- rb_yield( SWIG_NewPointerObj( (void *) &*i, SWIGTYPE_p_PoolItem_Ref, 0));
- ++i;
- }
- }
-}
-
-%extend ResPool {
- void each_by_name( const std::string &name )
- {
- ResPool::byName_iterator i = self->byNameBegin( name );
- while ( i != self->byNameEnd( name ) ) {
- rb_yield( SWIG_NewPointerObj( (void *) &*i, $descriptor(PoolItem_Ref), 0));
- ++i;
- }
- }
-}
-
-
-%rename(asString) to_s;
-
-%rename("dryRun=") ZYppCommitPolicy::dryRun(bool);
-%rename("rpmNoSignature=") ZYppCommitPolicy::rpmNoSignature(bool);
-%rename("syncPoolAfterCommit=") ZYppCommitPolicy::syncPoolAfterCommit(bool);
-
Modified: trunk/libzypp-bindings/swig/zypp.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/swig/zypp.i?rev=6352&r1=6351&r2=6352&view=diff
==============================================================================
--- trunk/libzypp-bindings/swig/zypp.i (original)
+++ trunk/libzypp-bindings/swig/zypp.i Tue Jul 31 21:07:17 2007
@@ -4,40 +4,39 @@
%module zypp
#endif
- %{
- /* Includes the header in the wrapper code */
-
- #include "zypp/base/PtrTypes.h"
- #include
- #include
- #include
- #include
- #include
- #include
- #include
- #include "zypp/base/ReferenceCounted.h"
- #include "zypp/ResObject.h"
- #include "zypp/Target.h"
- #include "zypp/target/TargetImpl.h"
+%{
+/* Includes the header in the wrapper code */
+#include "zypp/base/PtrTypes.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "zypp/base/ReferenceCounted.h"
+#include "zypp/ResObject.h"
+#include "zypp/Target.h"
+#include "zypp/target/TargetImpl.h"
#include "zypp/TranslatedText.h"
- #include "zypp/CapFactory.h"
- #include "zypp/Package.h"
+#include "zypp/CapFactory.h"
+#include "zypp/Package.h"
#include "zypp/ResFilters.h"
#include "zypp/OnMediaLocation.h"
- #include "zypp/Repository.h"
- #include "zypp/RepoManager.h"
- #include "zypp/repo/RepoType.h"
+#include "zypp/Repository.h"
+#include "zypp/RepoManager.h"
+#include "zypp/repo/RepoType.h"
#include "zypp/MediaSetAccess.h"
#include "zypp/TmpPath.h"
- using namespace boost;
- using namespace zypp;
- using namespace zypp::repo;
- using namespace zypp::resfilter;
- using namespace zypp::filesystem;
+using namespace boost;
+using namespace zypp;
+using namespace zypp::repo;
+using namespace zypp::resfilter;
+using namespace zypp::filesystem;
- typedef std::set<Url> UrlSet;
- %}
+typedef std::set<Url> UrlSet;
+%}
%rename("+") "operator+";
%rename("<<") "operator<<";
@@ -45,15 +44,6 @@
%rename("!") "operator!";
%rename("==") "operator==";
-/* Parse the header file to generate wrappers */
-%ignore zypp::operator<<( std::ostream & str, const ZYppFactory & obj );
-%ignore zypp::base::operator<<( std::ostream & str, const ReferenceCounted & obj );
-
-/*
-//%include "zypp/base/Deprecated.h"
-//%include "zypp/base/PtrTypes.h"
-*/
-
template < typename T >
class intrusive_ptr {
@@ -61,19 +51,26 @@
T *operator->();
};
-%include "Pathname.i"
-%include "Url.i"
-%include std_string.i
+%include "std_string.i"
%include "stl.i"
+
+
#ifdef SWIGRUBY
%include "ruby/std_list.i"
%include "ruby/std_set.i"
-#else
-%include std_list.i
-%include std_set.i
+%include "ruby/ruby.i"
#endif
+#ifdef SWIGPYTHON
+%include "std_list.i"
+%include "std_set.i"
+%include "python/python.i"
+#endif
+
+
+%include "Pathname.i"
+%include "Url.i"
%include "NeedAType.i"
%include "Arch.i"
%include "ResStore.i"
@@ -111,25 +108,6 @@
%include "TmpPath.i"
-#ifdef SWIGRUBY
-
-%include "ruby/ruby.i"
-
-/* define iterators using swig macros */
-iter2( ResStore, ResObject* )
-iter3( CapSet, Capability* )
-iter3(ResPool, PoolItem_Ref*)
-auto_iterator( std::list<RepoInfo>, RepoInfo )
-
-#endif
-
-#ifdef SWIGPYTHON
-
-%include "python/python.i"
-
-#endif
-
-
class ZYpp
{
public:
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org