PageRenderTime 21ms CodeModel.GetById 16ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 1indexing
 2	description: "Iterator for G_SLIST_STRING."
 3	copyright: "[
 4					Copyright (C) 2006 Paolo Redaelli
 5					
 6					This library is free software; you can redistribute it and/or
 7					modify it under the terms of the GNU Lesser General Public License
 8					as published by the Free Software Foundation; either version 2.1 of
 9					the License, or (at your option) any later version.
10					
11					This library is distributed in the hope that it will be useful, but
12					WITHOUT ANY WARRANTY; without even the implied warranty of
13					MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14					Lesser General Public License for more details.
15
16					You should have received a copy of the GNU Lesser General Public
17					License along with this library; if not, write to the Free Software
18					Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19					02110-1301 USA
20			]"
21
22class ITERATOR_ON_G_SLIST_STRING 
23inherit
24	ITERATOR [STRING]
25	WRAPPER_HANDLER
26insert
27	GSLIST_EXTERNALS
28	GSLIST_STRUCT
29
30creation make
31	
32feature {} -- Creation
33	make (a_list: G_SLIST_STRING) is
34		require valid_list: a_list/=Void
35		do
36			list := a_list.handle
37		end
38	
39feature {} -- Implementation
40	list: POINTER
41	current_element: POINTER
42feature -- Iterator's features
43	start is
44		do
45			current_element := list
46		end
47	
48	is_off: BOOLEAN is
49		do
50			Result:=(current_element.is_null)
51		end
52	
53	item: STRING is
54		local cstr: POINTER
55		do
56			cstr := gslist_struct_get_data(current_element)
57			check 
58				string_not_null: cstr.is_not_null 
59			end
60			create Result.from_external_copy(cstr)
61		ensure result_not_void: Result /= Void
62		end
63	
64	next is
65		do
66			current_element := gslist_struct_get_next (current_element)
67		end
68end