Add copyright notices and new function String.chomp
[ocaml.git] / ocamldoc / odoc_search.mli
blobaffd315fb447ccd790934eb089d97b3a3eb56dfc
1 (***********************************************************************)
2 (* OCamldoc *)
3 (* *)
4 (* Maxence Guesdon, projet Cristal, INRIA Rocquencourt *)
5 (* *)
6 (* Copyright 2001 Institut National de Recherche en Informatique et *)
7 (* en Automatique. All rights reserved. This file is distributed *)
8 (* under the terms of the Q Public License version 1.0. *)
9 (* *)
10 (***********************************************************************)
12 (* $Id$ *)
14 (** Research of elements through modules. *)
16 (** The type for an element of the result of a research. *)
17 type result_element =
18 Res_module of Odoc_module.t_module
19 | Res_module_type of Odoc_module.t_module_type
20 | Res_class of Odoc_class.t_class
21 | Res_class_type of Odoc_class.t_class_type
22 | Res_value of Odoc_value.t_value
23 | Res_type of Odoc_type.t_type
24 | Res_exception of Odoc_exception.t_exception
25 | Res_attribute of Odoc_value.t_attribute
26 | Res_method of Odoc_value.t_method
27 | Res_section of string * Odoc_types.text
29 (** The type representing a research result.*)
30 type result = result_element list
32 (** The type of modules which contain the predicates used during the research.
33 Some functions return a couple of booleans ; the first indicates if we
34 must go deeper in the analysed element, the second if the element satisfies
35 the predicate.
37 module type Predicates =
38 sig
39 type t
40 val p_module : Odoc_module.t_module -> t -> bool * bool
41 val p_module_type : Odoc_module.t_module_type -> t -> bool * bool
42 val p_class : Odoc_class.t_class -> t -> bool * bool
43 val p_class_type : Odoc_class.t_class_type -> t -> bool * bool
44 val p_value : Odoc_value.t_value -> t -> bool
45 val p_type : Odoc_type.t_type -> t -> bool
46 val p_exception : Odoc_exception.t_exception -> t -> bool
47 val p_attribute : Odoc_value.t_attribute -> t -> bool
48 val p_method : Odoc_value.t_method -> t -> bool
49 val p_section : string -> t -> bool
50 end
52 (** Search for elements verifying the predicates in the module in parameter.*)
53 module Search :
54 functor (P : Predicates) ->
55 sig
56 (** search in a section title *)
57 val search_section : Odoc_types.text -> string -> P.t -> result_element list
59 (** search in a value *)
60 val search_value : Odoc_value.t_value -> P.t -> result_element list
62 (** search in a type *)
63 val search_type : Odoc_type.t_type -> P.t -> result_element list
65 (** search in an exception *)
66 val search_exception :
67 Odoc_exception.t_exception -> P.t -> result_element list
69 (** search in an attribute *)
70 val search_attribute :
71 Odoc_value.t_attribute -> P.t -> result_element list
73 (** search in a method *)
74 val search_method : Odoc_value.t_method -> P.t -> result_element list
76 (** search in a class *)
77 val search_class : Odoc_class.t_class -> P.t -> result_element list
79 (** search in a class type *)
80 val search_class_type :
81 Odoc_class.t_class_type -> P.t -> result_element list
83 (** search in a module type *)
84 val search_module_type :
85 Odoc_module.t_module_type -> P.t -> result_element list
87 (** search in a module *)
88 val search_module : Odoc_module.t_module -> P.t -> result_element list
90 (** search in a list of modules *)
91 val search : Odoc_module.t_module list -> P.t -> result_element list
92 end
94 (** A module of predicates to search elements by name (and accepting regexps).*)
95 module P_name :
96 sig
97 type t = Str.regexp
98 val ( =~ ) : string -> Str.regexp -> bool
99 val p_module : Odoc_module.t_module -> Str.regexp -> bool * bool
100 val p_module_type :
101 Odoc_module.t_module_type -> Str.regexp -> bool * bool
102 val p_class : Odoc_class.t_class -> Str.regexp -> bool * bool
103 val p_class_type : Odoc_class.t_class_type -> Str.regexp -> bool * bool
104 val p_value : Odoc_value.t_value -> Str.regexp -> bool
105 val p_type : Odoc_type.t_type -> Str.regexp -> bool
106 val p_exception : Odoc_exception.t_exception -> Str.regexp -> bool
107 val p_attribute : Odoc_value.t_attribute -> Str.regexp -> bool
108 val p_method : Odoc_value.t_method -> Str.regexp -> bool
111 (** A module to search elements by name. *)
112 module Search_by_name :
114 val search_section : Odoc_types.text -> string -> P_name.t -> result_element list
115 val search_value : Odoc_value.t_value -> P_name.t -> result_element list
116 val search_type : Odoc_type.t_type -> P_name.t -> result_element list
117 val search_exception :
118 Odoc_exception.t_exception -> P_name.t -> result_element list
119 val search_attribute :
120 Odoc_value.t_attribute -> P_name.t -> result_element list
121 val search_method :
122 Odoc_value.t_method -> P_name.t -> result_element list
123 val search_class : Odoc_class.t_class -> P_name.t -> result_element list
124 val search_class_type :
125 Odoc_class.t_class_type -> P_name.t -> result_element list
126 val search_module_type :
127 Odoc_module.t_module_type -> P_name.t -> result_element list
128 val search_module :
129 Odoc_module.t_module -> P_name.t -> result_element list
130 val search : Odoc_module.t_module list -> P_name.t -> result_element list
133 (** A function to search all the values in a list of modules. *)
134 val values : Odoc_module.t_module list -> Odoc_value.t_value list
136 (** A function to search all the exceptions in a list of modules. *)
137 val exceptions : Odoc_module.t_module list -> Odoc_exception.t_exception list
139 (** A function to search all the types in a list of modules. *)
140 val types : Odoc_module.t_module list -> Odoc_type.t_type list
142 (** A function to search all the class attributes in a list of modules. *)
143 val attributes : Odoc_module.t_module list -> Odoc_value.t_attribute list
145 (** A function to search all the class methods in a list of modules. *)
146 val methods : Odoc_module.t_module list -> Odoc_value.t_method list
148 (** A function to search all the classes in a list of modules. *)
149 val classes : Odoc_module.t_module list -> Odoc_class.t_class list
151 (** A function to search all the class types in a list of modules. *)
152 val class_types : Odoc_module.t_module list -> Odoc_class.t_class_type list
154 (** A function to search all the modules in a list of modules. *)
155 val modules : Odoc_module.t_module list -> Odoc_module.t_module list
157 (** A function to search all the module types in a list of modules. *)
158 val module_types : Odoc_module.t_module list -> Odoc_module.t_module_type list
160 (** Return [true] if a type with the given complete name (regexp) exists
161 in the given module list.*)
162 val type_exists : Odoc_module.t_module list -> Str.regexp -> bool
164 (** Return [true] if a value with the given complete name (regexp) exists
165 in the given module list.*)
166 val value_exists : Odoc_module.t_module list -> Str.regexp -> bool
168 (** Return [true] if a module with the given complete name (regexp) exists
169 in the given module list.*)
170 val module_exists : Odoc_module.t_module list -> Str.regexp -> bool
172 (** Return [true] if a module type with the given complete name (regexp) exists
173 in the given module list.*)
174 val module_type_exists : Odoc_module.t_module list -> Str.regexp -> bool
176 (** Return [true] if a class with the given complete name (regexp) exists
177 in the given module list.*)
178 val class_exists : Odoc_module.t_module list -> Str.regexp -> bool
180 (** Return [true] if a class type with the given complete name (regexp) exists
181 in the given module list.*)
182 val class_type_exists : Odoc_module.t_module list -> Str.regexp -> bool
184 (** Return [true] if a exception with the given complete name (regexp) exists
185 in the given module list.*)
186 val exception_exists : Odoc_module.t_module list -> Str.regexp -> bool
188 (** Return [true] if an attribute with the given complete name (regexp) exists
189 in the given module list.*)
190 val attribute_exists : Odoc_module.t_module list -> Str.regexp -> bool
192 (** Return [true] if a method with the given complete name (regexp) exists
193 in the given module list.*)
194 val method_exists : Odoc_module.t_module list -> Str.regexp -> bool
196 (** Return the [text] of the section with the given complete name (regexp)
197 in the given module list.
198 @raise Not_found if the section was not found.*)
199 val find_section : Odoc_module.t_module list -> Str.regexp -> Odoc_types.text