Fixed loads of bugs. It now works. Ready to integrate in assessortool.
[perl4caml.git] / wrappers / pl_Net_Google_Search.ml
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 $
4  *)
5
6 open Perl
7
8 open Pl_Net_Google_Response
9
10 class net_google_search sv =
11
12 object (self)
13
14   method key =
15     string_of_sv (call_method sv "key" [])
16   method set_key v =
17     call_method_void sv "key" [sv_of_string v]
18   method query =
19     string_of_sv (call_method sv "query" [])
20   method set_query v =
21     call_method_void sv "query" [sv_of_string v]
22   method starts_at =
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]
26   method max_results =
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))
32   method filter =
33     bool_of_sv (call_method sv "filter" [])
34   method set_filter v =
35     call_method_void sv "filter" [sv_of_bool v]
36   method safe =
37     bool_of_sv (call_method sv "safe" [])
38   method set_safe v =
39     call_method_void sv "safe" [sv_of_bool v]
40   method lr langs =
41     string_of_sv (call_method sv "lr" (List.map sv_of_string langs))
42   method ie encs =
43     string_of_sv (call_method sv "ie" (List.map sv_of_string encs))
44   method oe 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]
50   method response =
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
54   method results =
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
58
59 end
60
61 (* let new_ = ... *)