/src/wrappers/common/library/string_array_iterator.e

http://github.com/tybor/Liberty · Specman e · 48 lines · 34 code · 14 blank · 0 comment · 2 complexity · f835b5c96fa5269e57147a87aad5bab3 MD5 · raw file

  1. indexing
  2. description: "Iterator over STRING_ARRAY, wrapper of 'gchar **'"
  3. copyright: "[
  4. Copyright (C) 2007 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 STRING_ARRAY_ITERATOR
  19. inherit ITERATOR[STRING]
  20. creation make
  21. feature {} -- Implementation and creation
  22. make (an_array: STRING_ARRAY) is
  23. require array_not_void: an_array/=Void
  24. do
  25. array:=an_array
  26. end
  27. index: INTEGER
  28. array: STRING_ARRAY
  29. feature {ANY}
  30. start is do index:=array.lower end
  31. is_off: BOOLEAN is do Result:=not array.valid_index(index) end
  32. item: STRING is do Result:=array.item(index) end
  33. next is do index:=index+1 end
  34. end -- class STRING_ARRAY_ITERATOR