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