1 (* Wrapper around Perl Net::Google::Search class.
2 * Copyright (C) 2003 Merjis Ltd.
3 * $Id: pl_Net_Google_Search.ml,v 1.1 2003-10-14 16:05:22 rich Exp $
8 open Pl_Net_Google_Response
10 class net_google_search sv =
15 string_of_sv (call_method sv "key" [])
17 call_method_void sv "key" [sv_of_string v]
19 string_of_sv (call_method sv "query" [])
21 call_method_void sv "query" [sv_of_string v]
23 int_of_sv (call_method sv "starts_at" [])
24 method set_starts_at v =
25 call_method_void sv "starts_at" [sv_of_int v]
27 int_of_sv (call_method sv "max_results" [])
28 method set_max_results v =
29 call_method_void sv "max_results" [sv_of_int v]
30 method restrict types =
31 string_of_sv (call_method sv "restrict" (List.map sv_of_string types))
33 bool_of_sv (call_method sv "filter" [])
35 call_method_void sv "filter" [sv_of_bool v]
37 bool_of_sv (call_method sv "safe" [])
39 call_method_void sv "safe" [sv_of_bool v]
41 string_of_sv (call_method sv "lr" (List.map sv_of_string langs))
43 string_of_sv (call_method sv "ie" (List.map sv_of_string encs))
45 string_of_sv (call_method sv "oe" (List.map sv_of_string encs))
46 method return_estimatedTotal =
47 bool_of_sv (call_method sv "return_estimatedTotal" [])
48 method set_return_estimatedTotal v =
49 call_method_void sv "return_estimatedTotal" [sv_of_bool v]
51 let sv = call_method sv "response" [] in
52 let av = deref_array sv in
53 av_map (fun sv -> new net_google_response sv) av
55 let sv = call_method sv "results" [] in
56 let av = deref_array sv in
57 av_map (fun sv -> new net_google_response sv) av