Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=84cd20a8a37431ba98baed9fdfc3345682d62188

commit 84cd20a8a37431ba98baed9fdfc3345682d62188
Author: Michel Hermier <[email protected]>
Date:   Tue Nov 4 12:13:53 2014 +0100

libpacman: Rename FList to flib::list.

diff --git a/lib/libpacman/database_cache.cpp b/lib/libpacman/database_cache.cpp
index 7d8863c..8f934ca 100644
--- a/lib/libpacman/database_cache.cpp
+++ b/lib/libpacman/database_cache.cpp
@@ -42,6 +42,7 @@
#include "handle.h"
#include "error.h"

+using namespace flib;
using namespace libpacman;

static
@@ -129,7 +130,7 @@ int Database::remove_pkgfromcache(package_ptr pkg)
}

static
-Group *_pacman_db_get_grpfromlist(const FList<Group *> &list, const char 
*target)
+Group *_pacman_db_get_grpfromlist(const list<Group *> &list, const char 
*target)
{
if(_pacman_strempty(target)) {
return(NULL);
diff --git a/lib/libpacman/deps.cpp b/lib/libpacman/deps.cpp
index 3e76f2c..d21bf06 100644
--- a/lib/libpacman/deps.cpp
+++ b/lib/libpacman/deps.cpp
@@ -42,6 +42,7 @@
#include "versioncmp.h"
#include "handle.h"

+using namespace flib;
using namespace libpacman;

typedef struct __pmgraph_t {
@@ -50,7 +51,7 @@ typedef struct __pmgraph_t {
{ }

pmsyncpkg_t *data;
-       FList<__pmgraph_t *> children;
+       list<__pmgraph_t *> children;

int state; /* 0: untouched, -1: entered, other: leaving time */
struct __pmgraph_t *parent; /* where did we come from? */
@@ -111,7 +112,7 @@ FPtrList &_pacman_depmisslist_add(FPtrList &misslist, 
pmdepmissing_t *miss)
*/
void pmtrans_t::sortbydeps(int mode)
{
-       FList<pmgraph_t *> vertices;
+       list<pmgraph_t *> vertices;
pmgraph_t *vertex;
int found;

diff --git a/lib/libpacman/handle.h b/lib/libpacman/handle.h
index a205f8d..ceae0d6 100644
--- a/lib/libpacman/handle.h
+++ b/lib/libpacman/handle.h
@@ -65,7 +65,7 @@ public:
pmaccess_t access;
uid_t uid;
libpacman::Database *db_local;
-       FList<libpacman::Database *> dbs_sync;
+       flib::list<libpacman::Database *> dbs_sync;
FILE *logfd;
FFileLock *filelock;
pmtrans_t *trans;
diff --git a/lib/libpacman/package.h b/lib/libpacman/package.h
index 5f1dec1..04c8567 100644
--- a/lib/libpacman/package.h
+++ b/lib/libpacman/package.h
@@ -179,7 +179,7 @@ public:
typedef flib::refcounted_shared_ptr<package> package_ptr;
bool operator < (const package_ptr &pkg1, const package_ptr &pkg2);

-       typedef FList<package_ptr> package_list;
+       typedef flib::list<package_ptr> package_list;
typedef flib::set<libpacman::package_ptr> package_set;

class PackageMatcher
diff --git a/lib/libpacman/pacman_p.h b/lib/libpacman/pacman_p.h
index cbcf173..d8d57e0 100644
--- a/lib/libpacman/pacman_p.h
+++ b/lib/libpacman/pacman_p.h
@@ -54,11 +54,11 @@ DEFINE_CAST(struct __pmpkg_t, libpacman::package)
//DEFINE_CAST(struct __pmtrans_t, libpacman::Transaction)

template <typename T>
-static inline __pmlist_t *c_cast(FList<T> &obj)
+static inline __pmlist_t *c_cast(flib::list<T> &obj)
{ return (__pmlist_t *)&obj; }

template <typename T>
-static inline __pmlist_t *c_cast(FList<T> *obj)
+static inline __pmlist_t *c_cast(flib::list<T> *obj)
{ return (__pmlist_t *)obj; }

static inline struct __pmpkg_t *c_cast(const libpacman::package_ptr &obj)
diff --git a/lib/libpacman/trans.h b/lib/libpacman/trans.h
index 6b387ee..903e015 100644
--- a/lib/libpacman/trans.h
+++ b/lib/libpacman/trans.h
@@ -82,7 +82,7 @@ struct __pmtrans_t
int flags;
unsigned char state;
FStringList targets;
-       FList<pmsyncpkg_t *> syncpkgs;
+       flib::list<pmsyncpkg_t *> syncpkgs;
flib::str_set skiplist;
FStringList triggers;

diff --git a/lib/libpacman/util/flist.h b/lib/libpacman/util/flist.h
index 17b9a69..fc4a429 100644
--- a/lib/libpacman/util/flist.h
+++ b/lib/libpacman/util/flist.h
@@ -550,309 +550,309 @@ namespace flib
return i->operator * ();
}
};
-}

-template <typename T>
-class FList
-       : protected flib::FCListItem
-{
-public:
-       typedef flib::FListItem<T> *iterable;
-
-       /* std::list compatibility */
-       typedef T value_type;
-       typedef flib::iterator<iterable> iterator;
-       typedef flib::iterator<iterable, true> reverse_iterator;
-       typedef flib::const_iterator<iterable> const_iterator;
-       typedef flib::const_iterator<iterable, true> const_reverse_iterator;
-       typedef size_t size_type;
-
-       FList()
-               : FCListItem(this, this)
-       { }
-
-       FList(FList &&o)
-               : FList()
+       template <typename T>
+       class list
+               : protected FCListItem
{
-               swap(o);
-       }
+       public:
+               typedef flib::FListItem<T> *iterable;

-       FList &operator = (FList &&o)
-       {
-               swap(o);
-               return *this;
-       }
+               /* std::list compatibility */
+               typedef T value_type;
+               typedef flib::iterator<iterable> iterator;
+               typedef flib::iterator<iterable, true> reverse_iterator;
+               typedef flib::const_iterator<iterable> const_iterator;
+               typedef flib::const_iterator<iterable, true> 
const_reverse_iterator;
+               typedef size_t size_type;

-       virtual ~FList() override
-       {
-               clear();
-       }
+               list()
+                       : FCListItem(this, this)
+               { }

-       /* Iterators */
-       iterator begin()
-       {
-               return iterator(c_first());
-       }
+               list(list &&o)
+                       : list()
+               {
+                       swap(o);
+               }

-       const_iterator begin() const
-       {
-               return cbegin();
-       }
+               list &operator = (list &&o)
+               {
+                       swap(o);
+                       return *this;
+               }

-       const_iterator cbegin() const
-       {
-               return const_iterator(c_first());
-       }
+               virtual ~list() override
+               {
+                       clear();
+               }

-       reverse_iterator rbegin()
-       {
-               return reverse_iterator(c_last());
-       }
+               /* Iterators */
+               iterator begin()
+               {
+                       return iterator(c_first());
+               }

-       const_reverse_iterator rbegin() const
-       {
-               return crbegin();
-       }
+               const_iterator begin() const
+               {
+                       return cbegin();
+               }

-       const_reverse_iterator crbegin() const
-       {
-               return const_reverse_iterator(c_last());
-       }
+               const_iterator cbegin() const
+               {
+                       return const_iterator(c_first());
+               }

-       iterator end()
-       {
-               return iterator(c_end());
-       }
+               reverse_iterator rbegin()
+               {
+                       return reverse_iterator(c_last());
+               }

-       const_iterator end() const
-       {
-               return cend();
-       }
+               const_reverse_iterator rbegin() const
+               {
+                       return crbegin();
+               }

-       const_iterator cend() const
-       {
-               return const_iterator(c_end());
-       }
+               const_reverse_iterator crbegin() const
+               {
+                       return const_reverse_iterator(c_last());
+               }

-       reverse_iterator rend()
-       {
-               return reverse_iterator(c_end());
-       }
+               iterator end()
+               {
+                       return iterator(c_end());
+               }

-       const_reverse_iterator rend() const
-       {
-               return crend();
-       }
+               const_iterator end() const
+               {
+                       return cend();
+               }

-       const_reverse_iterator crend() const
-       {
-               return const_reverse_iterator(c_end());
-       }
+               const_iterator cend() const
+               {
+                       return const_iterator(c_end());
+               }

-       /* Capacity */
-       bool empty() const
-       {
-               return begin() == end();
-       }
+               reverse_iterator rend()
+               {
+                       return reverse_iterator(c_end());
+               }

-       size_type size() const
-       {
-               size_type size = 0;
-               for(auto it = cbegin(), end = cend(); it != end; ++it, ++size) {
-                       /* Nothing to do */
+               const_reverse_iterator rend() const
+               {
+                       return crend();
}
-               return size;
-       }

-       /* Element access */
-       bool contains(const value_type &val) const
-       {
-               return find(val) != end();
-       }
+               const_reverse_iterator crend() const
+               {
+                       return const_reverse_iterator(c_end());
+               }

-       iterator find(const value_type &val)
-       {
-               return flib::find(begin(), end(), val);
-       }
+               /* Capacity */
+               bool empty() const
+               {
+                       return begin() == end();
+               }

-       const_iterator find(const value_type &val) const
-       {
-               return flib::find(begin(), end(), val);
-       }
+               size_type size() const
+               {
+                       size_type size = 0;
+                       for(auto it = cbegin(), end = cend(); it != end; ++it, 
++size) {
+                               /* Nothing to do */
+                       }
+                       return size;
+               }

-       template <class UnaryPredicate>
-       iterator find_if(UnaryPredicate pred)
-       {
-               return flib::find_if(begin(), end(), pred);
-       }
+               /* Element access */
+               bool contains(const value_type &val) const
+               {
+                       return find(val) != end();
+               }

-       template <class UnaryPredicate>
-       const_iterator find_if(UnaryPredicate pred) const
-       {
-               return flib::find_if(begin(), end(), pred);
-       }
+               iterator find(const value_type &val)
+               {
+                       return flib::find(begin(), end(), val);
+               }

-       template <class UnaryPredicate>
-       iterator find_if_not(UnaryPredicate pred)
-       {
-               return flib::find_if_not(begin(), end(), pred);
-       }
+               const_iterator find(const value_type &val) const
+               {
+                       return flib::find(begin(), end(), val);
+               }

-       template <class UnaryPredicate>
-       const_iterator find_if_not(UnaryPredicate pred) const
-       {
-               return flib::find_if_not(begin(), end(), pred);
-       }
+               template <class UnaryPredicate>
+               iterator find_if(UnaryPredicate pred)
+               {
+                       return flib::find_if(begin(), end(), pred);
+               }

-       /* Modifiers */
-       template <class Function = ::flib::detail::null_visitor>
-       void clear(Function fn = Function())
-       {
-               erase(begin(), end(), fn);
-       }
+               template <class UnaryPredicate>
+               const_iterator find_if(UnaryPredicate pred) const
+               {
+                       return flib::find_if(begin(), end(), pred);
+               }

-       template <class Function = ::flib::detail::null_visitor>
-       iterator erase(iterator position, Function fn = Function())
-       {
-               ASSERT(position != c_end(), RET_ERR(PM_ERR_WRONG_ARGS, 
position));
+               template <class UnaryPredicate>
+               iterator find_if_not(UnaryPredicate pred)
+               {
+                       return flib::find_if_not(begin(), end(), pred);
+               }

-               iterable erased = (iterable)position;
-               iterable next = erased->next();
-               erased->remove();
-               delete erased;
-               return iterator(next);
-       }
+               template <class UnaryPredicate>
+               const_iterator find_if_not(UnaryPredicate pred) const
+               {
+                       return flib::find_if_not(begin(), end(), pred);
+               }

-       template <class Function = ::flib::detail::null_visitor>
-       iterator erase(iterator first, iterator last, Function fn = Function())
-       {
-               auto it = first;
-               while(it != last) {
-                       it = erase(it);
+               /* Modifiers */
+               template <class Function = ::flib::detail::null_visitor>
+               void clear(Function fn = Function())
+               {
+                       erase(begin(), end(), fn);
}
-               return it;
-       }

-       template <class Function = ::flib::detail::null_visitor>
-       size_type remove(const value_type &val, Function fn = Function())
-       {
-               return remove_if(
-                               [&] (const value_type &o) -> bool
-                               { return o == val; }, fn );
-       }
+               template <class Function = ::flib::detail::null_visitor>
+               iterator erase(iterator position, Function fn = Function())
+               {
+                       ASSERT(position != c_end(), RET_ERR(PM_ERR_WRONG_ARGS, 
position));

-       template <class UnaryPredicate, class Function = 
::flib::detail::null_visitor>
-       size_type remove_if(UnaryPredicate pred, Function fn = Function())
-       {
-               size_type size = 0;
-               iterator it = begin(), end = this->end();
-
-               while((it = flib::find_if(it, end, pred)) != end) {
-                       fn(*it);
-                       it = erase(it);
-                       ++size;
-               }
-               return size;
-       }
-
-       /* Observers */
-
-       /* Operations */
-       void reverse() {
-               FCListItem *it = this;
-               do {
-                       it->reverse();
-               } while ((it = it->next()) != this);
-       }
-
-public:
-       /* extensions */
-       iterator first()
-       {
-               return iterator(c_first());
-       }
+                       iterable erased = (iterable)position;
+                       iterable next = erased->next();
+                       erased->remove();
+                       delete erased;
+                       return iterator(next);
+               }

-       const_iterator first() const
-       {
-               return const_iterator(c_first());
-       }
+               template <class Function = ::flib::detail::null_visitor>
+               iterator erase(iterator first, iterator last, Function fn = 
Function())
+               {
+                       auto it = first;
+                       while(it != last) {
+                               it = erase(it);
+                       }
+                       return it;
+               }

-       iterator last()
-       {
-               return iterator(c_last());
-       }
+               template <class Function = ::flib::detail::null_visitor>
+               size_type remove(const value_type &val, Function fn = 
Function())
+               {
+                       return remove_if(
+                                       [&] (const value_type &o) -> bool
+                                       { return o == val; }, fn );
+               }

-       const_iterator last() const
-       {
-               return const_iterator(c_last());
-       }
+               template <class UnaryPredicate, class Function = 
::flib::detail::null_visitor>
+               size_type remove_if(UnaryPredicate pred, Function fn = 
Function())
+               {
+                       size_type size = 0;
+                       iterator it = begin(), end = this->end();

-       virtual iterator add(const value_type &val)
-       {
-               // Default implementation is append
-               iterable newItem = new flib::FListItem<T>(val);
-               newItem->insert_after(last());
-               return iterator(newItem);
-       }
-
-       void swap(FList &o) {
-               FCListItem::swap(o);
-       }
-
-       template <class U>
-       bool all_match(const U &val) const
-       {
-               return flib::all_match(begin(), end(), val);
-       }
+                       while((it = flib::find_if(it, end, pred)) != end) {
+                               fn(*it);
+                               it = erase(it);
+                               ++size;
+                       }
+                       return size;
+               }

-       template <class UnaryPredicate>
-       bool all_match_if(UnaryPredicate pred) const
-       {
-               return flib::all_match_if(begin(), end(), pred);
-       }
+               /* Observers */

-       template <class U>
-       bool any_match(const U &val) const
-       {
-               return flib::any_match(begin(), end(), val());
-       }
+               /* Operations */
+               void reverse() {
+                       FCListItem *it = this;
+                       do {
+                               it->reverse();
+                       } while ((it = it->next()) != this);
+               }

-       template <class UnaryPredicate>
-       bool any_match_if(UnaryPredicate pred)
-       {
-               return flib::any_match_if(begin(), end(), pred);
-       }
+       public:
+               /* extensions */
+               iterator first()
+               {
+                       return iterator(c_first());
+               }

-public:
-       iterable c_first() const
-       {
-               ASSERT(this != NULL, RET_ERR(PM_ERR_WRONG_ARGS, NULL));
-               return static_cast<iterable>(m_next);
-       }
+               const_iterator first() const
+               {
+                       return const_iterator(c_first());
+               }

-       iterable c_last() const
-       {
-               ASSERT(this != NULL, RET_ERR(PM_ERR_WRONG_ARGS, NULL));
-               return static_cast<iterable>(m_previous);
-       }
+               iterator last()
+               {
+                       return iterator(c_last());
+               }

-       iterable c_end() const
-       {
-               ASSERT(this != NULL, RET_ERR(PM_ERR_WRONG_ARGS, NULL));
-               return static_cast<iterable>((FCListItem *)this);
-       }
+               const_iterator last() const
+               {
+                       return const_iterator(c_last());
+               }
+
+               virtual iterator add(const value_type &val)
+               {
+                       // Default implementation is append
+                       iterable newItem = new flib::FListItem<T>(val);
+                       newItem->insert_after(last());
+                       return iterator(newItem);
+               }

-private:
-       FList(const FList &);
-       FList &operator = (const FList &);
+               void swap(list &o) {
+                       FCListItem::swap(o);
+               }
+
+               template <class U>
+               bool all_match(const U &val) const
+               {
+                       return flib::all_match(begin(), end(), val);
+               }
+
+               template <class UnaryPredicate>
+               bool all_match_if(UnaryPredicate pred) const
+               {
+                       return flib::all_match_if(begin(), end(), pred);
+               }
+
+               template <class U>
+               bool any_match(const U &val) const
+               {
+                       return flib::any_match(begin(), end(), val());
+               }
+
+               template <class UnaryPredicate>
+               bool any_match_if(UnaryPredicate pred)
+               {
+                       return flib::any_match_if(begin(), end(), pred);
+               }
+
+       public:
+               iterable c_first() const
+               {
+                       ASSERT(this != NULL, RET_ERR(PM_ERR_WRONG_ARGS, NULL));
+                       return static_cast<iterable>(m_next);
+               }
+
+               iterable c_last() const
+               {
+                       ASSERT(this != NULL, RET_ERR(PM_ERR_WRONG_ARGS, NULL));
+                       return static_cast<iterable>(m_previous);
+               }
+
+               iterable c_end() const
+               {
+                       ASSERT(this != NULL, RET_ERR(PM_ERR_WRONG_ARGS, NULL));
+                       return static_cast<iterable>((FCListItem *)this);
+               }
+
+       private:
+               list(const list &);
+               list &operator = (const list &);

#if 0
-       virtual void *c_data() const override
-       {
-               RET_ERR(PM_ERR_WRONG_ARGS, NULL);
-       }
+               virtual void *c_data() const override
+               {
+                       RET_ERR(PM_ERR_WRONG_ARGS, NULL);
+               }
#endif
-};
+       };
+} // namespace flib
#endif /* __cplusplus */

#endif /* F_LIST_H */
diff --git a/lib/libpacman/util/fptrlist.h b/lib/libpacman/util/fptrlist.h
index 6de17d0..52a6202 100644
--- a/lib/libpacman/util/fptrlist.h
+++ b/lib/libpacman/util/fptrlist.h
@@ -32,7 +32,7 @@
typedef struct FPtrList FPtrList;
typedef struct FPtrListIterator FPtrListIterator;
#else /* __cplusplus */
-typedef class FList<void *> FPtrList;
+typedef class flib::list<void *> FPtrList;
typedef class flib::FListItem<void *> FPtrListItem;
typedef FPtrListItem FPtrListIterator;

diff --git a/lib/libpacman/util/fset.h b/lib/libpacman/util/fset.h
index 4aa98c8..4d97bb5 100644
--- a/lib/libpacman/util/fset.h
+++ b/lib/libpacman/util/fset.h
@@ -30,14 +30,16 @@ namespace flib
{
template <class T, class Compare = std::less<T>>
class set
-               : public FList<T>
+               : public flib::list<T>
{
public:
-               using typename FList<T>::iterable;
-               using typename FList<T>::iterator;
-               using typename FList<T>::value_type;
+               typedef flib::list<T> super_type;

-               using FList<T>::FList;
+               using typename super_type::iterable;
+               using typename super_type::iterator;
+               using typename super_type::value_type;
+
+               using super_type::list;

typedef Compare key_compare;
typedef Compare value_compare;
@@ -84,7 +86,7 @@ namespace flib
/* Return the first iterator where value does not satisfy Compare */
iterator find_insertion_point(const value_type &data)
{
-                       return FList<T>::find_if_not([&] (const T &o) -> bool { 
return m_compare(o, data); });
+                       return super_type::find_if_not([&] (const T &o) -> bool 
{ return m_compare(o, data); });
}

Compare m_compare;
diff --git a/lib/libpacman/util/fstringlist.h b/lib/libpacman/util/fstringlist.h
index c241efa..ae66f9e 100644
--- a/lib/libpacman/util/fstringlist.h
+++ b/lib/libpacman/util/fstringlist.h
@@ -48,11 +48,12 @@ int f_stringlist_clear(FStringList *self);
}

class FStringList
-       : public FList<const char *>
+       : public flib::list<const char *>
{
public:
-       typedef typename FList<const char *>::iterator iterator;
-       typedef typename FList<const char *>::const_iterator const_iterator;
+       typedef flib::list<const char *> super_type;
+       using typename super_type::iterator;
+       using typename super_type::const_iterator;

FStringList()
{ }
@@ -64,7 +65,7 @@ public:
}

FStringList(FStringList &&o)
-               : FList(std::move(o))
+               : super_type(std::move(o))
{ }

FStringList &operator = (const FStringList &o)
@@ -83,7 +84,7 @@ public:

FStringList &add_nocopy(char *s)
{
-               FList::add(s);
+               super_type::add(s);
return *this;
}
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to