tasn pushed a commit to branch master.

http://git.enlightenment.org/bindings/cxx/eflxx.git/commit/?id=88db4265b357a48312c683555bd18c6b9c40d0ec

commit 88db4265b357a48312c683555bd18c6b9c40d0ec
Author: Andreas Volz <[email protected]>
Date:   Sun Dec 13 20:46:38 2009 +0000

    - added Einaxx list implementation (only raw at the moment...)
    - removed old Ecorexx list implementation
    
    
    SVN revision: 44434
---
 ecorexx/include/ecorexx/Ecorexx.h           |   1 -
 ecorexx/include/ecorexx/List.h              | 521 ----------------------------
 ecorexx/include/ecorexx/Makefile.am         |   1 -
 eflxx_examples/configure.ac                 |   3 +
 eflxx_examples/src/Makefile.am              |   3 +-
 eflxx_examples/src/ecorexx/list/Makefile.am |   8 -
 eflxx_examples/src/ecorexx/list/main.cpp    |   2 +
 eflxx_examples/src/einaxx/Makefile.am       |   6 +
 eflxx_examples/src/einaxx/list/Makefile.am  |  15 +
 eflxx_examples/src/einaxx/list/main.cpp     |  37 ++
 einaxx/einaxx-uninstalled.pc.in             |   2 +-
 einaxx/einaxx.pc.in                         |   2 +-
 einaxx/include/einaxx/Application.h         |  25 ++
 einaxx/include/einaxx/Einaxx.h              |  13 +
 einaxx/include/einaxx/List.h                | 285 +++++++++++++++
 einaxx/include/einaxx/Makefile.am           |   6 +-
 einaxx/src/Application.cpp                  |  30 ++
 einaxx/src/Makefile.am                      |   3 +-
 18 files changed, 427 insertions(+), 536 deletions(-)

diff --git a/ecorexx/include/ecorexx/Ecorexx.h 
b/ecorexx/include/ecorexx/Ecorexx.h
index 929688e..3ff98fd 100644
--- a/ecorexx/include/ecorexx/Ecorexx.h
+++ b/ecorexx/include/ecorexx/Ecorexx.h
@@ -11,7 +11,6 @@
 #include "Application.h"
 #include "Config.h"
 #include "EvasWindow.h"
-#include "List.h"
 #include "Timer.h"
 #include "XWindow.h"
 
diff --git a/ecorexx/include/ecorexx/List.h b/ecorexx/include/ecorexx/List.h
deleted file mode 100644
index 74c89b8..0000000
--- a/ecorexx/include/ecorexx/List.h
+++ /dev/null
@@ -1,521 +0,0 @@
-#ifndef ECORE_DATA_H
-#define ECORE_DATA_H
-
-/* EFL */
-#include <Ecore_Data.h>
-
-namespace Ecorexx {
-
-template <typename T>
-class List
-{
-public:
-  /*!
-   *  Create a new List.
-   */
-  List();
-
-  /*!
-   *  Create a List from by using a existing Ecore_List C object.
-   *  Notice that the destructor deletes the C object list.
-   */
-  List(Ecore_List *list); // TODO: wrap?
-
-  virtual ~List();
-
-  /*!
-   *  return The internal Ecore_List object
-   */
-  Ecore_List *obj();
-
-  /* Adding items to the list */
-  bool append( T *data );
-  bool prepend( T *data );
-  bool insert( T *data );
-  bool appendList( List <T> *append);
-  bool prependList( List <T> *prepend);
-
-  /* Removing items from the list */
-  // TODO: how to integrate this with destructors?
-  //int ecore_list_remove_destroy(Ecore_List *list);
-  T *remove();
-  T *removeFirst();
-  T *removeLast();
-
-  /* Retrieve the current position in the list */
-  T *current();
-  T *first();
-  T *last();
-  int index();
-  int count();
-
-  /* Traversing the list */
-  // not wrapped! -> std::for_each exist. -> #include <algorithm>
-  // TODO: need to implement an iterator to get this working
-  //EAPI int ecore_list_for_each(Ecore_List *list, Ecore_For_Each function,
-  //                   void *user_data);
-  T *gotoFirst();
-  T *gotoLast();
-  T *gotoIndex(int index);
-  T *gotoElement(const T *data);
-
-  /* Traversing the list and returning data */
-  T *next();
-  // not wrapped! -> std::find* exist. -> #include <algorithm>
-  // TODO: need to implement an iterator to get this working
-  //EAPI void *ecore_list_find(Ecore_List *list, Ecore_Compare_Cb function,
-  //    const void *user_data);
-
-  /* Sorting the list */
-  // TODO: it may help to implement operators <,>,== to wrap it
-  /*EAPI int ecore_list_sort(Ecore_List *list, Ecore_Compare_Cb compare,
-                                 char order);
-  EAPI int ecore_list_mergesort(Ecore_List *list, Ecore_Compare_Cb compare,
-                                 char order);
-  EAPI int ecore_list_heapsort(Ecore_List *list, Ecore_Compare_Cb compare,
-                                 char order);*/
-
-  bool isEmpty();
-  bool clear();
-
-  /*class forward_iterator
-  {
-    public:
-      forward_iterator ()
-      {
-          list = m_list;
-      }
-
-      // Prefix
-      forward_iterator& operator++ ()
-      {
-          list = list->next ();
-          return *this;
-      }
-
-      // Postfix
-      forward_iterator operator++ (int)
-      {
-          forward_iterator oldIterator =* this;
-          list = list->next ();
-          return oldIterator;
-      }
-
-    private:
-      List<T> list;
-
-  };*/
-
-  //forward_iterator begin ();
-  //forward_iterator end ();
-
-private:
-  Ecore_List *m_list;
-};
-
-
-
-template <typename T>
-class EcoreDList
-{
-public:
-  /*!
-   *  Create a new List.
-   */
-  EcoreDList();
-
-  /*!
-   *  Create a List from by using a existing Ecore_List C object.
-   *  Notice that the destructor deletes the C object list.
-   */
-  EcoreDList(Ecore_DList *list);
-
-  virtual ~EcoreDList();
-
-  /*!
-   *  return The internal Ecore_DList object
-   */
-  Ecore_DList *obj();
-
-  /* Adding items to the list */
-  bool append( T *data );
-  bool prepend( T *data );
-  bool insert( T *data );
-  bool appendList( EcoreDList <T> *append);
-  bool prependList( EcoreDList <T> *prepend);
-  // not wrapped! -> std::for_each exist. -> #include <algorithm>
-  // need to implement an iterator to get this working
-  /* Removing items from the list */
-  // TODO: how to integrate this with destructors?
-  //int ecore_dlist_remove_destroy(Ecore_List *list);
-  T *remove();
-  T *removeFirst();
-  T *removeLast();
-
-  /* Retrieve the current position in the list */
-  T *current();
-  // TODO: Why no first and last in Ecore_DList?
-  //T *first();
-  //T *last();
-  int index();
-  int count();
-
-  /* Traversing the list */
-  // not wrapped! -> std::for_each exist. -> #include <algorithm>
-  // need to implement an iterator to get this working
-  //EAPI int ecore_dlist_for_each(Ecore_List *list, Ecore_For_Each function,
-  //                   void *user_data);
-  T *gotoFirst();
-  T *gotoLast();
-  T *gotoIndex(int index);
-  T *gotoElement(const T *data);
-
-
-  /* Traversing the list and returning data */
-  T *next();
-  T *previous();
-  // not wrapped! -> std::find* exist. -> #include <algorithm>
-  // TODO: need to implement an iterator to get this working
-  //EAPI void *ecore_dlist_find(Ecore_List *list, Ecore_Compare_Cb function,
-  //    const void *user_data);
-
-  /* Sorting the list */
-  /*EAPI int ecore_dlist_sort(Ecore_List *list, Ecore_Compare_Cb compare,
-                                 char order);
-  EAPI int ecore_dlist_mergesort(Ecore_List *list, Ecore_Compare_Cb compare,
-                                 char order);
-  EAPI int ecore_dlist_heapsort(Ecore_List *list, Ecore_Compare_Cb compare,
-                                 char order);*/
-
-  bool isEmpty();
-  bool clear();
-
-private:
-  Ecore_DList *m_list;
-};
-
-/** Implementaion **/
-
-/*************/
-/* List */
-/*************/
-
-template <typename T>
-List<T>::List()
-{
-  m_list = ecore_list_new();
-  // todo: how to handle error return? -> Exception?
-}
-
-template <typename T>
-List<T>::List(Ecore_List *list)
-{
-  m_list = list;
-}
-
-template <typename T>
-List<T>::~List()
-{
-  ecore_list_destroy( m_list );
-}
-
-template <typename T>
-Ecore_List *List<T>::obj()
-{
-  return m_list;
-}
-
-template <typename T>
-bool List<T>::append( T *data )
-{
-  return ecore_list_append( m_list, static_cast <void*> (data) );
-}
-
-template <typename T>
-bool List<T>::prepend( T *data )
-{
-  return ecore_list_prepend( m_list, static_cast <void*> (data) );
-}
-
-template <typename T>
-bool List<T>::insert( T *data )
-{
-  return ecore_list_insert( m_list, static_cast <void*> (data) );
-}
-
-template <typename T>
-bool List<T>::appendList( List <T> *append)
-{
-  return ecore_list_append_list( m_list, append.m_list);
-}
-
-template <typename T>
-bool List<T>::prependList( List <T> *prepend)
-{
-  return ecore_list_prepend_list( m_list, prepend.m_list);
-}
-
-template <typename T>
-T *List<T>::remove()
-{
-  return static_cast <T*> (ecore_list_remove( m_list ) );
-}
-
-template <typename T>
-T *List<T>::removeFirst()
-{
-  return static_cast <T*> ( ecore_list_first_remove( m_list ) );
-}
-
-template <typename T>
-T *List<T>::removeLast()
-{
-  return static_cast <T*> ( ecore_list_last_remove( m_list ) );
-}
-
-template <typename T>
-T *List<T>::current()
-{
-  return static_cast <T*> ( ecore_list_current( m_list ) );
-}
-
-template <typename T>
-T *List<T>::first()
-{
-  return static_cast <T*> ( ecore_list_first( m_list ) );
-}
-
-template <typename T>
-T *List<T>::last()
-{
-  return static_cast <T*> ( ecore_list_last( m_list) );
-}
-
-template <typename T>
-int List<T>::index()
-{
-  return ecore_list_index( m_list );
-}
-
-template <typename T>
-int List<T>::count()
-{
-  return ecore_list_count( m_list );
-}
-
-template <typename T>
-T *List<T>::gotoFirst()
-{
-  return static_cast <T*> ( ecore_list_first_goto( m_list ) );
-}
-
-template <typename T>
-T* List<T>::gotoLast()
-{
-  return static_cast <T*> ( ecore_list_last_goto( m_list ) );
-}
-
-template <typename T>
-T *List<T>::gotoIndex(int index)
-{
-  return static_cast <T*> ( ecore_list_index_goto( m_list, index ) );
-}
-
-template <typename T>
-T *List<T>::gotoElement(const T *data)
-{
-  return static_cast <T*> ( ecore_list_goto( m_list,
-                            static_cast <const void*> ( data ) ));
-}
-
-template <typename T>
-T *List<T>::next()
-{
-  return static_cast <T*> ( ecore_list_next( m_list ));
-}
-
-template <typename T>
-bool List<T>::isEmpty()
-{
-  return ecore_list_empty_is ( m_list );
-}
-
-template <typename T>
-bool List<T>::clear()
-{
-  return ecore_list_clear( m_list );
-}
-
-/*template <typename T>
-forward_iterator List<T>::begin ()
-{
-  //forward_iterator fi;
-
-}
-
-template <typename T>
-List<T>::forward_iterator List<T>::end ()
-{
-
-}*/
-
-
-/**************/
-/* EcoreDList */
-/**************/
-
-template <typename T>
-EcoreDList<T>::EcoreDList()
-{
-  m_list = ecore_dlist_new();
-  // todo: how to handle error return? -> Exception?
-}
-
-template <typename T>
-EcoreDList<T>::EcoreDList(Ecore_DList *list)
-{
-  m_list = list;
-}
-
-template <typename T>
-EcoreDList<T>::~EcoreDList()
-{
-  ecore_dlist_destroy( m_list );
-}
-
-template <typename T>
-Ecore_DList *EcoreDList<T>::obj()
-{
-  return m_list;
-}
-
-template <typename T>
-bool EcoreDList<T>::append( T *data )
-{
-  return ecore_dlist_append( m_list, static_cast <void*> (data) );
-}
-
-template <typename T>
-bool EcoreDList<T>::prepend( T *data )
-{
-  return ecore_dlist_prepend( m_list, static_cast <void*> (data) );
-}
-
-template <typename T>
-bool EcoreDList<T>::insert( T *data )
-{
-  return ecore_dlist_insert( m_list, static_cast <void*> (data) );
-}
-
-template <typename T>
-bool EcoreDList<T>::appendList( EcoreDList <T> *append)
-{
-  return ecore_dlist_append_list( m_list, append.m_list);
-}
-
-template <typename T>
-bool EcoreDList<T>::prependList( EcoreDList <T> *prepend)
-{
-  return ecore_dlist_prepend_list( m_list, prepend.m_list);
-}
-
-template <typename T>
-T *EcoreDList<T>::remove()
-{
-  return static_cast <T*> (ecore_dlist_remove( m_list ) );
-}
-
-template <typename T>
-T* EcoreDList<T>::removeFirst()
-{
-  return static_cast <T*> ( ecore_dlist_first_remove( m_list ) );
-}
-
-template <typename T>
-T *EcoreDList<T>::removeLast()
-{
-  return static_cast <T*> ( ecore_dlist_last_remove( m_list ) );
-}
-
-template <typename T>
-T *EcoreDList<T>::current()
-{
-  return static_cast <T*> ( ecore_dlist_current( m_list ) );
-}
-
-/*template <typename T>
-T EcoreDList<T>::first()
-{
-    return static_cast <T> ( ecore_dlist_first( m_list ) );
-}
-
-template <typename T>
-T EcoreDList<T>::last()
-{
-    return static_cast <T> ( ecore_dlist_last( m_list) );
-}*/
-
-template <typename T>
-int EcoreDList<T>::index()
-{
-  return ecore_dlist_index( m_list );
-}
-
-template <typename T>
-int EcoreDList<T>::count()
-{
-  return ecore_dlist_count( m_list );
-}
-
-template <typename T>
-T *EcoreDList<T>::gotoFirst()
-{
-  return static_cast <T*> ( ecore_dlist_first_goto( m_list ) );
-}
-
-template <typename T>
-T *EcoreDList<T>::gotoLast()
-{
-  return static_cast <T*> ( ecore_dlist_last_goto( m_list ) );
-}
-
-template <typename T>
-T *EcoreDList<T>::gotoIndex(int index)
-{
-  return static_cast <T*> ( ecore_dlist_index_goto( m_list, index ) );
-}
-
-template <typename T>
-T *EcoreDList<T>::gotoElement(const T *data)
-{
-  return static_cast <T*> ( ecore_dlist_goto( m_list,
-                            static_cast <const void*> ( data ) ));
-}
-
-template <typename T>
-T *EcoreDList<T>::next()
-{
-  return static_cast <T*> ( ecore_dlist_next( m_list ));
-}
-
-template <typename T>
-T *EcoreDList<T>::previous()
-{
-  return static_cast <T*> ( ecore_dlist_previous( m_list ));
-}
-
-template <typename T>
-bool EcoreDList<T>::isEmpty()
-{
-  return ecore_dlist_empty_is ( m_list );
-}
-
-template <typename T>
-bool EcoreDList<T>::clear()
-{
-  return ecore_dlist_clear( m_list );
-}
-
-} // end namespace Ecorexx
-
-#endif // ECORE_BASE_H
diff --git a/ecorexx/include/ecorexx/Makefile.am 
b/ecorexx/include/ecorexx/Makefile.am
index 558ed9f..2d4b607 100644
--- a/ecorexx/include/ecorexx/Makefile.am
+++ b/ecorexx/include/ecorexx/Makefile.am
@@ -3,7 +3,6 @@ libecorexx_HEADERS = \
        Application.h\
        Config.h \
        EvasWindow.h \
-       List.h \
        XWindow.h \
        Animator.h \
        Timer.h \
diff --git a/eflxx_examples/configure.ac b/eflxx_examples/configure.ac
index 6eddfb4..fd8b4a5 100644
--- a/eflxx_examples/configure.ac
+++ b/eflxx_examples/configure.ac
@@ -106,6 +106,7 @@ PKG_CHECK_MODULES(ECOREXX, ecorexx)
 PKG_CHECK_MODULES(EETXX, eetxx)
 PKG_CHECK_MODULES(EMOTIONXX, emotionxx)
 PKG_CHECK_MODULES(ELEMENTARYXX, elementaryxx)
+PKG_CHECK_MODULES(EINAXX, einaxx)
 AC_OUTPUT([
 Makefile
 data/Makefile
@@ -138,6 +139,8 @@ src/emotionxx/simple/Makefile
 src/elementaryxx/Makefile
 src/elementaryxx/simple/Makefile
 src/elementaryxx/full/Makefile
+src/einaxx/Makefile
+src/einaxx/list/Makefile
 src/debug/Makefile
 src/debug/simple/Makefile
 src/signals/Makefile
diff --git a/eflxx_examples/src/Makefile.am b/eflxx_examples/src/Makefile.am
index 3361223..7945229 100644
--- a/eflxx_examples/src/Makefile.am
+++ b/eflxx_examples/src/Makefile.am
@@ -20,6 +20,7 @@ SUBDIRS = \
        emotionxx \
        debug \
        signals \
-       elementaryxx
+       elementaryxx \
+       einaxx
 
 
diff --git a/eflxx_examples/src/ecorexx/list/Makefile.am 
b/eflxx_examples/src/ecorexx/list/Makefile.am
index 08e6b23..98dfe6b 100644
--- a/eflxx_examples/src/ecorexx/list/Makefile.am
+++ b/eflxx_examples/src/ecorexx/list/Makefile.am
@@ -6,14 +6,6 @@ AM_CXXFLAGS =\
         -Wall
 
 
-bin_PROGRAMS = ecorexx_example_list
-
-ecorexx_example_list_SOURCES = \
-       main.cpp        
-
-ecorexx_example_list_LDADD = \
-       $(ECOREXX_LIBS)
-
 AM_CPPFLAGS = \
        $(ECOREXX_CFLAGS)
 
diff --git a/eflxx_examples/src/ecorexx/list/main.cpp 
b/eflxx_examples/src/ecorexx/list/main.cpp
index 914cece..c7d0a4e 100644
--- a/eflxx_examples/src/ecorexx/list/main.cpp
+++ b/eflxx_examples/src/ecorexx/list/main.cpp
@@ -1,3 +1,4 @@
+#if 0
 #include <ecorexx/Ecorexx.h>
 
 #include <iostream>
@@ -47,3 +48,4 @@ int main( int argc, const char **argv )
 
   return 0;
 }
+#endif
diff --git a/eflxx_examples/src/einaxx/Makefile.am 
b/eflxx_examples/src/einaxx/Makefile.am
new file mode 100644
index 0000000..c28ca40
--- /dev/null
+++ b/eflxx_examples/src/einaxx/Makefile.am
@@ -0,0 +1,6 @@
+
+SUBDIRS = \
+       list
+
+## File created by the gnome-build tools
+
diff --git a/eflxx_examples/src/einaxx/list/Makefile.am 
b/eflxx_examples/src/einaxx/list/Makefile.am
new file mode 100644
index 0000000..ec2f7a2
--- /dev/null
+++ b/eflxx_examples/src/einaxx/list/Makefile.am
@@ -0,0 +1,15 @@
+
+bin_PROGRAMS = \
+       einaxx_example_list
+
+einaxx_example_list_SOURCES = \
+       main.cpp
+
+einaxx_example_list_LDADD = \
+       $(EINAXX_LIBS)
+
+AM_CPPFLAGS = \
+       $(EINAXX_CFLAGS)
+
+## File created by the gnome-build tools
+
diff --git a/eflxx_examples/src/einaxx/list/main.cpp 
b/eflxx_examples/src/einaxx/list/main.cpp
new file mode 100644
index 0000000..a032ba0
--- /dev/null
+++ b/eflxx_examples/src/einaxx/list/main.cpp
@@ -0,0 +1,37 @@
+#include <einaxx/Einaxx.h>
+
+#include <iostream>
+
+using namespace std;
+using namespace Einaxx;
+
+int main (int argc, char **argv)
+{
+  Application::init ();
+  
+  List<int*> l;
+  int i1 = 1;
+  int i2 = 2;
+  int i3 = 3;
+  int i4 = 4;
+  int i5 = 5;
+  
+  l.append (&i1);
+  l.append (&i2);
+  l.append (&i3);
+  l.append (&i4);
+  l.append (&i5);
+
+  List<int*>::Iterator it = l.createIterator ();
+  
+  int *ptr;
+  
+  it.next (&ptr);
+  
+  cout << "i1: " << *ptr << endl;
+  cout << "i2: " << *(l.at (2)) << endl;
+
+  Application::shutdown ();
+
+  return 0;
+}
diff --git a/einaxx/einaxx-uninstalled.pc.in b/einaxx/einaxx-uninstalled.pc.in
index ca0b7ba..0d139b3 100644
--- a/einaxx/einaxx-uninstalled.pc.in
+++ b/einaxx/einaxx-uninstalled.pc.in
@@ -6,7 +6,7 @@ includedir=include
 Name: @PACKAGE@
 Description: Eina (EFL) C++ Wrapper, Not installed
 Version: @VERSION@
-Requires: sigc++-2.0 eina eflxx
+Requires: sigc++-2.0 eflxx eina-0
 Conflicts: 
 Libs: ${pcfiledir}/${libdir}/libeinaxx.la
 Cflags: -I${pcfiledir}/${includedir} 
diff --git a/einaxx/einaxx.pc.in b/einaxx/einaxx.pc.in
index ec902e6..8e6f453 100644
--- a/einaxx/einaxx.pc.in
+++ b/einaxx/einaxx.pc.in
@@ -6,7 +6,7 @@ includedir=@prefix@/include
 Name: @PACKAGE@
 Description: Eina (EFL) C++ Wrapper
 Version: @VERSION@
-Requires: sigc++-2.0 einaxx eflxx
+Requires: sigc++-2.0 eflxx eina-0
 Conflicts: 
 Libs: -L${libdir} -leinaxx
 Cflags: -I${includedir}
diff --git a/einaxx/include/einaxx/Application.h 
b/einaxx/include/einaxx/Application.h
new file mode 100644
index 0000000..ef40570
--- /dev/null
+++ b/einaxx/include/einaxx/Application.h
@@ -0,0 +1,25 @@
+#ifndef EINAXX_BASE_H
+#define EINAXX_BASE_H
+
+/* EFL */
+#include <Eina.h>
+
+namespace Einaxx {
+
+class Application
+{
+public:
+  static int getHamsterCount ();
+       
+  static int init ();
+
+  static int shutdown ();
+
+  static int initThreads ();
+
+  static int shutdownThreads ();
+};
+
+} // end namespace Einaxx
+
+#endif // EINAXX_BASE_H
diff --git a/einaxx/include/einaxx/Einaxx.h b/einaxx/include/einaxx/Einaxx.h
new file mode 100644
index 0000000..f8b1b23
--- /dev/null
+++ b/einaxx/include/einaxx/Einaxx.h
@@ -0,0 +1,13 @@
+#ifndef EINAXX_H
+#define EINAXX_H
+
+/* This is the main include header for Einaxx. You should include it in your
+ * application. you could also use a combination of some headers and forward
+ * declarations to speed up compiling. But the default way is to simply 
+ * #include "Einaxx.h".
+ */
+
+#include "Application.h"
+#include "List.h"
+
+#endif // EINAXX_H
diff --git a/einaxx/include/einaxx/List.h b/einaxx/include/einaxx/List.h
new file mode 100644
index 0000000..4f8747a
--- /dev/null
+++ b/einaxx/include/einaxx/List.h
@@ -0,0 +1,285 @@
+#ifndef EINAXX_LIST_H
+#define EINAXX_LIST_H
+
+/* EFL */
+#include <Eina.h>
+
+namespace Einaxx {
+
+template <typename T>
+class List
+{
+public:
+  class Iterator
+  {
+  public:
+    Iterator (const Eina_List *list); // TODO: friend and private
+      
+    ~Iterator ();
+  
+    //T getContainer ();
+      
+    bool next (T *data);
+      
+/*
+
+EAPI void *eina_iterator_container_get (Eina_Iterator *iterator);
+
+EAPI void eina_iterator_foreach        (Eina_Iterator *iterator,
+                                        Eina_Each callback,
+                                        const void *fdata);
+
+*/
+      
+      
+  protected:
+    Eina_Iterator *mIterator;
+  };
+  
+  
+  /*!
+   *  Create a new List.
+   */
+  List ();
+  
+  ~List ();
+  
+  void append (const T data);
+  
+  void prepend (const T data);
+  
+  void appendRelative (const T data, const T relative);
+  
+  //void appendRelative (const T &data, ListIterator it);
+  //Eina_List *eina_list_append_relative_list (Eina_List *list, const void 
*data, Eina_List *relative);
+  
+  void prependRelative (const T data, const T relative);
+
+  //void prependRelativeList (const T &data, ListIterator it);
+  //Eina_List *eina_list_prepend_relative_list (Eina_List *list, const void 
*data, Eina_List *relative);
+
+  //Eina_List *eina_list_sorted_insert(Eina_List *list, Eina_Compare_Cb func, 
const void *data);
+  
+  void remove (const T data);
+
+  //Eina_List *eina_list_remove_list (Eina_List *list, Eina_List *remove_list);
+  
+  /*
+  Eina_List *eina_list_promote_list (Eina_List *list, Eina_List *move_list);
+  Eina_List *eina_list_demote_list (Eina_List *list, Eina_List *move_list);*/
+  
+  // TODO: wrap or with stl::find
+  //void *eina_list_data_find(const Eina_List *list, const void *data);
+  
+  //Eina_List *eina_list_data_find_list (const Eina_List *list, const void 
*data);
+
+  T at (unsigned int n); // TODO: [] operator
+
+  void reverse ();
+
+  /*
+  Eina_List *eina_list_reverse_clone(const Eina_List *list);
+  Eina_List *eina_list_clone(const Eina_List *list);
+  Eina_List *eina_list_sort (Eina_List *list, unsigned int size, 
Eina_Compare_Cb func);
+  Eina_List *eina_list_merge (Eina_List *left, Eina_List *right);
+  Eina_List *eina_list_sorted_merge(Eina_List *left, Eina_List *right, 
Eina_Compare_Cb func);
+  Eina_List *eina_list_split_list(Eina_List *list, Eina_List *relative, 
Eina_List **right);
+
+  Eina_List *eina_list_search_sorted_near_list(const Eina_List *list, 
Eina_Compare_Cb func, const void *data, int *result_cmp);
+  Eina_List *eina_list_search_sorted_list(const Eina_List *list, 
Eina_Compare_Cb func, const void *data);
+  void *eina_list_search_sorted(const Eina_List *list, Eina_Compare_Cb func, 
const void *data);
+  Eina_List *eina_list_search_unsorted_list(const Eina_List *list, 
Eina_Compare_Cb func, const void *data);
+  void *eina_list_search_unsorted(const Eina_List *list, Eina_Compare_Cb func, 
const void *data);
+
+  static inline Eina_List *eina_list_last (const Eina_List *list);
+  static inline Eina_List *eina_list_next (const Eina_List *list);
+  static inline Eina_List *eina_list_prev (const Eina_List *list);
+  */
+  
+  T getData (); // TODO: * operator
+
+  unsigned int count ();
+
+  Iterator createIterator ();
+
+  //Eina_Accessor *eina_list_accessor_new(const Eina_List *list);
+  
+private:
+  Eina_List *mList;
+};
+
+/** Implementation **/
+
+/*************/
+/* Iterator  */
+/*************/
+
+template <typename T>
+List<T>::Iterator::Iterator (const Eina_List *list)
+{
+  mIterator = eina_list_iterator_new (list);
+
+  // TODO: support reverse operator
+  // with switch or with more classes...
+  //Eina_Iterator *eina_list_iterator_reversed_new(const Eina_List *list);
+}
+
+template <typename T>
+List<T>::Iterator::~Iterator ()
+{
+  eina_iterator_free (mIterator);
+}
+
+template <typename T>
+bool List<T>::Iterator::next (T *data)
+{
+  return eina_iterator_next (mIterator, reinterpret_cast <void**> (data));
+}
+
+
+/*************/
+/* List      */
+/*************/
+
+template <typename T>
+List<T>::List () :
+  mList (NULL)
+{
+}
+
+template <typename T>
+List<T>::~List ()
+{
+  /*Eina_List *list = eina_list_free (mList);
+  if (!list)
+  {
+    // good case: do nothing
+  }
+  else
+  {
+    // TODO: error handling
+  }*/
+}
+
+template <typename T>
+void List<T>::append (const T data)
+{
+  Eina_List *list = eina_list_append (mList, static_cast <const void*> (data));
+  if (list)
+  {
+    mList = list;
+  }
+  else
+  {
+    // TODO: error handling
+  }
+}
+
+template <typename T>
+void List<T>::prepend (const T data)
+{
+  Eina_List *list = eina_list_prepend (mList, static_cast <const void*> 
(data));
+  if (list)
+  {
+    mList = list;
+  }
+  else
+  {
+    // TODO: error handling
+  }
+}
+
+template <typename T>
+void List<T>::appendRelative (const T data, const T relative)
+{
+  Eina_List *list = eina_list_append_relative (mList, static_cast <void*> 
(data), static_cast <void*> (relative));
+  if (list)
+  {
+    mList = list;
+  }
+  else
+  {
+    // TODO: error handling
+  }
+}
+
+template <typename T>
+void List<T>::prependRelative (const T data, const T relative)
+{
+  Eina_List *list = eina_list_prepend_relative (mList, static_cast <void*> 
(data), static_cast <void*> (relative));
+  if (list)
+  {
+    mList = list;
+  }
+  else
+  {
+    // TODO: error handling
+  }
+}
+
+template <typename T>
+void List<T>::remove (const T data)
+{
+  Eina_List *list = eina_list_remove (mList, static_cast <void*> (data));
+  if (list)
+  {
+    mList = list;
+  }
+  else
+  {
+    // TODO: error handling
+  }
+}
+
+template <typename T>
+void List<T>::reverse ()
+{
+  Eina_List *list =  eina_list_reverse (mList);
+  if (list)
+  {
+    mList = list;
+  }
+  else
+  {
+    // TODO: error handling
+  }
+}
+
+template <typename T>
+T List<T>::at (unsigned int n)
+{
+  void *data = eina_list_nth (mList, n);
+
+  if (data)
+  {
+    return static_cast <T> (data);
+  }
+  else
+  {
+    // TODO: error handling
+  }
+}
+
+template <typename T>
+unsigned int List<T>::count ()
+{
+  return eina_list_count (mList);
+}
+
+template <typename T>
+T List<T>::getData ()
+{
+  return static_cast <T> (eina_list_data_get (mList));
+}
+
+template <typename T>
+typename List<T>::Iterator List<T>::createIterator ()
+{
+  Iterator i (mList);
+  
+  return i;
+}
+
+} // end namespace Einaxx
+
+#endif // EINAXX_LIST_H
diff --git a/einaxx/include/einaxx/Makefile.am 
b/einaxx/include/einaxx/Makefile.am
index 98bfe46..a2fa5bd 100644
--- a/einaxx/include/einaxx/Makefile.am
+++ b/einaxx/include/einaxx/Makefile.am
@@ -1,5 +1,9 @@
 
-libeinaxx_HEADERS = 
+libeinaxx_HEADERS = \
+       List.h     \
+       Einaxx.h     \
+       AbstractIterator.h     \
+       Application.h
 
 libeinaxxdir = \
        $(pkgincludedir)
diff --git a/einaxx/src/Application.cpp b/einaxx/src/Application.cpp
new file mode 100644
index 0000000..f298d5d
--- /dev/null
+++ b/einaxx/src/Application.cpp
@@ -0,0 +1,30 @@
+#include "../include/einaxx/Application.h"
+
+namespace Einaxx {
+
+int Application::getHamsterCount ()
+{
+  return eina_hamster_count ();
+}
+
+int Application::init ()
+{
+  return eina_init ();
+}
+
+int Application::shutdown ()
+{
+  return eina_shutdown ();
+}
+
+int Application::initThreads ()
+{
+  return eina_threads_init ();
+}
+
+int Application::shutdownThreads ()
+{
+  return eina_threads_shutdown ();
+}
+    
+} // end namespace Einaxx
diff --git a/einaxx/src/Makefile.am b/einaxx/src/Makefile.am
index a1c4d17..d02303d 100644
--- a/einaxx/src/Makefile.am
+++ b/einaxx/src/Makefile.am
@@ -16,7 +16,8 @@ AM_CFLAGS =\
 lib_LTLIBRARIES = \
        libeinaxx.la
 
-libeinaxx_la_SOURCES = 
+libeinaxx_la_SOURCES = \
+       Application.cpp
 
 libeinaxx_la_LIBADD = \
        $(EFL_LIBS) \

-- 


Reply via email to