Changes bindings to at least compile. Still several header copies to be
authorMichael Andres <ma@suse.de>
Wed, 23 Jul 2008 12:27:53 +0000 (12:27 +0000)
committerMichael Andres <ma@suse.de>
Wed, 23 Jul 2008 12:27:53 +0000 (12:27 +0000)
replaced by %include. For shure also still a lot namespace issues, as
c++ namespace support was introduced in SWIG-1.3.12.

23 files changed:
swig/Arch.i
swig/CMakeLists.txt
swig/CapMatch.i
swig/Date.i
swig/Edition.i
swig/IdStringType.i [new file with mode: 0644]
swig/KeyRing.i
swig/Kind.i
swig/Package.i
swig/PoolItem.i
swig/RepoInfo.i
swig/Repository.i
swig/ResObject.i
swig/ResPool.i
swig/ResStatus.i
swig/Resolvable.i
swig/Resolver.i
swig/Target.i
swig/ZYppFactory.i
swig/perl5/perl.i
swig/python/python.i
swig/ruby/ruby.i
swig/zypp.i

index 58b3dd8..1ea4991 100644 (file)
@@ -1,7 +1,7 @@
 // Ignore static versions shadowed by member functions
 %ignore zypp::Arch::compare(const Arch &, const Arch &);
 
-typedef std::set<Arch,CompareByGT<Arch> > CompatSet;
+template<class A, class B> class std::unary_function {};
+%template(ArchCompatFun) std::unary_function<zypp::Arch, bool>;
 
 %include <zypp/Arch.h>
-
index 927ec9a..8cac9d9 100644 (file)
@@ -1,7 +1,7 @@
 
 ADD_SUBDIRECTORY(ruby)
 
-#ADD_SUBDIRECTORY(python)
+ADD_SUBDIRECTORY(python)
 
-#ADD_SUBDIRECTORY(perl5)
+ADD_SUBDIRECTORY(perl5)
 
index bb179cb..f9f4117 100644 (file)
@@ -1,23 +1 @@
-
-class CapMatch
-{
-    enum Result { NOMATCH, MATCH, IRRELEVANT };
-
-  public:
-
-    CapMatch( bool val_r )
-    : _result( val_r ? MATCH : NOMATCH )
-    {}
-
-    static const CapMatch yes;
-    static const CapMatch no;
-    static const CapMatch irrelevant;
-
-  private:
-    CapMatch()
-    : _result( IRRELEVANT )
-    {}
-
-    Result _result;
-};
-
+%include <zypp/CapMatch.h>
index a70c180..f436832 100644 (file)
@@ -1,4 +1,3 @@
 
 // TODO: tell make about dependencies
 %include <zypp/Date.h>
-
index 74e8c40..7c2b7ec 100644 (file)
@@ -11,5 +11,7 @@
 //   %rename Edition::match(const Edition& lhs, const Edition& rhs) match2;
 //}
 
+%ignore zypp::Edition::compare(const Edition &, const Edition &);
+
+%template(IdStringEdition) zypp::IdStringType<zypp::Edition>;
 %include <zypp/Edition.h>
-%ignore zypp::Edition::match(Edition const &);
\ No newline at end of file
diff --git a/swig/IdStringType.i b/swig/IdStringType.i
new file mode 100644 (file)
index 0000000..d5115eb
--- /dev/null
@@ -0,0 +1,2 @@
+
+%include <zypp/IdStringType.h>
index 110782a..9ae978f 100644 (file)
@@ -1,13 +1,11 @@
 
-typedef intrusive_ptr<KeyRing> KeyRing_Ptr;
-
-%ignore KeyRingReport;
-%ignore KeyRingSignals;
-
+%ignore zypp::KeyRingReport;
+%ignore zypp::KeyRingSignals;
 
 %include <zypp/KeyRing.h>
-
+nakespcae zypp
+{
+typedef intrusive_ptr<KeyRing> KeyRing_Ptr;
 %template(KeyRing_Ptr) intrusive_ptr<KeyRing>;
-
-%template(List_PublicKey) std::list<PublicKey>;
-
+}
+%template(List_PublicKey) std::list<zypp::PublicKey>;
index 1d61911..7f71dfc 100644 (file)
@@ -1,37 +1,5 @@
 
-template<class _Tp>
-class KindOf
-{
-      public:
-        /** DefaultCtor: empty string */
-        KindOf()
-        {}
-        /** Ctor from string.
-         * Lowercase version of \a value_r is used as identification.
-        */
-        explicit
-        KindOf( const std::string & value_r )
-        : _value( str::toLower(value_r) )
-        {}
-        /** Dtor */
-        ~KindOf()
-        {}
-      public:
-        /** Identification string. */
-        const std::string & asString() const
-        { return _value; }
+%ignore zypp::ResKind::satIdent( const std::string & name_r ) const;
 
-        /** Order on KindOf (arbitrary).
-         * Not necessarily lexicographical.
-         * \todo Enable class _Tp to define the order,
-         * Fix logical operators below to use compare,
-        */
-        int compare( const KindOf & rhs ) const
-        { return _value.compare( rhs._value ); }
-
-      private:
-        /** */
-        std::string _value;
-};
-
-%template(KindOfResolvable) KindOf<Resolvable>;
+%template(IdStringResKind) zypp::IdStringType<zypp::ResKind>;
+%include <zypp/ResKind.h>
index 699c386..ec6f118 100644 (file)
@@ -1,3 +1,3 @@
-%ignore Package::checksum();
+//%ignore zypp::Package::checksum();
 %include <zypp/Package.h>
 
index 7377ea5..cd6406a 100644 (file)
@@ -1,6 +1,9 @@
 %include <zypp/PoolItem.h>
 
-//typedef PoolItem PoolItem;
+#ifdef SWIGPERL5
+#else
+%template(PoolItemSet) std::set<zypp::PoolItem>;
+#endif
 
 %extend zypp::PoolItem
 {
@@ -10,4 +13,4 @@
     str << *self;
     return str.str();
   }
-}
\ No newline at end of file
+}
index 0597835..d0094ae 100644 (file)
@@ -4,7 +4,5 @@
 #endif
 
 %include <zypp/RepoInfo.h>
-
-typedef std::list<RepoInfo> RepoInfoList;
-%template(RepoInfoList) std::list<RepoInfo>;
-
+typedef std::list<zypp::RepoInfo> RepoInfoList;
+%template(RepoInfoList) std::list<zypp::RepoInfo>;
index 6275777..e27af80 100644 (file)
@@ -1,92 +1,2 @@
-#if 1
-    ///////////////////////////////////////////////////////////////////
-    //
-    // CLASS NAME : Repository
-    //
-    /** */
-    class Repository : protected sat::detail::PoolMember,
-                 private base::SafeBool<Repository>
-    {
-    public:
-        typedef filter_iterator<detail::ByRepository, sat::detail::SolvableIterator> SolvableIterator;
-        typedef sat::detail::size_type size_type;
 
-    public:
-        /** Default ctor creates \ref noRepository.*/
-        Repository();
-
-        /** \ref PoolImpl ctor. */
-        explicit Repository( sat::detail::RepoIdType id_r );
-
-    public:
-        /** Represents no \ref Repository. */
-        static const Repository noRepository;
-
-        /** Return whether this is the system repository. */
-        bool isSystemRepo() const;
-
-    public:
-        /** The repos name (alias). */
-        std::string name() const;
-
-        /** Whether \ref Repository contains solvables. */
-        bool solvablesEmpty() const;
-
-        /** Number of solvables in \ref Repository. */
-        size_type solvablesSize() const;
-
-        /** Iterator to the first \ref Solvable. */
-        SolvableIterator solvablesBegin() const;
-
-        /** Iterator behind the last \ref Solvable. */
-        SolvableIterator solvablesEnd() const;
-
-    public:
-        /** Return any associated \ref RepoInfo. */
-        RepoInfo info() const;
-
-        /** Set \ref RepoInfo for this repository.
-         * \throws Exception if this is \ref noRepository
-         * \throws Exception if the \ref RepoInfo::alias
-         *         does not match the \ref Repository::name.
-        */
-        void setInfo( const RepoInfo & info_r );
-
-       /** Remove any \ref RepoInfo set for this repository. */
-        void clearInfo();
-
-    public:
-        /** Remove this \ref Repository from it's \ref Pool. */
-        void eraseFromPool();
-
-        /** Functor calling \ref eraseFromPool. */
-        struct EraseFromPool;
-
-    public:
-        /** \name Repository content manipulating methods.
-         * \todo maybe a separate Repository/Solvable content manip interface
-         * provided by the pool.
-         */
-        //@{
-        /** Load \ref Solvables from a solv-file.
-         * In case of an exception the repository remains in the \ref Pool.
-         * \throws Exception if this is \ref noRepository
-         * \throws Exception if loading the solv-file fails.
-         * \see \ref Pool::addRepoSolv and \ref Repository::EraseFromPool
-         */
-        void addSolv( const Pathname & file_r );
-
-        /** Add \c count_r new empty \ref Solvable to this \ref Repository. */
-        sat::detail::SolvableIdType addSolvables( unsigned count_r );
-        /** \overload Add only one new \ref Solvable. */
-        sat::detail::SolvableIdType addSolvable();
-        //@}
-
-    public:
-        /** Expert backdoor. */
-        ::_Repo * get() const;
-        /** Expert backdoor. */
-        sat::detail::RepoIdType id() const { return _id; }
-    };
-    ///////////////////////////////////////////////////////////////////
-#endif
\ No newline at end of file
+%include <zypp/Repository.h>
index 8a7db5a..53c22a0 100644 (file)
@@ -1,3 +1,4 @@
+%ignore zypp::make_res_object;
 
 %include <zypp/ResObject.h>
 
index 640f0cf..7002ccf 100644 (file)
-namespace zypp {
-%apply unsigned { ResPool::size_type };
+%nodefault zypp::ResPool;
 
-%nodefault ResPool;
-%ignore ResPool::byKindBegin;
-%ignore ResPool::byKindEnd;
-%ignore ResPool::byNameBegin;
-%ignore ResPool::byNameEnd;
+// missing resfilter:: to call these
+%ignore zypp::ResPool::byKindBegin;
+%ignore zypp::ResPool::byKindEnd;
+%ignore zypp::ResPool::byNameBegin;
+%ignore zypp::ResPool::byNameEnd;
 
+%apply unsigned { zypp::ResPool::size_type };
 
+%include <zypp/ResPool.h>
 
-class ResPool
-  {
-    friend std::ostream & operator<<( std::ostream & str, const ResPool & obj );
-
-    public:
-      /** \ref PoolItem */
-      typedef PoolItem                                  value_type;
-      typedef pool::PoolTraits::size_type               size_type;
-      typedef pool::PoolTraits::const_iterator          const_iterator;
-
-      typedef pool::PoolTraits::byCapabilityIndex_iterator byCapabilityIndex_iterator;
-      typedef pool::PoolTraits::repository_iterator        repository_iterator;
-
-    public:
-      /** Singleton ctor. */
-      static ResPool instance();
-
-      /** preliminary */
-      ResPoolProxy proxy() const;
-
-    public:
-      /** The pools serial number. Changing whenever the
-       * whenever the content changes. (Resolvables or
-       * Dependencies).
-       */
-      const SerialNumber & serial() const;
-
-    public:
-      /**  */
-      bool empty() const;
-      /**  */
-      size_type size() const;
-
-      /** */
-      const_iterator begin() const;
-      const_iterator end() const;
-
-    public:
-      /** Return the corresponding \ref PoolItem.
-       * Pool and sat pool should be in sync. Returns an empty
-       * \ref PoolItem if there is no corresponding \ref PoolItem.
-       * \see \ref PoolItem::satSolvable.
-       */
-      PoolItem find( const sat::Solvable & slv_r ) const;
-
-    public:
-      /** \name Iterate through all PoolItems matching a \c _Filter. */
-      //@{
-      template<class _Filter>
-          filter_iterator<_Filter,const_iterator> filterBegin( const _Filter & filter_r ) const
-      { return make_filter_begin( filter_r, *this ); }
-
-      template<class _Filter>
-          filter_iterator<_Filter,const_iterator> filterEnd( const _Filter & filter_r ) const
-      { return make_filter_end( filter_r, *this ); }
-      //@}
-
-    public:
-      /** \name Iterate through all PoolItems of a certain name and kind. */
-      //@{
-      typedef pool::ByIdent                       ByIdent;
-      typedef pool::PoolTraits::byIdent_iterator  byIdent_iterator;
-
-      byIdent_iterator byIdentBegin( const ByIdent & ident_r ) const
-      {
-       return make_transform_iterator( id2item().equal_range( ident_r.get() ).first,
-                                        pool::PoolTraits::Id2ItemValueSelector() );
-      }
-
-      byIdent_iterator byIdentBegin( ResKind kind_r, IdString name_r ) const
-      { return byIdentBegin( ByIdent(kind_r,name_r) ); }
-
-      byIdent_iterator byIdentBegin( ResKind kind_r, const C_Str & name_r ) const
-      { return byIdentBegin( ByIdent(kind_r,name_r) ); }
-
-      template<class _Res>
-      byIdent_iterator byIdentBegin( IdString name_r ) const
-      { return byIdentBegin( ByIdent(ResTraits<_Res>::kind,name_r) ); }
-
-      template<class _Res>
-      byIdent_iterator byIdentBegin( const C_Str & name_r ) const
-      { return byIdentBegin( ByIdent(ResTraits<_Res>::kind,name_r) ); }
-
-      /** Derive name and kind from \ref PoolItem. */
-      byIdent_iterator byIdentBegin( const PoolItem & pi_r ) const
-      { return byIdentBegin( ByIdent(pi_r.satSolvable()) ); }
-      /** Derive name and kind from \ref sat::Solvable. */
-      byIdent_iterator byIdentBegin( sat::Solvable slv_r ) const
-      { return byIdentBegin( ByIdent(slv_r) ); }
-      /** Takes a \ref sat::Solvable::ident string. */
-      byIdent_iterator byIdentBegin( IdString ident_r ) const
-      { return byIdentBegin( ByIdent(ident_r) ); }
-
-
-      byIdent_iterator byIdentEnd( const ByIdent & ident_r ) const
-      {
-       return make_transform_iterator( id2item().equal_range( ident_r.get() ).second,
-                                        pool::PoolTraits::Id2ItemValueSelector() );
-      }
-
-      byIdent_iterator byIdentEnd( ResKind kind_r, IdString name_r ) const
-      { return byIdentEnd( ByIdent(kind_r,name_r) ); }
-
-      byIdent_iterator byIdentEnd( ResKind kind_r, const C_Str & name_r ) const
-      { return byIdentEnd( ByIdent(kind_r,name_r) ); }
-
-      template<class _Res>
-      byIdent_iterator byIdentEnd( IdString name_r ) const
-      { return byIdentEnd( ByIdent(ResTraits<_Res>::kind,name_r) ); }
-
-      template<class _Res>
-      byIdent_iterator byIdentEnd( const C_Str & name_r ) const
-      { return byIdentEnd( ByIdent(ResTraits<_Res>::kind,name_r) ); }
-
-      /** Derive name and kind from \ref PoolItem. */
-      byIdent_iterator byIdentEnd( const PoolItem & pi_r ) const
-      { return byIdentEnd( ByIdent(pi_r.satSolvable()) ); }
-      /** Derive name and kind from \ref sat::Solvable. */
-      byIdent_iterator byIdentEnd( sat::Solvable slv_r ) const
-      { return byIdentEnd( ByIdent(slv_r) ); }
-      /** Takes a \ref sat::Solvable::ident string. */
-      byIdent_iterator byIdentEnd( IdString ident_r ) const
-      { return byIdentEnd( ByIdent(ident_r) ); }
-     //@}
-
-    public:
-      /** \name Iterate through all ResObjects of a certain kind. */
-      //@{
-      typedef zypp::resfilter::ByKind ByKind;
-      typedef filter_iterator<ByKind,const_iterator> byKind_iterator;
-
-      byKind_iterator byKindBegin( const ResKind & kind_r ) const
-      { return make_filter_begin( ByKind(kind_r), *this ); }
-
-      template<class _Res>
-          byKind_iterator byKindBegin() const
-      { return make_filter_begin( resfilter::byKind<_Res>(), *this ); }
-
-      byKind_iterator byKindEnd( const ResKind & kind_r ) const
-      { return make_filter_end( ByKind(kind_r), *this ); }
-
-      template<class _Res>
-          byKind_iterator byKindEnd() const
-      { return make_filter_end( resfilter::byKind<_Res>(), *this ); }
-      //@}
-
-    public:
-      /** \name Iterate through all ResObjects with a certain name (all kinds).
-       * \deprecated Instead of iterating byName and filter byKind use ByIdent iterator.
-      */
-      //@{
-      typedef zypp::resfilter::ByName ByName;
-      typedef filter_iterator<ByName,const_iterator> byName_iterator;
-
-
-
-    public:
-      /** \name Iterate through all Repositories that contribute ResObjects.
-       */
-      //@{
-      size_type knownRepositoriesSize() const;
-
-      repository_iterator knownRepositoriesBegin() const;
-
-      repository_iterator knownRepositoriesEnd() const;
-      //@}
-
-     public:
-      /** \name Iterate through requested/available Locales.
-       */
-      //@{
-      /** Set the requested locales.
-       * Languages to be supported by the system, e.g. language specific
-       * packages to be installed.
-       */
-      void setRequestedLocales( const LocaleSet & locales_r );
-
-      /** Add one \ref Locale to the set of requested locales.
-       * Return \c true if \c locale_r was newly added to the set.
-      */
-      bool addRequestedLocale( const Locale & locale_r );
-
-      /** Erase one \ref Locale from the set of requested locales.
-      * Return \c false if \c locale_r was not found in the set.
-       */
-      bool eraseRequestedLocale( const Locale & locale_r );
-
-      /** Return the requested locales.
-       * \see \ref setRequestedLocales
-      */
-      const LocaleSet & getRequestedLocales() const;
-
-      /** Wheter this \ref Locale is in the set of requested locales. */
-      bool isRequestedLocale( const Locale & locale_r ) const;
-
-      /** Get the set of available locales.
-       * This is computed from the package data so it actually
-       * represents all locales packages claim to support.
-       */
-      const LocaleSet & getAvailableLocales() const;
-
-      /** Wheter this \ref Locale is in the set of available locales. */
-      bool isAvailableLocale( const Locale & locale_r ) const;
-      //@}
-
-    private:
-      const pool::PoolTraits::ItemContainerT & store() const;
-      const pool::PoolTraits::Id2ItemT & id2item() const;
-
-    private:
-      /** Ctor */
-      ResPool( pool::PoolTraits::Impl_constPtr impl_r );
-      /** Const access to implementation. */
-      pool::PoolTraits::Impl_constPtr _pimpl;
-  };
-
+namespace zypp
+{
 
 #ifdef SWIGPERL5
 
@@ -272,7 +59,6 @@ iter3(ResPool, PoolItem*);
 #endif
 
 #ifdef SWIGPYTHON
-%template(PoolItemSet) std::set<PoolItem>;
 %newobject ResPool::const_iterator(PyObject **PYTHON_SELF);
 %extend  ResPool {
   swig::PySwigIterator* iterator(PyObject **PYTHON_SELF)
index 73510c8..e91df8c 100644 (file)
@@ -17,7 +17,7 @@
    };
 #endif
 
-%extend ResStatus
+%extend zypp::ResStatus
 {
   std::string asString() const
   {
index 155cf20..7055b9f 100644 (file)
@@ -1,4 +1,4 @@
-
+%ignore zypp::make;
 %import <zypp/sat/Solvable.h>
 %include <zypp/Resolvable.h>
 
index 16f3b8c..7e9f2e1 100644 (file)
@@ -3,6 +3,8 @@
 #endif
 
 %include <zypp/Resolver.h>
-
+namespace zypp
+{
 typedef intrusive_ptr<Resolver> Resolver_Ptr;
 %template(Resolver_Ptr) intrusive_ptr<Resolver>;
+}
\ No newline at end of file
index cf7a1d5..31e2feb 100644 (file)
@@ -1,6 +1,7 @@
 
-typedef intrusive_ptr<Target> Target_Ptr;
-
 %include <zypp/Target.h>
-
+namespace zypp
+{
+typedef intrusive_ptr<Target> Target_Ptr;
 %template(Target_Ptr) intrusive_ptr<Target>;
+}
index f1f28fa..1c1d676 100644 (file)
@@ -1,7 +1,9 @@
 
+%include <zypp/ZYppFactory.h>
+
 namespace zypp
 {
+typedef intrusive_ptr<ZYpp> ZYpp_Ptr;
 %template(ZYpp_Ptr) intrusive_ptr<ZYpp>;
 }
 
-%include <zypp/ZYppFactory.h>
index 58edcc7..d9d9d9d 100644 (file)
@@ -1,4 +1,6 @@
 
+%ignore zypp::Arch_empty;
+
 namespace zypp
 {
     // These operators must be ignored otherwise the wrapper does
@@ -6,6 +8,14 @@ namespace zypp
     %ignore operator<<;
     %ignore operator==;
     %ignore operator!=;
+
+    namespace filesystem
+    {
+       // Same as above.
+       %ignore operator==;
+       %ignore operator!=;
+       %ignore operator<<;
+    }
 }
 
 %define iter(cls, storetype)
index 6984736..139cc2d 100644 (file)
@@ -2,6 +2,7 @@
 
 %rename *::asString "__str__";
 
+%ignore zypp::Arch_empty;
 
 namespace zypp
 {
@@ -18,7 +19,7 @@ namespace zypp
       // not compile (using swig 1.3.29).
       %ignore operator==;
       %ignore operator!=;
-  
+
       // Just to avoid warnings.
       %ignore operator<<;
   }
index 1f7c10c..cf8576e 100644 (file)
@@ -1,8 +1,6 @@
 
-
 %rename *::asString "__str__";
 
-
 namespace zypp
 {
     // Not ignoring gives a very strange error in the "pokus" testsuite: SWIG
index 81fbb2a..d844170 100644 (file)
@@ -69,7 +69,7 @@ typedef std::list<std::string> StringList;
 template < typename T >
 class intrusive_ptr {
   public:
-  T *operator->();
+    T *operator->();
 };
 
 namespace zypp {
@@ -100,6 +100,7 @@ namespace zypp {
 %include "perl5/perl.i"
 #endif
 
+%include "IdStringType.i"
 %include "Pathname.i"
 %include "Url.i"
 %include "ResStatus.i"
@@ -142,59 +143,5 @@ namespace zypp {
 %include "python/callbacks.i"
 #endif
 
-class ZYpp
-{
-  public:
-    typedef intrusive_ptr<ZYpp>       Ptr;
-    typedef intrusive_ptr<const ZYpp> constPtr;
-  public:
-
-    //ResPool pool() const;
-    //ResPoolProxy poolProxy() const;
-
-    /*
-    DiskUsageCounter::MountPointSet diskUsage();
-    void setPartitions(const DiskUsageCounter::MountPointSet &mp);
-    */
-    Target_Ptr target() const;
-    void initializeTarget(const zypp::Pathname & root);
-    void finishTarget();
-
-    typedef ZYppCommitResult CommitResult;
-    ZYppCommitResult commit( const ZYppCommitPolicy & policy_r );
-
-    Resolver_Ptr resolver() const;
-    KeyRing_Ptr keyRing() const;
-
-     /*
-    void setTextLocale( const Locale & textLocale_r );
-    Locale getTextLocale() const;
-    typedef std::set<Locale> LocaleSet;
-    void setRequestedLocales( const LocaleSet & locales_r );
-    LocaleSet getRequestedLocales() const;
-    LocaleSet getAvailableLocales() const;
-    void availableLocale( const Locale & locale_r );
-    */
-    zypp::Pathname homePath() const;
-    zypp::Pathname tmpPath() const;
-    void setHomePath( const zypp::Pathname & path );
-
-    Arch architecture() const;
-    void setArchitecture( const Arch & arch );
-
-   /**
-    * \short Apply persistant locks to current pool.
-    * Call this before solving
-    *
-    * \returns Number of items locked
-    */
-   int applyLocks();
-
-    protected:
-    virtual ~ZYpp();
-    private:
-    friend class ZYppFactory;
-    explicit ZYpp( const Impl_Ptr & impl_r );
-};
-
+%include <zypp/ZYpp.h>
 %include "ZYppFactory.i"