Autocompletion

This commit is contained in:
Severin Münger
2013-09-12 14:58:35 +02:00
parent 8fc405fef1
commit 27023283e7
8 changed files with 129 additions and 45 deletions
@@ -0,0 +1,16 @@
note
description: "Summary description for {WSF_AUTOCOMPLETION}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
WSF_AUTOCOMPLETION
feature
autocompletion (input: STRING): JSON_ARRAY
deferred
end
end
@@ -0,0 +1,46 @@
note
description: "Summary description for {WSF_SIMPLE_AUTOCOMPLETION}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
WSF_SIMPLE_AUTOCOMPLETION
inherit
WSF_AUTOCOMPLETION
create
make
feature {NONE}
make (l: LIST [STRING])
do
list := l
end
feature -- Implementation
autocompletion (input: STRING): JSON_ARRAY
local
o: JSON_OBJECT
do
create Result.make_array
across
list as c
loop
if c.item.as_lower.has_substring (input.as_lower) then
create o.make
o.put (create {JSON_STRING}.make_json (c.item), "value")
Result.add (o)
end
end
end
feature
list: LIST [STRING]
end