51ff941ad31b01cb37709831e70ceb1056ed0876
[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.2 2003-10-15 16:51:12 rich Exp $
4  *)
5
6 open Perl
7
8 open Pl_Net_Google_Response
9
10 let _ = eval "use Net::Google::Search"
11
12 class net_google_search sv =
13
14 object (self)
15
16   method key =
17     string_of_sv (call_method sv "key" [])
18   method set_key v =
19     call_method_void sv "key" [sv_of_string v]
20   method query =
21     string_of_sv (call_method sv "query" [])
22   method set_query v =
23     call_method_void sv "query" [sv_of_string v]
24   method starts_at =
25     int_of_sv (call_method sv "starts_at" [])
26   method set_starts_at v =
27     call_method_void sv "starts_at" [sv_of_int v]
28   method max_results =
29     int_of_sv (call_method sv "max_results" [])
30   method set_max_results v =
31     call_method_void sv "max_results" [sv_of_int v]
32   method restrict types =
33     string_of_sv (call_method sv "restrict" (List.map sv_of_string types))
34   method filter =
35     bool_of_sv (call_method sv "filter" [])
36   method set_filter v =
37     call_method_void sv "filter" [sv_of_bool v]
38   method safe =
39     bool_of_sv (call_method sv "safe" [])
40   method set_safe v =
41     call_method_void sv "safe" [sv_of_bool v]
42   method lr langs =
43     string_of_sv (call_method sv "lr" (List.map sv_of_string langs))
44   method ie encs =
45     string_of_sv (call_method sv "ie" (List.map sv_of_string encs))
46   method oe encs =
47     string_of_sv (call_method sv "oe" (List.map sv_of_string encs))
48   method return_estimatedTotal =
49     bool_of_sv (call_method sv "return_estimatedTotal" [])
50   method set_return_estimatedTotal v =
51     call_method_void sv "return_estimatedTotal" [sv_of_bool v]
52   method response =
53     let sv = call_method sv "response" [] in
54     let av = deref_array sv in
55     av_map (fun sv -> new net_google_response sv) av
56   method results =
57     let sv = call_method sv "results" [] in
58     let av = deref_array sv in
59     av_map (fun sv -> new net_google_response sv) av
60
61 end
62
63 (* let new_ = ... *)