Added proper LGPL statements to all files.
[perl4caml.git] / wrappers / pl_Net_Google_Search.ml
1 (** Wrapper around Perl [Net::Google::Search] class. *)
2 (*  Copyright (C) 2003 Merjis Ltd.
3
4     This library is free software; you can redistribute it and/or
5     modify it under the terms of the GNU Library General Public
6     License as published by the Free Software Foundation; either
7     version 2 of the License, or (at your option) any later version.
8
9     This library is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12     Library General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this library; see the file COPYING.  If not, write to
16     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17     Boston, MA 02111-1307, USA.
18
19     $Id: pl_Net_Google_Search.ml,v 1.4 2008-03-01 13:02:21 rich Exp $
20   *)
21
22 open Perl
23
24 open Pl_Net_Google_Response
25
26 let _ = eval "use Net::Google::Search"
27
28 class net_google_search sv =
29
30 object (self)
31
32   method key =
33     string_of_sv (call_method sv "key" [])
34   method set_key v =
35     call_method_void sv "key" [sv_of_string v]
36   method query =
37     string_of_sv (call_method sv "query" [])
38   method set_query v =
39     call_method_void sv "query" [sv_of_string v]
40   method starts_at =
41     int_of_sv (call_method sv "starts_at" [])
42   method set_starts_at v =
43     call_method_void sv "starts_at" [sv_of_int v]
44   method max_results =
45     int_of_sv (call_method sv "max_results" [])
46   method set_max_results v =
47     call_method_void sv "max_results" [sv_of_int v]
48   method restrict types =
49     string_of_sv (call_method sv "restrict" (List.map sv_of_string types))
50   method filter =
51     bool_of_sv (call_method sv "filter" [])
52   method set_filter v =
53     call_method_void sv "filter" [sv_of_bool v]
54   method safe =
55     bool_of_sv (call_method sv "safe" [])
56   method set_safe v =
57     call_method_void sv "safe" [sv_of_bool v]
58   method lr langs =
59     string_of_sv (call_method sv "lr" (List.map sv_of_string langs))
60   method ie encs =
61     string_of_sv (call_method sv "ie" (List.map sv_of_string encs))
62   method oe encs =
63     string_of_sv (call_method sv "oe" (List.map sv_of_string encs))
64   method return_estimatedTotal =
65     bool_of_sv (call_method sv "return_estimatedTotal" [])
66   method set_return_estimatedTotal v =
67     call_method_void sv "return_estimatedTotal" [sv_of_bool v]
68   method response =
69     let sv = call_method sv "response" [] in
70     let av = deref_array sv in
71     av_map (fun sv -> new net_google_response sv) av
72   method results =
73     let sv = call_method sv "results" [] in
74     let av = deref_array sv in
75     av_map (fun sv -> new net_google_response sv) av
76
77 end
78
79 (* let new_ = ... *)