PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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