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

http://github.com/tybor/Liberty · Specman e · 68 lines · 58 code · 10 blank · 0 comment · 3 complexity · 8dd4f2a69d8b5fbf252d11323b534dcf 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_SLIST_STRING
  19. inherit
  20. ITERATOR [STRING]
  21. WRAPPER_HANDLER
  22. insert
  23. GSLIST_EXTERNALS
  24. GSLIST_STRUCT
  25. creation make
  26. feature {} -- Creation
  27. make (a_list: G_SLIST_STRING) is
  28. require valid_list: a_list/=Void
  29. do
  30. list := a_list.handle
  31. end
  32. feature {} -- Implementation
  33. list: POINTER
  34. current_element: POINTER
  35. feature -- Iterator's features
  36. start is
  37. do
  38. current_element := list
  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 := gslist_struct_get_data(current_element)
  48. check
  49. string_not_null: cstr.is_not_null
  50. end
  51. create Result.from_external_copy(cstr)
  52. ensure result_not_void: Result /= Void
  53. end
  54. next is
  55. do
  56. current_element := gslist_struct_get_next (current_element)
  57. end
  58. end