File:  [ELWIX - Embedded LightWeight unIX -] / gpl / axl / src / axl_list.h
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Fri Feb 17 12:50:03 2012 UTC (12 years, 4 months ago) by misho
Branches: axl, MAIN
CVS tags: HEAD, AXL0_6_7
version 0.6.7

    1: /*
    2:  *  LibAxl:  Another XML library
    3:  *  Copyright (C) 2006 Advanced Software Production Line, S.L.
    4:  *
    5:  *  This program is free software; you can redistribute it and/or
    6:  *  modify it under the terms of the GNU Lesser General Public License
    7:  *  as published by the Free Software Foundation; either version 2.1 of
    8:  *  the License, or (at your option) any later version.
    9:  *
   10:  *  This program is distributed in the hope that it will be useful,
   11:  *  but WITHOUT ANY WARRANTY; without even the implied warranty of 
   12:  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
   13:  *  GNU Lesser General Public License for more details.
   14:  *
   15:  *  You should have received a copy of the GNU Lesser General Public
   16:  *  License along with this program; if not, write to the Free
   17:  *  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   18:  *  02111-1307 USA
   19:  *  
   20:  *  You may find a copy of the license under this software is released
   21:  *  at COPYING file. This is LGPL software: you are welcome to
   22:  *  develop proprietary applications using this library without any
   23:  *  royalty or fee but returning back any change, improvement or
   24:  *  addition in the form of source code, project image, documentation
   25:  *  patches, etc. 
   26:  *
   27:  *  For commercial support on build XML enabled solutions contact us:
   28:  *          
   29:  *      Postal address:
   30:  *         Advanced Software Production Line, S.L.
   31:  *         Edificio Alius A, Oficina 102,
   32:  *         C/ Antonio Suarez Nº 10,
   33:  *         Alcalá de Henares 28802 Madrid
   34:  *         Spain
   35:  *
   36:  *      Email address:
   37:  *         info@aspl.es - http://www.aspl.es/xml
   38:  */
   39: #ifndef __AXL_LIST_H__
   40: #define __AXL_LIST_H__
   41: 
   42: #include <axl_decl.h>
   43: 
   44: BEGIN_C_DECLS
   45: 
   46: axlList  * axl_list_new    (axlEqualFunc are_equal, axlDestroyFunc destroy_data);
   47: 
   48: void       axl_list_set_destroy_func (axlList * list, axlDestroyFunc destroy_func);
   49: 
   50: int        axl_list_equal_string (axlPointer a, axlPointer b);
   51: 
   52: int        axl_list_order_string (axlPointer a, axlPointer b);
   53: 
   54: int        axl_list_equal_int    (axlPointer a, axlPointer b);
   55: 
   56: int        axl_list_always_return_1 (axlPointer a, axlPointer b);
   57: 
   58: axlList  * axl_list_copy   (axlList * list, axlDuplicateFunc func);
   59: 
   60: void       axl_list_add    (axlList * list, axlPointer pointer);
   61: 
   62: void       axl_list_add_at (axlList * list, axlPointer pointer, int position);
   63: 
   64: void       axl_list_prepend (axlList * list, axlPointer pointer);
   65: 
   66: void       axl_list_append  (axlList * list, axlPointer pointer);
   67: 
   68: void       axl_list_remove     (axlList * list, axlPointer pointer);
   69: 
   70: void       axl_list_remove_ptr (axlList * list, axlPointer pointer);
   71: 
   72: void       axl_list_remove_at  (axlList * list, int position);
   73: 
   74: void       axl_list_unlink (axlList * list, axlPointer pointer);
   75: 
   76: void       axl_list_unlink_ptr (axlList * list, axlPointer pointer);
   77: 
   78: void       axl_list_unlink_at  (axlList * list, int position);
   79: 
   80: void       axl_list_remove_first (axlList * list);
   81: 
   82: void       axl_list_unlink_first (axlList * list);
   83: 
   84: void       axl_list_remove_last (axlList * list);
   85: 
   86: void       axl_list_unlink_last (axlList * list);
   87: 
   88: axl_bool   axl_list_exists (axlList * list, axlPointer pointer);
   89: 
   90: axl_bool   axl_list_exists_at (axlList * list, axlPointer pointer, int position);
   91: 
   92: axl_bool   axl_list_is_empty  (axlList * list);
   93: 
   94: axlPointer axl_list_get_first (axlList * list);
   95: 
   96: axlPointer axl_list_get_last  (axlList * list);
   97: 
   98: axlPointer axl_list_get_nth   (axlList * list, int position);
   99: 
  100: axlPointer axl_list_lookup    (axlList * list, axlLookupFunc func, axlPointer data);
  101: 
  102: /** 
  103:  * @brief Convenient alias to axl_list_lookup to implement axlList foreach operation.
  104:  *
  105:  * Because \ref axl_list_lookup can be used to implement a foreach
  106:  * function (making \ref axlLookupFunc to always return axl_false)
  107:  * this alias exists to write code that is pretending doing a lookup
  108:  * (so developer can read it easily). That is, the alias just exists
  109:  * to allow writing \ref axl_list_foreach instead of \ref
  110:  * axl_list_lookup when a foreach is implemented (not a lookup).
  111:  *
  112:  * @param list The list where the foreach operation will take place.
  113:  *
  114:  * @param func The handler that will be called for each item found in the list.
  115:  *
  116:  * @param data Optional user pointer that will be passed to the
  117:  * foreach function along with the item list data.
  118:  */
  119: #define axl_list_foreach(list, func, data) axl_list_lookup(list,func,data)
  120: 
  121: axl_bool   axl_list_find_string (axlPointer element, axlPointer data);
  122: 
  123: int        axl_list_length (axlList * list);
  124: 
  125: void       axl_list_free (axlList * list);
  126: 
  127: /* cursor interface */
  128: axlListCursor * axl_list_cursor_new          (axlList * list);
  129: 
  130: void            axl_list_cursor_first        (axlListCursor * cursor);
  131: 
  132: void            axl_list_cursor_last         (axlListCursor * cursor);
  133: 
  134: void            axl_list_cursor_next         (axlListCursor * cursor);
  135: 
  136: void            axl_list_cursor_previous     (axlListCursor * cursor);
  137: 
  138: axl_bool        axl_list_cursor_has_next     (axlListCursor * cursor);
  139: 
  140: axl_bool        axl_list_cursor_has_previous (axlListCursor * cursor);
  141: 
  142: axl_bool        axl_list_cursor_has_item     (axlListCursor * cursor);
  143: 
  144: void            axl_list_cursor_unlink       (axlListCursor * cursor);
  145: 
  146: void            axl_list_cursor_remove       (axlListCursor * cursor);
  147: 
  148: axlPointer      axl_list_cursor_get          (axlListCursor * cursor);
  149: 
  150: axlList       * axl_list_cursor_list         (axlListCursor * cursor);
  151: 
  152: void            axl_list_cursor_free         (axlListCursor * cursor);
  153: 
  154: END_C_DECLS
  155: 
  156: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>