[glibmm] Fixed code style.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Fixed code style.
- Date: Thu, 27 Jan 2011 13:27:48 +0000 (UTC)
commit e648536ce4ef2b2ffbc127a2736aed4c3553d84d
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Jan 27 14:27:40 2011 +0100
Fixed code style.
glib/glibmm/vectorutils.cc | 24 ++--
glib/glibmm/vectorutils.h | 376 +++++++++++++++++++-------------------
tests/glibmm_bool_vector/main.cc | 36 ++--
tests/glibmm_vector/main.cc | 360 ++++++++++++++++++------------------
4 files changed, 399 insertions(+), 397 deletions(-)
---
diff --git a/glib/glibmm/vectorutils.cc b/glib/glibmm/vectorutils.cc
index c264c79..caf3891 100644
--- a/glib/glibmm/vectorutils.cc
+++ b/glib/glibmm/vectorutils.cc
@@ -23,13 +23,13 @@ namespace Glib
namespace Container_Helpers
{
-gboolean* create_bool_array (std::vector<bool>::const_iterator pbegin,
+gboolean* create_bool_array(std::vector<bool>::const_iterator pbegin,
size_t size)
{
- gboolean *const array (static_cast<gboolean*>(g_malloc((size + 1) * sizeof (gboolean))));
- gboolean *const array_end (array + size);
+ gboolean *const array(static_cast<gboolean*>(g_malloc((size + 1) * sizeof(gboolean))));
+ gboolean *const array_end(array + size);
- for (gboolean* pdest (array); pdest != array_end; ++pdest)
+ for(gboolean* pdest(array); pdest != array_end; ++pdest)
{
*pdest = *pbegin;
++pbegin;
@@ -44,16 +44,16 @@ gboolean* create_bool_array (std::vector<bool>::const_iterator pbegin,
/**** Glib::ArrayHandler<bool> ************************/
ArrayHandler<bool, Glib::Container_Helpers::TypeTraits<bool> >::VectorType
-ArrayHandler<bool, Glib::Container_Helpers::TypeTraits<bool> >::array_to_vector (const CType* array, size_t array_size, Glib::OwnershipType ownership)
+ArrayHandler<bool, Glib::Container_Helpers::TypeTraits<bool> >::array_to_vector(const CType* array, size_t array_size, Glib::OwnershipType ownership)
{
// it will handle destroying data depending on passed ownership.
- ArrayKeeperType keeper (array, array_size, ownership);
+ ArrayKeeperType keeper(array, array_size, ownership);
#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS
- return VectorType (ArrayIteratorType (array), ArrayIteratorType (array + array_size));
+ return VectorType(ArrayIteratorType(array), ArrayIteratorType(array + array_size));
#else
VectorType temp;
- temp.reserve (array_size);
- Glib::Container_Helpers::fill_container (temp, ArrayIteratorType (array), ArrayIteratorType (array + array_size));
+ temp.reserve(array_size);
+ Glib::Container_Helpers::fill_container(temp, ArrayIteratorType(array), ArrayIteratorType(array + array_size));
return temp;
#endif
}
@@ -61,13 +61,13 @@ ArrayHandler<bool, Glib::Container_Helpers::TypeTraits<bool> >::array_to_vector
ArrayHandler<bool, Glib::Container_Helpers::TypeTraits<bool> >::VectorType
ArrayHandler<bool, Glib::Container_Helpers::TypeTraits<bool> >::array_to_vector(const CType* array, Glib::OwnershipType ownership)
{
- return array_to_vector (array, Glib::Container_Helpers::compute_array_size2 (array), ownership);
+ return array_to_vector(array, Glib::Container_Helpers::compute_array_size2(array), ownership);
}
ArrayHandler<bool, Glib::Container_Helpers::TypeTraits<bool> >::ArrayKeeperType
-ArrayHandler<bool, Glib::Container_Helpers::TypeTraits<bool> >::vector_to_array (const VectorType& vector)
+ArrayHandler<bool, Glib::Container_Helpers::TypeTraits<bool> >::vector_to_array(const VectorType& vector)
{
- return ArrayKeeperType (Glib::Container_Helpers::create_bool_array (vector.begin (), vector.size ()), vector.size (), Glib::OWNERSHIP_SHALLOW);
+ return ArrayKeeperType(Glib::Container_Helpers::create_bool_array(vector.begin(), vector.size()), vector.size(), Glib::OWNERSHIP_SHALLOW);
}
} // namespace Glib
diff --git a/glib/glibmm/vectorutils.h b/glib/glibmm/vectorutils.h
index a2d3227..f6bafc6 100644
--- a/glib/glibmm/vectorutils.h
+++ b/glib/glibmm/vectorutils.h
@@ -2,7 +2,7 @@
#ifndef _GLIBMM_VECTORUTILS_H
#define _GLIBMM_VECTORUTILS_H
-/* Copyright (C) 2011 The glibmm Development Team
+/* Copyright(C) 2011 The glibmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -68,36 +68,36 @@ namespace Container_Helpers
/* Count the number of elements in a 0-terminated sequence.
*/
template <class T> inline
-size_t compute_array_size2 (const T* array)
+size_t compute_array_size2(const T* array)
{
- const T* pend (array);
+ const T* pend(array);
- while (*pend)
+ while(*pend)
{
++pend;
}
- return (pend - array);
+ return(pend - array);
}
/* Allocate and fill a 0-terminated array. The size argument
* specifies the number of elements in the input sequence.
*/
template <class Tr>
-typename Tr::CType* create_array (typename std::vector<typename Tr::CppType>::const_iterator pbegin, size_t size)
+typename Tr::CType* create_array(typename std::vector<typename Tr::CppType>::const_iterator pbegin, size_t size)
{
typedef typename Tr::CType CType;
- CType *const array (static_cast<CType*> (g_malloc((size + 1) * sizeof (CType))));
- CType *const array_end (array + size);
+ CType *const array(static_cast<CType*>(g_malloc((size + 1) * sizeof(CType))));
+ CType *const array_end(array + size);
- for (CType* pdest (array); pdest != array_end; ++pdest)
+ for(CType* pdest(array); pdest != array_end; ++pdest)
{
// Use & to force a warning if the iterator returns a temporary object.
- *pdest = Tr::to_c_type (*&*pbegin);
+ *pdest = Tr::to_c_type(*&*pbegin);
++pbegin;
}
- *array_end = CType ();
+ *array_end = CType();
return array;
}
@@ -105,23 +105,23 @@ typename Tr::CType* create_array (typename std::vector<typename Tr::CppType>::co
/* first class function for bools, because std::vector<bool> is a specialization
* which does not conform to being an STL container.
*/
-gboolean* create_bool_array (std::vector<bool>::const_iterator pbegin,
+gboolean* create_bool_array(std::vector<bool>::const_iterator pbegin,
size_t size);
/* Create and fill a GList as efficient as possible.
* This requires bidirectional iterators.
*/
template <class Tr>
-GList* create_glist (const typename std::vector<typename Tr::CppType>::const_iterator pbegin,
+GList* create_glist(const typename std::vector<typename Tr::CppType>::const_iterator pbegin,
typename std::vector<typename Tr::CppType>::const_iterator pend)
{
- GList* head (0);
+ GList* head(0);
- while (pend != pbegin)
+ while(pend != pbegin)
{
// Use & to force a warning if the iterator returns a temporary object.
- const void *const item (Tr::to_c_type(*&*--pend));
- head = g_list_prepend(head, const_cast<void*> (item));
+ const void *const item(Tr::to_c_type(*&*--pend));
+ head = g_list_prepend(head, const_cast<void*>(item));
}
return head;
@@ -131,16 +131,16 @@ GList* create_glist (const typename std::vector<typename Tr::CppType>::const_ite
* This requires bidirectional iterators.
*/
template <class Tr>
-GSList* create_gslist (const typename std::vector<typename Tr::CppType>::const_iterator pbegin,
+GSList* create_gslist(const typename std::vector<typename Tr::CppType>::const_iterator pbegin,
typename std::vector<typename Tr::CppType>::const_iterator pend)
{
- GSList* head (0);
+ GSList* head(0);
- while (pend != pbegin)
+ while(pend != pbegin)
{
// Use & to force a warning if the iterator returns a temporary object.
- const void *const item (Tr::to_c_type(*&*--pend));
- head = g_slist_prepend (head, const_cast<void*> (item));
+ const void *const item(Tr::to_c_type(*&*--pend));
+ head = g_slist_prepend(head, const_cast<void*>(item));
}
return head;
@@ -165,29 +165,29 @@ public:
typedef value_type reference;
typedef void pointer;
- explicit inline ArrayIterator (const CType* pos);
+ explicit inline ArrayIterator(const CType* pos);
- inline value_type operator* () const;
- inline value_type operator[] (difference_type offset) const;
+ inline value_type operator*() const;
+ inline value_type operator[](difference_type offset) const;
- inline ArrayIterator<Tr> & operator++ ();
- inline const ArrayIterator<Tr> operator++ (int);
+ inline ArrayIterator<Tr> & operator++();
+ inline const ArrayIterator<Tr> operator++(int);
// All this random access stuff is only there because STL algorithms
// usually have optimized specializations for random access iterators,
// and we don't want to give away efficiency for nothing.
- inline ArrayIterator<Tr>& operator+= (difference_type rhs);
- inline ArrayIterator<Tr>& operator-= (difference_type rhs);
- inline const ArrayIterator<Tr> operator+ (difference_type rhs) const;
- inline const ArrayIterator<Tr> operator- (difference_type rhs) const;
- inline difference_type operator- (const ArrayIterator<Tr>& rhs) const;
-
- inline bool operator== (const ArrayIterator<Tr>& rhs) const;
- inline bool operator!= (const ArrayIterator<Tr>& rhs) const;
- inline bool operator< (const ArrayIterator<Tr>& rhs) const;
- inline bool operator> (const ArrayIterator<Tr>& rhs) const;
- inline bool operator<= (const ArrayIterator<Tr>& rhs) const;
- inline bool operator>= (const ArrayIterator<Tr>& rhs) const;
+ inline ArrayIterator<Tr>& operator+=(difference_type rhs);
+ inline ArrayIterator<Tr>& operator-=(difference_type rhs);
+ inline const ArrayIterator<Tr> operator+(difference_type rhs) const;
+ inline const ArrayIterator<Tr> operator-(difference_type rhs) const;
+ inline difference_type operator-(const ArrayIterator<Tr>& rhs) const;
+
+ inline bool operator==(const ArrayIterator<Tr>& rhs) const;
+ inline bool operator!=(const ArrayIterator<Tr>& rhs) const;
+ inline bool operator<(const ArrayIterator<Tr>& rhs) const;
+ inline bool operator>(const ArrayIterator<Tr>& rhs) const;
+ inline bool operator<=(const ArrayIterator<Tr>& rhs) const;
+ inline bool operator>=(const ArrayIterator<Tr>& rhs) const;
private:
const CType* pos_;
@@ -211,14 +211,14 @@ public:
typedef value_type reference;
typedef void pointer;
- explicit inline ListIterator (const GList* node);
+ explicit inline ListIterator(const GList* node);
- inline value_type operator* () const;
- inline ListIterator<Tr>& operator++ ();
- inline const ListIterator<Tr> operator++ (int);
+ inline value_type operator*() const;
+ inline ListIterator<Tr>& operator++();
+ inline const ListIterator<Tr> operator++(int);
- inline bool operator== (const ListIterator<Tr>& rhs) const;
- inline bool operator!= (const ListIterator<Tr>& rhs) const;
+ inline bool operator==(const ListIterator<Tr>& rhs) const;
+ inline bool operator!=(const ListIterator<Tr>& rhs) const;
private:
const GList* node_;
@@ -242,14 +242,14 @@ public:
typedef value_type reference;
typedef void pointer;
- explicit inline SListIterator (const GSList* node);
+ explicit inline SListIterator(const GSList* node);
- inline value_type operator* () const;
- inline SListIterator<Tr>& operator++ ();
- inline const SListIterator<Tr> operator++ (int);
+ inline value_type operator*() const;
+ inline SListIterator<Tr>& operator++();
+ inline const SListIterator<Tr> operator++(int);
- inline bool operator== (const SListIterator<Tr>& rhs) const;
- inline bool operator!= (const SListIterator<Tr>& rhs) const;
+ inline bool operator==(const SListIterator<Tr>& rhs) const;
+ inline bool operator!=(const SListIterator<Tr>& rhs) const;
private:
const GSList* node_;
@@ -262,11 +262,11 @@ public:
typedef typename Tr::CppType CppType;
typedef typename Tr::CType CType;
- explicit inline ArrayKeeper (const CType* array, size_t array_size, Glib::OwnershipType ownership);
- inline ArrayKeeper (const ArrayKeeper& keeper);
- ~ArrayKeeper ();
+ explicit inline ArrayKeeper(const CType* array, size_t array_size, Glib::OwnershipType ownership);
+ inline ArrayKeeper(const ArrayKeeper& keeper);
+ ~ArrayKeeper();
- inline CType* data () const;
+ inline CType* data() const;
private:
CType* array_;
@@ -281,11 +281,11 @@ public:
typedef typename Tr::CppType CppType;
typedef typename Tr::CType CType;
- explicit inline GListKeeper (const GList* glist, Glib::OwnershipType ownership);
- inline GListKeeper (const GListKeeper& keeper);
- ~GListKeeper ();
+ explicit inline GListKeeper(const GList* glist, Glib::OwnershipType ownership);
+ inline GListKeeper(const GListKeeper& keeper);
+ ~GListKeeper();
- inline GList* data () const;
+ inline GList* data() const;
private:
GList* glist_;
@@ -299,11 +299,11 @@ public:
typedef typename Tr::CppType CppType;
typedef typename Tr::CType CType;
- explicit inline GSListKeeper (const GSList* gslist, Glib::OwnershipType ownership);
- inline GSListKeeper (const GSListKeeper& keeper);
- ~GSListKeeper ();
+ explicit inline GSListKeeper(const GSList* gslist, Glib::OwnershipType ownership);
+ inline GSListKeeper(const GSListKeeper& keeper);
+ ~GSListKeeper();
- inline GSList* data () const;
+ inline GSList* data() const;
private:
GSList* gslist_;
@@ -325,9 +325,9 @@ public:
typedef typename Glib::Container_Helpers::ArrayIterator<Tr> ArrayIteratorType;
// maybe think about using C++0x move constructors?
- static VectorType array_to_vector (const CType* array, size_t array_size, Glib::OwnershipType ownership);
- static VectorType array_to_vector (const CType* array, Glib::OwnershipType ownership);
- static ArrayKeeperType vector_to_array (const VectorType& vector);
+ static VectorType array_to_vector(const CType* array, size_t array_size, Glib::OwnershipType ownership);
+ static VectorType array_to_vector(const CType* array, Glib::OwnershipType ownership);
+ static ArrayKeeperType vector_to_array(const VectorType& vector);
};
template <>
@@ -341,9 +341,9 @@ public:
typedef Glib::Container_Helpers::ArrayIterator<Glib::Container_Helpers::TypeTraits<bool> > ArrayIteratorType;
// maybe think about using C++0x move constructors?
- static VectorType array_to_vector (const CType* array, size_t array_size, Glib::OwnershipType ownership);
- static VectorType array_to_vector (const CType* array, Glib::OwnershipType ownership);
- static ArrayKeeperType vector_to_array (const VectorType& vector);
+ static VectorType array_to_vector(const CType* array, size_t array_size, Glib::OwnershipType ownership);
+ static VectorType array_to_vector(const CType* array, Glib::OwnershipType ownership);
+ static ArrayKeeperType vector_to_array(const VectorType& vector);
};
template <typename T, typename Tr = Glib::Container_Helpers::TypeTraits<T> >
@@ -357,8 +357,8 @@ public:
typedef typename Glib::Container_Helpers::ListIterator<Tr> ListIteratorType;
// maybe think about using C++0x move constructors?
- static VectorType list_to_vector (GList* glist, Glib::OwnershipType ownership);
- static GListKeeperType vector_to_list (const VectorType& vector);
+ static VectorType list_to_vector(GList* glist, Glib::OwnershipType ownership);
+ static GListKeeperType vector_to_list(const VectorType& vector);
};
template <typename T, typename Tr = Glib::Container_Helpers::TypeTraits<T> >
@@ -372,8 +372,8 @@ public:
typedef typename Glib::Container_Helpers::SListIterator<Tr> SListIteratorType;
// maybe think about using C++0x move constructors?
- static VectorType slist_to_vector (GSList* gslist, Glib::OwnershipType ownership);
- static GSListKeeperType vector_to_slist (const VectorType& vector);
+ static VectorType slist_to_vector(GSList* gslist, Glib::OwnershipType ownership);
+ static GSListKeeperType vector_to_slist(const VectorType& vector);
};
/***************************************************************************/
@@ -388,40 +388,40 @@ namespace Container_Helpers
/**** Glib::Container_Helpers::ArrayIterator<> ***********************/
template <class Tr> inline
-ArrayIterator<Tr>::ArrayIterator (const CType* pos)
+ArrayIterator<Tr>::ArrayIterator(const CType* pos)
:
- pos_ (pos)
+ pos_(pos)
{}
template <class Tr> inline
-typename ArrayIterator<Tr>::value_type ArrayIterator<Tr>::operator* () const
+typename ArrayIterator<Tr>::value_type ArrayIterator<Tr>::operator*() const
{
- return Tr::to_cpp_type (*pos_);
+ return Tr::to_cpp_type(*pos_);
}
template <class Tr> inline
typename ArrayIterator<Tr>::value_type
-ArrayIterator<Tr>::operator[] (difference_type offset) const
+ArrayIterator<Tr>::operator[](difference_type offset) const
{
- return Tr::to_cpp_type (pos_[offset]);
+ return Tr::to_cpp_type(pos_[offset]);
}
template <class Tr> inline
-ArrayIterator<Tr>& ArrayIterator<Tr>::operator++ ()
+ArrayIterator<Tr>& ArrayIterator<Tr>::operator++()
{
++pos_;
return *this;
}
template <class Tr> inline
-const ArrayIterator<Tr> ArrayIterator<Tr>::operator++ (int)
+const ArrayIterator<Tr> ArrayIterator<Tr>::operator++(int)
{
- return ArrayIterator<Tr> (pos_++);
+ return ArrayIterator<Tr>(pos_++);
}
template <class Tr> inline
ArrayIterator<Tr>&
-ArrayIterator<Tr>::operator+= (typename ArrayIterator<Tr>::difference_type rhs)
+ArrayIterator<Tr>::operator+=(typename ArrayIterator<Tr>::difference_type rhs)
{
pos_ += rhs;
return *this;
@@ -429,7 +429,7 @@ ArrayIterator<Tr>::operator+= (typename ArrayIterator<Tr>::difference_type rhs)
template <class Tr> inline
ArrayIterator<Tr>&
-ArrayIterator<Tr>::operator-= (typename ArrayIterator<Tr>::difference_type rhs)
+ArrayIterator<Tr>::operator-=(typename ArrayIterator<Tr>::difference_type rhs)
{
pos_ -= rhs;
return *this;
@@ -437,184 +437,184 @@ ArrayIterator<Tr>::operator-= (typename ArrayIterator<Tr>::difference_type rhs)
template <class Tr> inline
const ArrayIterator<Tr>
-ArrayIterator<Tr>::operator+ (typename ArrayIterator<Tr>::difference_type rhs) const
+ArrayIterator<Tr>::operator+(typename ArrayIterator<Tr>::difference_type rhs) const
{
- return ArrayIterator<Tr> (pos_ + rhs);
+ return ArrayIterator<Tr>(pos_ + rhs);
}
template <class Tr> inline
const ArrayIterator<Tr>
-ArrayIterator<Tr>::operator- (typename ArrayIterator<Tr>::difference_type rhs) const
+ArrayIterator<Tr>::operator-(typename ArrayIterator<Tr>::difference_type rhs) const
{
- return ArrayIterator<Tr> (pos_ - rhs);
+ return ArrayIterator<Tr>(pos_ - rhs);
}
template <class Tr> inline
typename ArrayIterator<Tr>::difference_type
-ArrayIterator<Tr>::operator- (const ArrayIterator<Tr>& rhs) const
+ArrayIterator<Tr>::operator-(const ArrayIterator<Tr>& rhs) const
{
- return (pos_ - rhs.pos_);
+ return(pos_ - rhs.pos_);
}
template <class Tr> inline
-bool ArrayIterator<Tr>::operator== (const ArrayIterator<Tr>& rhs) const
+bool ArrayIterator<Tr>::operator==(const ArrayIterator<Tr>& rhs) const
{
- return (pos_ == rhs.pos_);
+ return(pos_ == rhs.pos_);
}
template <class Tr> inline
-bool ArrayIterator<Tr>::operator!= (const ArrayIterator<Tr>& rhs) const
+bool ArrayIterator<Tr>::operator!=(const ArrayIterator<Tr>& rhs) const
{
- return (pos_ != rhs.pos_);
+ return(pos_ != rhs.pos_);
}
template <class Tr> inline
-bool ArrayIterator<Tr>::operator< (const ArrayIterator<Tr>& rhs) const
+bool ArrayIterator<Tr>::operator<(const ArrayIterator<Tr>& rhs) const
{
- return (pos_ < rhs.pos_);
+ return(pos_ < rhs.pos_);
}
template <class Tr> inline
-bool ArrayIterator<Tr>::operator> (const ArrayIterator<Tr>& rhs) const
+bool ArrayIterator<Tr>::operator>(const ArrayIterator<Tr>& rhs) const
{
- return (pos_ > rhs.pos_);
+ return(pos_ > rhs.pos_);
}
template <class Tr> inline
-bool ArrayIterator<Tr>::operator<= (const ArrayIterator<Tr>& rhs) const
+bool ArrayIterator<Tr>::operator<=(const ArrayIterator<Tr>& rhs) const
{
- return (pos_ <= rhs.pos_);
+ return(pos_ <= rhs.pos_);
}
template <class Tr> inline
-bool ArrayIterator<Tr>::operator>= (const ArrayIterator<Tr>& rhs) const
+bool ArrayIterator<Tr>::operator>=(const ArrayIterator<Tr>& rhs) const
{
- return (pos_ >= rhs.pos_);
+ return(pos_ >= rhs.pos_);
}
/**** Glib::Container_Helpers::ListIterator<> ************************/
template <class Tr> inline
-ListIterator<Tr>::ListIterator (const GList* node)
+ListIterator<Tr>::ListIterator(const GList* node)
:
- node_ (node)
+ node_(node)
{}
template <class Tr> inline
-typename ListIterator<Tr>::value_type ListIterator<Tr>::operator* () const
+typename ListIterator<Tr>::value_type ListIterator<Tr>::operator*() const
{
- return Tr::to_cpp_type (static_cast<typename Tr::CTypeNonConst> (node_->data));
+ return Tr::to_cpp_type(static_cast<typename Tr::CTypeNonConst>(node_->data));
}
template <class Tr> inline
-ListIterator<Tr>& ListIterator<Tr>::operator++ ()
+ListIterator<Tr>& ListIterator<Tr>::operator++()
{
node_ = node_->next;
return *this;
}
template <class Tr> inline
-const ListIterator<Tr> ListIterator<Tr>::operator++ (int)
+const ListIterator<Tr> ListIterator<Tr>::operator++(int)
{
- const ListIterator<Tr> tmp (*this);
+ const ListIterator<Tr> tmp(*this);
node_ = node_->next;
return tmp;
}
template <class Tr> inline
-bool ListIterator<Tr>::operator== (const ListIterator<Tr>& rhs) const
+bool ListIterator<Tr>::operator==(const ListIterator<Tr>& rhs) const
{
- return (node_ == rhs.node_);
+ return(node_ == rhs.node_);
}
template <class Tr> inline
-bool ListIterator<Tr>::operator!= (const ListIterator<Tr>& rhs) const
+bool ListIterator<Tr>::operator!=(const ListIterator<Tr>& rhs) const
{
- return (node_ != rhs.node_);
+ return(node_ != rhs.node_);
}
/**** Glib::Container_Helpers::SListIterator<> ************************/
template <class Tr> inline
-SListIterator<Tr>::SListIterator (const GSList* node)
+SListIterator<Tr>::SListIterator(const GSList* node)
:
- node_ (node)
+ node_(node)
{}
template <class Tr> inline
-typename SListIterator<Tr>::value_type SListIterator<Tr>::operator* () const
+typename SListIterator<Tr>::value_type SListIterator<Tr>::operator*() const
{
- return Tr::to_cpp_type (static_cast<typename Tr::CTypeNonConst> (node_->data));
+ return Tr::to_cpp_type(static_cast<typename Tr::CTypeNonConst>(node_->data));
}
template <class Tr> inline
-SListIterator<Tr>& SListIterator<Tr>::operator++ ()
+SListIterator<Tr>& SListIterator<Tr>::operator++()
{
node_ = node_->next;
return *this;
}
template <class Tr> inline
-const SListIterator<Tr> SListIterator<Tr>::operator++ (int)
+const SListIterator<Tr> SListIterator<Tr>::operator++(int)
{
- const ListIterator<Tr> tmp (*this);
+ const ListIterator<Tr> tmp(*this);
node_ = node_->next;
return tmp;
}
template <class Tr> inline
-bool SListIterator<Tr>::operator== (const SListIterator<Tr>& rhs) const
+bool SListIterator<Tr>::operator==(const SListIterator<Tr>& rhs) const
{
- return (node_ == rhs.node_);
+ return(node_ == rhs.node_);
}
template <class Tr> inline
-bool SListIterator<Tr>::operator!= (const SListIterator<Tr>& rhs) const
+bool SListIterator<Tr>::operator!=(const SListIterator<Tr>& rhs) const
{
- return (node_ != rhs.node_);
+ return(node_ != rhs.node_);
}
/**** Glib::Container_Helpers::ArrayKeeper<> ************************/
template <typename Tr>
-inline ArrayKeeper<Tr>::ArrayKeeper (const CType* array, size_t array_size, Glib::OwnershipType ownership)
+inline ArrayKeeper<Tr>::ArrayKeeper(const CType* array, size_t array_size, Glib::OwnershipType ownership)
:
- array_ (const_cast<CType*> (array)),
- array_size_ (array_size),
- ownership_ (ownership)
+ array_(const_cast<CType*>(array)),
+ array_size_(array_size),
+ ownership_(ownership)
{}
template <typename Tr>
-inline ArrayKeeper<Tr>::ArrayKeeper (const ArrayKeeper& keeper)
+inline ArrayKeeper<Tr>::ArrayKeeper(const ArrayKeeper& keeper)
:
- array_ (keeper.array_),
- array_size_ (keeper.array_size_),
- ownership_ (keeper.ownership_)
+ array_(keeper.array_),
+ array_size_(keeper.array_size_),
+ ownership_(keeper.ownership_)
{
keeper.ownership_ = Glib::OWNERSHIP_NONE;
}
template <typename Tr>
-ArrayKeeper<Tr>::~ArrayKeeper ()
+ArrayKeeper<Tr>::~ArrayKeeper()
{
- if (array_ && ownership_ != Glib::OWNERSHIP_NONE)
+ if(array_ && ownership_ != Glib::OWNERSHIP_NONE)
{
- if (ownership_ != Glib::OWNERSHIP_SHALLOW)
+ if(ownership_ != Glib::OWNERSHIP_SHALLOW)
{
// Deep ownership: release each container element.
- const CType *const array_end (array_ + array_size_);
+ const CType *const array_end(array_ + array_size_);
- for (const CType* p (array_); p != array_end; ++p)
+ for(const CType* p(array_); p != array_end; ++p)
{
- Tr::release_c_type (*p);
+ Tr::release_c_type(*p);
}
}
- g_free (const_cast<CType*> (array_));
+ g_free(const_cast<CType*>(array_));
}
}
template <typename Tr>
-inline typename Tr::CType* ArrayKeeper<Tr>::data () const
+inline typename Tr::CType* ArrayKeeper<Tr>::data() const
{
return array_;
}
@@ -622,42 +622,42 @@ inline typename Tr::CType* ArrayKeeper<Tr>::data () const
/**** Glib::Container_Helpers::GListKeeper<> ************************/
template <typename Tr>
-inline GListKeeper<Tr>::GListKeeper (const GList* glist, Glib::OwnershipType ownership)
+inline GListKeeper<Tr>::GListKeeper(const GList* glist, Glib::OwnershipType ownership)
:
- glist_ (const_cast<GList*> (glist)),
- ownership_ (ownership)
+ glist_(const_cast<GList*>(glist)),
+ ownership_(ownership)
{}
template <typename Tr>
-inline GListKeeper<Tr>::GListKeeper (const GListKeeper& keeper)
+inline GListKeeper<Tr>::GListKeeper(const GListKeeper& keeper)
:
- glist_ (keeper.glist_),
- ownership_ (keeper.ownership_)
+ glist_(keeper.glist_),
+ ownership_(keeper.ownership_)
{
keeper.ownership_ = Glib::OWNERSHIP_NONE;
}
template <typename Tr>
-GListKeeper<Tr>::~GListKeeper ()
+GListKeeper<Tr>::~GListKeeper()
{
typedef typename Tr::CTypeNonConst CTypeNonConst;
- if (glist_ && ownership_ != Glib::OWNERSHIP_NONE)
+ if(glist_ && ownership_ != Glib::OWNERSHIP_NONE)
{
- if (ownership_ != Glib::OWNERSHIP_SHALLOW)
+ if(ownership_ != Glib::OWNERSHIP_SHALLOW)
{
// Deep ownership: release each container element.
- for (GList* node = glist_; node; node = node->next)
+ for(GList* node = glist_; node; node = node->next)
{
- Tr::release_c_type (static_cast<CTypeNonConst> (node->data));
+ Tr::release_c_type(static_cast<CTypeNonConst>(node->data));
}
}
- g_list_free (glist_);
+ g_list_free(glist_);
}
}
template <typename Tr>
-inline GList* GListKeeper<Tr>::data () const
+inline GList* GListKeeper<Tr>::data() const
{
return glist_;
}
@@ -665,41 +665,41 @@ inline GList* GListKeeper<Tr>::data () const
/**** Glib::Container_Helpers::GSListKeeper<> ************************/
template <typename Tr>
-inline GSListKeeper<Tr>::GSListKeeper (const GSList* gslist, Glib::OwnershipType ownership)
+inline GSListKeeper<Tr>::GSListKeeper(const GSList* gslist, Glib::OwnershipType ownership)
:
- gslist_ (const_cast<GSList*> (gslist)),
- ownership_ (ownership)
+ gslist_(const_cast<GSList*>(gslist)),
+ ownership_(ownership)
{}
template <typename Tr>
-inline GSListKeeper<Tr>::GSListKeeper (const GSListKeeper& keeper)
+inline GSListKeeper<Tr>::GSListKeeper(const GSListKeeper& keeper)
:
- gslist_ (keeper.gslist_),
- ownership_ (keeper.ownership_)
+ gslist_(keeper.gslist_),
+ ownership_(keeper.ownership_)
{
keeper.ownership_ = Glib::OWNERSHIP_NONE;
}
template <typename Tr>
-GSListKeeper<Tr>::~GSListKeeper ()
+GSListKeeper<Tr>::~GSListKeeper()
{
typedef typename Tr::CTypeNonConst CTypeNonConst;
- if (gslist_ && ownership_ != Glib::OWNERSHIP_NONE)
+ if(gslist_ && ownership_ != Glib::OWNERSHIP_NONE)
{
- if (ownership_ != Glib::OWNERSHIP_SHALLOW)
+ if(ownership_ != Glib::OWNERSHIP_SHALLOW)
{
// Deep ownership: release each container element.
- for (GSList* node = gslist_; node; node = node->next)
+ for(GSList* node = gslist_; node; node = node->next)
{
- Tr::release_c_type (static_cast<CTypeNonConst> (node->data));
+ Tr::release_c_type(static_cast<CTypeNonConst>(node->data));
}
}
- g_slist_free (gslist_);
+ g_slist_free(gslist_);
}
}
template <typename Tr>
-inline GSList* GSListKeeper<Tr>::data () const
+inline GSList* GSListKeeper<Tr>::data() const
{
return gslist_;
}
@@ -710,16 +710,16 @@ inline GSList* GSListKeeper<Tr>::data () const
template <typename T, class Tr>
typename ArrayHandler<T, Tr>::VectorType
-ArrayHandler<T, Tr>::array_to_vector (const CType* array, size_t array_size, Glib::OwnershipType ownership)
+ArrayHandler<T, Tr>::array_to_vector(const CType* array, size_t array_size, Glib::OwnershipType ownership)
{
// it will handle destroying data depending on passed ownership.
- ArrayKeeperType keeper (array, array_size, ownership);
+ ArrayKeeperType keeper(array, array_size, ownership);
#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS
- return VectorType (ArrayIteratorType (array), ArrayIteratorType (array + array_size));
+ return VectorType(ArrayIteratorType(array), ArrayIteratorType(array + array_size));
#else
VectorType temp;
- temp.reserve (array_size);
- Glib::Container_Helpers::fill_container (temp, ArrayIteratorType (array), ArrayIteratorType (array + array_size));
+ temp.reserve(array_size);
+ Glib::Container_Helpers::fill_container(temp, ArrayIteratorType(array), ArrayIteratorType(array + array_size));
return temp;
#endif
}
@@ -728,64 +728,64 @@ template <typename T, class Tr>
typename ArrayHandler<T, Tr>::VectorType
ArrayHandler<T, Tr>::array_to_vector(const CType* array, Glib::OwnershipType ownership)
{
- return array_to_vector (array, Glib::Container_Helpers::compute_array_size2 (array), ownership);
+ return array_to_vector(array, Glib::Container_Helpers::compute_array_size2(array), ownership);
}
template <typename T, class Tr>
typename ArrayHandler<T, Tr>::ArrayKeeperType
-ArrayHandler<T, Tr>::vector_to_array (const VectorType& vector)
+ArrayHandler<T, Tr>::vector_to_array(const VectorType& vector)
{
- return ArrayKeeperType (Glib::Container_Helpers::create_array<Tr> (vector.begin (), vector.size ()), vector.size (), Glib::OWNERSHIP_SHALLOW);
+ return ArrayKeeperType(Glib::Container_Helpers::create_array<Tr>(vector.begin(), vector.size()), vector.size(), Glib::OWNERSHIP_SHALLOW);
}
/**** Glib::ListHandler<> ************************/
template <typename T, class Tr>
typename ListHandler<T, Tr>::VectorType
-ListHandler<T, Tr>::list_to_vector (GList* glist, Glib::OwnershipType ownership)
+ListHandler<T, Tr>::list_to_vector(GList* glist, Glib::OwnershipType ownership)
{
// it will handle destroying data depending on passed ownership.
- GListKeeperType keeper (glist, ownership);
+ GListKeeperType keeper(glist, ownership);
#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS
- return VectorType (ListIteratorType (glist), ListIteratorType (0));
+ return VectorType(ListIteratorType(glist), ListIteratorType(0));
#else
VectorType temp;
- temp.reserve (g_list_length (glist));
- Glib::Container_Helpers::fill_container (temp, ListIteratorType (glist), ListIteratorType (0));
+ temp.reserve(g_list_length(glist));
+ Glib::Container_Helpers::fill_container(temp, ListIteratorType(glist), ListIteratorType(0));
return temp;
#endif
}
template <typename T, class Tr>
typename ListHandler<T, Tr>::GListKeeperType
-ListHandler<T, Tr>::vector_to_list (const VectorType& vector)
+ListHandler<T, Tr>::vector_to_list(const VectorType& vector)
{
- return GListKeeperType (Glib::Container_Helpers::create_glist<Tr> (vector.begin(), vector.end()), Glib::OWNERSHIP_SHALLOW);
+ return GListKeeperType(Glib::Container_Helpers::create_glist<Tr>(vector.begin(), vector.end()), Glib::OWNERSHIP_SHALLOW);
}
/**** Glib::SListHandler<> ************************/
template <typename T, class Tr>
typename SListHandler<T, Tr>::VectorType
-SListHandler<T, Tr>::slist_to_vector (GSList* gslist, Glib::OwnershipType ownership)
+SListHandler<T, Tr>::slist_to_vector(GSList* gslist, Glib::OwnershipType ownership)
{
// it will handle destroying data depending on passed ownership.
- GSListKeeperType keeper (gslist, ownership);
+ GSListKeeperType keeper(gslist, ownership);
#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS
- return VectorType (SListIteratorType (gslist), SListIteratorType (0));
+ return VectorType(SListIteratorType(gslist), SListIteratorType(0));
#else
VectorType temp;
- temp.reserve (g_slist_length (gslist));
- Glib::Container_Helpers::fill_container (temp, SListIteratorType (gslist), SListIteratorType (0));
+ temp.reserve(g_slist_length(gslist));
+ Glib::Container_Helpers::fill_container(temp, SListIteratorType(gslist), SListIteratorType(0));
return temp;
#endif
}
template <typename T, class Tr>
typename SListHandler<T, Tr>::GSListKeeperType
-SListHandler<T, Tr>::vector_to_slist (const VectorType& vector)
+SListHandler<T, Tr>::vector_to_slist(const VectorType& vector)
{
- return GSListKeeperType (Glib::Container_Helpers::create_gslist<Tr> (vector.begin (), vector.end ()), Glib::OWNERSHIP_SHALLOW);
+ return GSListKeeperType(Glib::Container_Helpers::create_gslist<Tr>(vector.begin(), vector.end()), Glib::OWNERSHIP_SHALLOW);
}
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
diff --git a/tests/glibmm_bool_vector/main.cc b/tests/glibmm_bool_vector/main.cc
index 47b6796..d9e3fc6 100644
--- a/tests/glibmm_bool_vector/main.cc
+++ b/tests/glibmm_bool_vector/main.cc
@@ -21,27 +21,27 @@
#include <glibmm.h>
-const unsigned int magic_limit (5);
+const unsigned int magic_limit(5);
void
-setup_rand ()
+setup_rand()
{
- static bool setup (false);
+ static bool setup(false);
- if (!setup)
+ if(!setup)
{
setup = true;
- std::srand (std::time (0));
+ std::srand(std::time(0));
}
}
gboolean*
-c_get_bool_array ()
+c_get_bool_array()
{
- gboolean* array (static_cast<gboolean*> (g_malloc ((magic_limit + 1) * sizeof (gboolean))));
+ gboolean* array(static_cast<gboolean*>(g_malloc((magic_limit + 1) * sizeof(gboolean))));
- setup_rand ();
- for (unsigned int iter (0); iter < magic_limit; ++iter)
+ setup_rand();
+ for(unsigned int iter(0); iter < magic_limit; ++iter)
{
array[iter] = std::rand() % 2 ? TRUE : FALSE;
}
@@ -50,33 +50,33 @@ c_get_bool_array ()
}
void
-c_print_bool_array (gboolean* array)
+c_print_bool_array(gboolean* array)
{
- for (unsigned int iter (0); iter < magic_limit; ++iter)
+ for(unsigned int iter(0); iter < magic_limit; ++iter)
{
- std::cout << iter << ": " << (array[iter] ? "TRUE" : "FALSE") << "\n";
+ std::cout << iter << ": " <<(array[iter] ? "TRUE" : "FALSE") << "\n";
}
}
std::vector<bool>
-cxx_get_bool_array ()
+cxx_get_bool_array()
{
- return Glib::ArrayHandler<bool>::array_to_vector (c_get_bool_array (), magic_limit, Glib::OWNERSHIP_SHALLOW);
+ return Glib::ArrayHandler<bool>::array_to_vector(c_get_bool_array(), magic_limit, Glib::OWNERSHIP_SHALLOW);
}
void
-cxx_print_bool_array (const std::vector<bool>& v)
+cxx_print_bool_array(const std::vector<bool>& v)
{
- c_print_bool_array (const_cast<gboolean*> (Glib::ArrayHandler<bool>::vector_to_array (v).data ()));
+ c_print_bool_array(const_cast<gboolean*>(Glib::ArrayHandler<bool>::vector_to_array(v).data()));
}
int main(int, char**)
{
Glib::init();
- std::vector<bool> va (cxx_get_bool_array ());
+ std::vector<bool> va(cxx_get_bool_array());
- cxx_print_bool_array (va);
+ cxx_print_bool_array(va);
return 0;
}
diff --git a/tests/glibmm_vector/main.cc b/tests/glibmm_vector/main.cc
index 4b64276..77e5f57 100644
--- a/tests/glibmm_vector/main.cc
+++ b/tests/glibmm_vector/main.cc
@@ -28,31 +28,32 @@
// utilities
-const unsigned int magic_limit (5);
+const unsigned int magic_limit(5);
GList*
-create_list ()
+create_list()
{
GList* head = 0;
- for (unsigned int iter (0); iter < magic_limit; ++iter)
+ for(unsigned int iter(0); iter < magic_limit; ++iter)
{
- head = g_list_prepend (head, g_credentials_new ());
+ head = g_list_prepend(head, g_credentials_new());
}
- return g_list_reverse (head);
+
+ return g_list_reverse(head);
}
void
-print_list (GList* list)
+print_list(GList* list)
{
- unsigned int counter (1);
+ unsigned int counter(1);
- for (GList* node (list); node; node = node->next, ++counter)
+ for(GList* node(list); node; node = node->next, ++counter)
{
std::cout << counter << ": ";
- if (G_IS_CREDENTIALS (node->data))
+ if(G_IS_CREDENTIALS(node->data))
{
- std::cout << node->data << ", ref: " << G_OBJECT (node->data)->ref_count <<"\n";
+ std::cout << node->data << ", ref: " << G_OBJECT(node->data)->ref_count <<"\n";
}
else
{
@@ -62,28 +63,29 @@ print_list (GList* list)
}
GSList*
-create_slist ()
+create_slist()
{
GSList* head = 0;
- for (unsigned int iter (0); iter < magic_limit; ++iter)
+ for(unsigned int iter(0); iter < magic_limit; ++iter)
{
- head = g_slist_prepend (head, g_credentials_new ());
+ head = g_slist_prepend(head, g_credentials_new());
}
- return g_slist_reverse (head);
+
+ return g_slist_reverse(head);
}
void
-print_slist (GSList* slist)
+print_slist(GSList* slist)
{
- unsigned int counter (1);
+ unsigned int counter(1);
- for (GSList* node (slist); node; node = node->next, ++counter)
+ for(GSList* node(slist); node; node = node->next, ++counter)
{
std::cout << counter << ": ";
- if (G_IS_CREDENTIALS (node->data))
+ if(G_IS_CREDENTIALS(node->data))
{
- std::cout << node->data << ", ref: " << G_OBJECT (node->data)->ref_count <<"\n";
+ std::cout << node->data << ", ref: " << G_OBJECT(node->data)->ref_count <<"\n";
}
else
{
@@ -93,28 +95,28 @@ print_slist (GSList* slist)
}
GCredentials**
-create_array ()
+create_array()
{
- GCredentials** array = g_new0 (GCredentials*, magic_limit + 1);
+ GCredentials** array = g_new0(GCredentials*, magic_limit + 1);
- for (unsigned int iter (0); iter < magic_limit; ++iter)
+ for(unsigned int iter(0); iter < magic_limit; ++iter)
{
- array[iter] = g_credentials_new ();
+ array[iter] = g_credentials_new();
}
return array;
}
void
-print_array (GCredentials** array)
+print_array(GCredentials** array)
{
- for (unsigned int iter (0); iter < magic_limit; ++iter)
+ for(unsigned int iter(0); iter < magic_limit; ++iter)
{
- GCredentials* credentials (array[iter]);
+ GCredentials* credentials(array[iter]);
std::cout << iter + 1 << ": ";
- if (G_IS_CREDENTIALS (credentials))
+ if(G_IS_CREDENTIALS(credentials))
{
- std::cout << reinterpret_cast<gpointer> (credentials) << ", ref: " << G_OBJECT (credentials)->ref_count << "\n";
+ std::cout << reinterpret_cast<gpointer>(credentials) << ", ref: " << G_OBJECT(credentials)->ref_count << "\n";
}
else
{
@@ -125,11 +127,11 @@ print_array (GCredentials** array)
// shallow copy
GCredentials**
-copy_array (GCredentials** array)
+copy_array(GCredentials** array)
{
- GCredentials** dup = g_new0 (GCredentials*, magic_limit + 1);
+ GCredentials** dup = g_new0(GCredentials*, magic_limit + 1);
- for (unsigned int iter (0); iter < magic_limit; ++iter)
+ for(unsigned int iter(0); iter < magic_limit; ++iter)
{
dup[iter] = array[iter];
}
@@ -138,35 +140,35 @@ copy_array (GCredentials** array)
}
void
-free_array (GCredentials** array, bool container_too = true)
+free_array(GCredentials** array, bool container_too = true)
{
- for (unsigned int iter (0); iter < magic_limit; ++iter)
+ for(unsigned int iter(0); iter < magic_limit; ++iter)
{
- g_object_unref (array[iter]);
+ g_object_unref(array[iter]);
}
- if (container_too)
+ if(container_too)
{
- g_free (array);
+ g_free(array);
}
}
void
-print_vector (const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
+print_vector(const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
{
- const unsigned int size (v.size ());
+ const unsigned int size(v.size());
- for (unsigned int iter (0); iter < size; ++iter)
+ for(unsigned int iter(0); iter < size; ++iter)
{
- const Glib::RefPtr<Gio::Credentials>& obj_ptr (v[iter]);
+ const Glib::RefPtr<Gio::Credentials>& obj_ptr(v[iter]);
std::cout << iter + 1 << ": ";
- if (obj_ptr)
+ if(obj_ptr)
{
- GCredentials* gobj (obj_ptr->gobj ());
+ GCredentials* gobj(obj_ptr->gobj());
- if (G_IS_CREDENTIALS (gobj))
+ if(G_IS_CREDENTIALS(gobj))
{
- std::cout << static_cast<gpointer> (gobj) << ", ref: " << G_OBJECT (gobj)->ref_count << "\n";
+ std::cout << static_cast<gpointer>(gobj) << ", ref: " << G_OBJECT(gobj)->ref_count << "\n";
}
else
{
@@ -184,51 +186,51 @@ struct Cache
{
public:
Cache()
- : glist_ (create_list ()),
- gslist_ (create_slist ()),
- garray_ (create_array ())
+ : glist_(create_list()),
+ gslist_(create_slist()),
+ garray_(create_array())
{}
~Cache()
{
- if (glist_)
+ if(glist_)
{
- g_list_foreach (glist_, reinterpret_cast<GFunc> (g_object_unref), 0);
- g_list_free (glist_);
+ g_list_foreach(glist_, reinterpret_cast<GFunc>(g_object_unref), 0);
+ g_list_free(glist_);
}
- if (gslist_)
+ if(gslist_)
{
- g_slist_foreach (gslist_, reinterpret_cast<GFunc> (g_object_unref), 0);
- g_slist_free (gslist_);
+ g_slist_foreach(gslist_, reinterpret_cast<GFunc>(g_object_unref), 0);
+ g_slist_free(gslist_);
}
- if (garray_)
+ if(garray_)
{
- free_array (garray_);
+ free_array(garray_);
}
}
GList*
- get_list () const
+ get_list() const
{
return glist_;
}
GSList*
- get_slist () const
+ get_slist() const
{
return gslist_;
}
GCredentials**
- get_array () const
+ get_array() const
{
return garray_;
}
private:
// just in case
- Cache (const Cache&);
- Cache operator= (const Cache&);
+ Cache(const Cache&);
+ Cache operator=(const Cache&);
GList* glist_;
GSList* gslist_;
@@ -236,7 +238,7 @@ private:
};
Cache&
-get_cache ()
+get_cache()
{
static Cache global_cache;
@@ -246,335 +248,335 @@ get_cache ()
// C functions
GList*
-c_get_deep_owned_list ()
+c_get_deep_owned_list()
{
- return get_cache ().get_list ();
+ return get_cache().get_list();
}
GList*
-c_get_shallow_owned_list ()
+c_get_shallow_owned_list()
{
- return g_list_copy (c_get_deep_owned_list ());
+ return g_list_copy(c_get_deep_owned_list());
}
GList*
-c_get_unowned_list ()
+c_get_unowned_list()
{
- return create_list ();
+ return create_list();
}
GSList*
-c_get_deep_owned_slist ()
+c_get_deep_owned_slist()
{
- return get_cache ().get_slist ();
+ return get_cache().get_slist();
}
GSList*
-c_get_shallow_owned_slist ()
+c_get_shallow_owned_slist()
{
- return g_slist_copy (c_get_deep_owned_slist ());
+ return g_slist_copy(c_get_deep_owned_slist());
}
GSList*
-c_get_unowned_slist ()
+c_get_unowned_slist()
{
- return create_slist ();
+ return create_slist();
}
GCredentials**
-c_get_deep_owned_array ()
+c_get_deep_owned_array()
{
- return get_cache ().get_array ();
+ return get_cache().get_array();
}
GCredentials**
-c_get_shallow_owned_array ()
+c_get_shallow_owned_array()
{
- return copy_array (c_get_deep_owned_array ());
+ return copy_array(c_get_deep_owned_array());
}
GCredentials**
-c_get_unowned_array ()
+c_get_unowned_array()
{
- return create_array ();
+ return create_array();
}
/* these are probably buggy by design...
void
-c_take_list_all (GList* list)
+c_take_list_all(GList* list)
{
- if (list)
+ if(list)
{
- print_list (list);
- g_list_foreach (list, reinterpret_cast<GFunc> (g_object_unref), 0);
- g_list_free (list);
+ print_list(list);
+ g_list_foreach(list, reinterpret_cast<GFunc>(g_object_unref), 0);
+ g_list_free(list);
}
}
void
-c_take_list_members (GList* list)
+c_take_list_members(GList* list)
{
- if (list)
+ if(list)
{
- print_list (list);
- g_list_foreach (list, reinterpret_cast<GFunc> (g_object_unref), 0);
+ print_list(list);
+ g_list_foreach(list, reinterpret_cast<GFunc>(g_object_unref), 0);
}
}
*/
void
-c_take_list_nothing (GList* list)
+c_take_list_nothing(GList* list)
{
- if (list)
+ if(list)
{
- print_list (list);
+ print_list(list);
}
}
/* they are probably buggy by design...
void
-c_take_slist_all (GSList* slist)
+c_take_slist_all(GSList* slist)
{
- if (slist)
+ if(slist)
{
- print_slist (slist);
- g_slist_foreach (slist, reinterpret_cast<GFunc> (g_object_unref), 0);
- g_slist_free (slist);
+ print_slist(slist);
+ g_slist_foreach(slist, reinterpret_cast<GFunc>(g_object_unref), 0);
+ g_slist_free(slist);
}
}
void
-c_take_list_members (GSList* slist)
+c_take_list_members(GSList* slist)
{
- if (slist)
+ if(slist)
{
- print_slist (slist);
- g_slist_foreach (slist, reinterpret_cast<GFunc> (g_object_unref), 0);
+ print_slist(slist);
+ g_slist_foreach(slist, reinterpret_cast<GFunc>(g_object_unref), 0);
}
}
*/
void
-c_take_slist_nothing (GSList* slist)
+c_take_slist_nothing(GSList* slist)
{
- if (slist)
+ if(slist)
{
- print_slist (slist);
+ print_slist(slist);
}
}
/* they are probably buggy by design...
void
-c_take_array_all (GCredentials** array)
+c_take_array_all(GCredentials** array)
{
- if (array)
+ if(array)
{
- print_array (array);
- free_array (array);
+ print_array(array);
+ free_array(array);
}
}
void
-c_take_array_members (GCredentials** array)
+c_take_array_members(GCredentials** array)
{
- if (array)
+ if(array)
{
- print_array (array);
- free_array (array, false);
+ print_array(array);
+ free_array(array, false);
}
}
*/
void
-c_take_array_nothing (GCredentials** array)
+c_take_array_nothing(GCredentials** array)
{
- if (array)
+ if(array)
{
- print_array (array);
+ print_array(array);
}
}
// C++ wrappers.
std::vector<Glib::RefPtr<Gio::Credentials> >
-cxx_get_deep_owned_list ()
+cxx_get_deep_owned_list()
{
- return Glib::ListHandler<Glib::RefPtr<Gio::Credentials> >::list_to_vector (c_get_deep_owned_list (), Glib::OWNERSHIP_NONE);
+ return Glib::ListHandler<Glib::RefPtr<Gio::Credentials> >::list_to_vector(c_get_deep_owned_list(), Glib::OWNERSHIP_NONE);
}
std::vector<Glib::RefPtr<Gio::Credentials> >
-cxx_get_shallow_owned_list ()
+cxx_get_shallow_owned_list()
{
- return Glib::ListHandler<Glib::RefPtr<Gio::Credentials> >::list_to_vector (c_get_shallow_owned_list (), Glib::OWNERSHIP_SHALLOW);
+ return Glib::ListHandler<Glib::RefPtr<Gio::Credentials> >::list_to_vector(c_get_shallow_owned_list(), Glib::OWNERSHIP_SHALLOW);
}
std::vector<Glib::RefPtr<Gio::Credentials> >
-cxx_get_unowned_list ()
+cxx_get_unowned_list()
{
- return Glib::ListHandler<Glib::RefPtr<Gio::Credentials> >::list_to_vector (c_get_unowned_list (), Glib::OWNERSHIP_DEEP);
+ return Glib::ListHandler<Glib::RefPtr<Gio::Credentials> >::list_to_vector(c_get_unowned_list(), Glib::OWNERSHIP_DEEP);
}
std::vector<Glib::RefPtr<Gio::Credentials> >
-cxx_get_deep_owned_slist ()
+cxx_get_deep_owned_slist()
{
- return Glib::SListHandler<Glib::RefPtr<Gio::Credentials> >::slist_to_vector (c_get_deep_owned_slist (), Glib::OWNERSHIP_NONE);
+ return Glib::SListHandler<Glib::RefPtr<Gio::Credentials> >::slist_to_vector(c_get_deep_owned_slist(), Glib::OWNERSHIP_NONE);
}
std::vector<Glib::RefPtr<Gio::Credentials> >
-cxx_get_shallow_owned_slist ()
+cxx_get_shallow_owned_slist()
{
- return Glib::SListHandler<Glib::RefPtr<Gio::Credentials> >::slist_to_vector (c_get_shallow_owned_slist (), Glib::OWNERSHIP_SHALLOW);
+ return Glib::SListHandler<Glib::RefPtr<Gio::Credentials> >::slist_to_vector(c_get_shallow_owned_slist(), Glib::OWNERSHIP_SHALLOW);
}
std::vector<Glib::RefPtr<Gio::Credentials> >
-cxx_get_unowned_slist ()
+cxx_get_unowned_slist()
{
- return Glib::SListHandler<Glib::RefPtr<Gio::Credentials> >::slist_to_vector (c_get_unowned_slist (), Glib::OWNERSHIP_DEEP);
+ return Glib::SListHandler<Glib::RefPtr<Gio::Credentials> >::slist_to_vector(c_get_unowned_slist(), Glib::OWNERSHIP_DEEP);
}
std::vector<Glib::RefPtr<Gio::Credentials> >
-cxx_get_deep_owned_array ()
+cxx_get_deep_owned_array()
{
- return Glib::ArrayHandler<Glib::RefPtr<Gio::Credentials> >::array_to_vector (c_get_deep_owned_array (), Glib::OWNERSHIP_NONE);
+ return Glib::ArrayHandler<Glib::RefPtr<Gio::Credentials> >::array_to_vector(c_get_deep_owned_array(), Glib::OWNERSHIP_NONE);
}
std::vector<Glib::RefPtr<Gio::Credentials> >
-cxx_get_shallow_owned_array ()
+cxx_get_shallow_owned_array()
{
- return Glib::ArrayHandler<Glib::RefPtr<Gio::Credentials> >::array_to_vector (c_get_shallow_owned_array (), Glib::OWNERSHIP_SHALLOW);
+ return Glib::ArrayHandler<Glib::RefPtr<Gio::Credentials> >::array_to_vector(c_get_shallow_owned_array(), Glib::OWNERSHIP_SHALLOW);
}
std::vector<Glib::RefPtr<Gio::Credentials> >
-cxx_get_unowned_array ()
+cxx_get_unowned_array()
{
- return Glib::ArrayHandler<Glib::RefPtr<Gio::Credentials> >::array_to_vector (c_get_unowned_array (), Glib::OWNERSHIP_DEEP);
+ return Glib::ArrayHandler<Glib::RefPtr<Gio::Credentials> >::array_to_vector(c_get_unowned_array(), Glib::OWNERSHIP_DEEP);
}
/* they are probably buggy by design...
void
-cxx_list_take_all (const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
+cxx_list_take_all(const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
{
- c_take_list_all (Glib::ListHandler<Glib::RefPtr<Gio::Credentials> >::vector_to_list (v).data ());
+ c_take_list_all(Glib::ListHandler<Glib::RefPtr<Gio::Credentials> >::vector_to_list(v).data());
}
void
-cxx_list_take_members (const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
+cxx_list_take_members(const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
{
- c_take_list_members (Glib::ListHandler<Glib::RefPtr<Gio::Credentials> >::vector_to_list (v).data ());
+ c_take_list_members(Glib::ListHandler<Glib::RefPtr<Gio::Credentials> >::vector_to_list(v).data());
}
*/
void
-cxx_list_take_nothing (const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
+cxx_list_take_nothing(const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
{
- c_take_list_nothing (Glib::ListHandler<Glib::RefPtr<Gio::Credentials> >::vector_to_list (v).data ());
+ c_take_list_nothing(Glib::ListHandler<Glib::RefPtr<Gio::Credentials> >::vector_to_list(v).data());
}
/* they are probably buggy by design...
void
-cxx_slist_take_all (const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
+cxx_slist_take_all(const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
{
- c_take_slist_all (Glib::SListHandler<Glib::RefPtr<Gio::Credentials> >::vector_to_slist (v).data ());
+ c_take_slist_all(Glib::SListHandler<Glib::RefPtr<Gio::Credentials> >::vector_to_slist(v).data());
}
void
-cxx_slist_take_members (const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
+cxx_slist_take_members(const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
{
- c_take_slist_members (Glib::SListHandler<Glib::RefPtr<Gio::Credentials> >::vector_to_slist (v).data ());
+ c_take_slist_members(Glib::SListHandler<Glib::RefPtr<Gio::Credentials> >::vector_to_slist(v).data());
}
*/
void
-cxx_slist_take_nothing (const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
+cxx_slist_take_nothing(const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
{
- c_take_slist_nothing (Glib::SListHandler<Glib::RefPtr<Gio::Credentials> >::vector_to_slist (v).data ());
+ c_take_slist_nothing(Glib::SListHandler<Glib::RefPtr<Gio::Credentials> >::vector_to_slist(v).data());
}
/* they are probably buggy by design...
void
-cxx_array_take_all (const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
+cxx_array_take_all(const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
{
- c_take_array_all (Glib::ArrayHandler<Glib::RefPtr<Gio::Credentials> >::vector_to_array (v).data ());
+ c_take_array_all(Glib::ArrayHandler<Glib::RefPtr<Gio::Credentials> >::vector_to_array(v).data());
}
void
-cxx_array_take_members (const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
+cxx_array_take_members(const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
{
- c_take_array_members (Glib::ArrayHandler<Glib::RefPtr<Gio::Credentials> >::vector_to_array (v).data ());
+ c_take_array_members(Glib::ArrayHandler<Glib::RefPtr<Gio::Credentials> >::vector_to_array(v).data());
}
*/
void
-cxx_array_take_nothing (const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
+cxx_array_take_nothing(const std::vector<Glib::RefPtr<Gio::Credentials> >& v)
{
- c_take_array_nothing (Glib::ArrayHandler<Glib::RefPtr<Gio::Credentials> >::vector_to_array (v).data ());
+ c_take_array_nothing(Glib::ArrayHandler<Glib::RefPtr<Gio::Credentials> >::vector_to_array(v).data());
}
int
main()
{
- Gio::init ();
+ Gio::init();
- Cache& cache (get_cache ());
+ Cache& cache(get_cache());
std::cout << "Cache list before:\n";
- print_list (cache.get_list ());
+ print_list(cache.get_list());
std::cout << "Cache slist before:\n";
- print_slist (cache.get_slist ());
+ print_slist(cache.get_slist());
std::cout << "Cache array before:\n";
- print_array (cache.get_array ());
+ print_array(cache.get_array());
std::cout << "Deep owned list:\n";
- print_vector (cxx_get_deep_owned_list ());
+ print_vector(cxx_get_deep_owned_list());
std::cout << "Shallow owned list:\n";
- print_vector (cxx_get_shallow_owned_list ());
+ print_vector(cxx_get_shallow_owned_list());
std::cout << "Unowned list:\n";
- print_vector (cxx_get_unowned_list ());
+ print_vector(cxx_get_unowned_list());
std::cout << "Deep owned slist:\n";
- print_vector (cxx_get_deep_owned_slist ());
+ print_vector(cxx_get_deep_owned_slist());
std::cout << "Shallow owned slist:\n";
- print_vector (cxx_get_shallow_owned_slist ());
+ print_vector(cxx_get_shallow_owned_slist());
std::cout << "Unowned slist:\n";
- print_vector (cxx_get_unowned_slist ());
+ print_vector(cxx_get_unowned_slist());
std::cout << "Deep owned array:\n";
- print_vector (cxx_get_deep_owned_array ());
+ print_vector(cxx_get_deep_owned_array());
std::cout << "Shallow owned array:\n";
- print_vector (cxx_get_shallow_owned_array ());
+ print_vector(cxx_get_shallow_owned_array());
std::cout << "Unowned array:\n";
- print_vector (cxx_get_unowned_array ());
+ print_vector(cxx_get_unowned_array());
std::cout << "Cache list after:\n";
- print_list (cache.get_list ());
+ print_list(cache.get_list());
std::cout << "Cache slist after:\n";
- print_slist (cache.get_slist ());
+ print_slist(cache.get_slist());
std::cout << "Cache array after:\n";
- print_array (cache.get_array ());
+ print_array(cache.get_array());
- std::vector<Glib::RefPtr<Gio::Credentials> > v (cxx_get_unowned_list ());
+ std::vector<Glib::RefPtr<Gio::Credentials> > v(cxx_get_unowned_list());
std::cout << "Gotten vector before:\n";
- print_vector (v);
+ print_vector(v);
// I am wondering if C functions wrapped by the ones below are not buggy by
// design. Anyway - it segfaults. Maybe the test case is just wrong.
//std::cout << "Take list all:\n";
- //cxx_list_take_all (v);
+ //cxx_list_take_all(v);
//std::cout << "Take list members:\n";
- //cxx_list_take_members (v);
+ //cxx_list_take_members(v);
std::cout << "Take list nothing:\n";
- cxx_list_take_nothing (v);
+ cxx_list_take_nothing(v);
// Ditto.
//std::cout << "Take slist all:\n";
- //cxx_slist_take_all (v);
+ //cxx_slist_take_all(v);
//std::cout << "Take slist members:\n";
- //cxx_slist_take_members (v);
+ //cxx_slist_take_members(v);
std::cout << "Take slist nothing:\n";
- cxx_slist_take_nothing (v);
+ cxx_slist_take_nothing(v);
// Ditto.
//std::cout << "Take array all:\n";
- //cxx_array_take_all (v);
+ //cxx_array_take_all(v);
//std::cout << "Take array members:\n";
- //cxx_array_take_members (v);
+ //cxx_array_take_members(v);
std::cout << "Take array nothing:\n";
- cxx_array_take_nothing (v);
+ cxx_array_take_nothing(v);
std::cout << "Gotten vector after:\n";
- print_vector (v);
+ print_vector(v);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]