/src/wrappers/glib/partially-implemented/iterator_on_g_list_string.e

http://github.com/tybor/Liberty · Specman e · 68 lines · 57 code · 11 blank · 0 comment · 4 complexity · 568d72546b135b8541bbf271a94389e7 MD5 · raw file

  1. indexing
  2. description: "Iterator for G_SLIST_STRING."
  3. copyright: "[
  4. Copyright (C) 2006 Paolo Redaelli
  5. This library 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. This library is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. 02110-1301 USA
  17. ]"
  18. class ITERATOR_ON_G_LIST_STRING
  19. inherit
  20. ITERATOR [STRING]
  21. WRAPPER_HANDLER
  22. insert
  23. GLIST_EXTERNALS
  24. GLIST_STRUCT
  25. creation make
  26. feature {} -- Creation
  27. make (a_list: G_LIST_STRING) is
  28. require valid_list: a_list/=Void
  29. do
  30. list := a_list
  31. end
  32. feature {} -- Implementation
  33. list: G_LIST_STRING
  34. current_element: POINTER
  35. feature -- Iterator's features
  36. start is
  37. do
  38. current_element := list.handle
  39. end
  40. is_off: BOOLEAN is
  41. do
  42. Result:=(current_element.is_null)
  43. end
  44. item: STRING is
  45. local cstr: POINTER
  46. do
  47. cstr := glist_struct_get_data(current_element)
  48. if cstr.is_not_null then
  49. create Result.from_external_copy(cstr)
  50. end
  51. ensure result_not_void: Result /= Void
  52. end
  53. next is
  54. do
  55. current_element := glist_struct_get_next (current_element)
  56. end
  57. end