/src/wrappers/glib/examples/gslist_example.e

http://github.com/tybor/Liberty · Specman e · 35 lines · 30 code · 5 blank · 0 comment · 0 complexity · 44d18e51f85ee6a5235b1acaf6111e6a MD5 · raw file

  1. indexing
  2. copyright: "(C) 2005 Paolo Redaelli "
  3. license: "LGPL v2 or later"
  4. date: "$Date:$"
  5. revision: "$REvision:$"
  6. class GSLIST_EXAMPLE
  7. creation make
  8. feature
  9. list: G_SLIST[G_STRING]
  10. first: G_STRING
  11. feature make is
  12. local i: ITERATOR [G_STRING]
  13. do
  14. create list.make_empty
  15. list.prepend (create {G_STRING}.from_string("Third and last Foo"))
  16. list.prepend (create {G_STRING}.from_string("Second Foo"))
  17. list.prepend (create {G_STRING}.from_string("First Foo"))
  18. list.append (create {G_STRING}.from_string("Fourth and new last Foo"))
  19. check
  20. list_not_empty: not list.is_empty
  21. end
  22. print ("First is: ") print (list.first.to_string) print ("%N")
  23. from i:=list.get_new_iterator; i.start until i.is_off
  24. loop
  25. print (i.item.to_string) print (", ")
  26. i.next
  27. end
  28. print ("%N")
  29. end
  30. end