File : a-strsea.ads
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- A D A . S T R I N G S . S E A R C H --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- --
19 -- --
20 -- --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
31
32 -- This package contains the search functions from Ada.Strings.Fixed. They
33 -- are separated out because they are shared by Ada.Strings.Bounded and
34 -- Ada.Strings.Unbounded, and we don't want to drag other irrelevant stuff
35 -- from Ada.Strings.Fixed when using the other two packages. We make this
36 -- a private package, since user programs should access these subprograms
37 -- via one of the standard string packages.
38
39 with Ada.Strings.Maps;
40
41 private package Ada.Strings.Search is
42 pragma Preelaborate;
43
44 function Index
45 (Source : String;
46 Pattern : String;
47 Going : Direction := Forward;
48 Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
49
50 function Index
51 (Source : String;
52 Pattern : String;
53 Going : Direction := Forward;
54 Mapping : Maps.Character_Mapping_Function) return Natural;
55
56 function Index
57 (Source : String;
58 Set : Maps.Character_Set;
59 Test : Membership := Inside;
60 Going : Direction := Forward) return Natural;
61
62 function Index
63 (Source : String;
64 Pattern : String;
65 From : Positive;
66 Going : Direction := Forward;
67 Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
68
69 function Index
70 (Source : String;
71 Pattern : String;
72 From : Positive;
73 Going : Direction := Forward;
74 Mapping : Maps.Character_Mapping_Function) return Natural;
75
76 function Index
77 (Source : String;
78 Set : Maps.Character_Set;
79 From : Positive;
80 Test : Membership := Inside;
81 Going : Direction := Forward) return Natural;
82
83 function Index_Non_Blank
84 (Source : String;
85 Going : Direction := Forward) return Natural;
86
87 function Index_Non_Blank
88 (Source : String;
89 From : Positive;
90 Going : Direction := Forward) return Natural;
91
92 function Count
93 (Source : String;
94 Pattern : String;
95 Mapping : Maps.Character_Mapping := Maps.Identity) return Natural;
96
97 function Count
98 (Source : String;
99 Pattern : String;
100 Mapping : Maps.Character_Mapping_Function) return Natural;
101
102 function Count
103 (Source : String;
104 Set : Maps.Character_Set) return Natural;
105
106 procedure Find_Token
107 (Source : String;
108 Set : Maps.Character_Set;
109 From : Positive;
110 Test : Membership;
111 First : out Positive;
112 Last : out Natural);
113
114 procedure Find_Token
115 (Source : String;
116 Set : Maps.Character_Set;
117 Test : Membership;
118 First : out Positive;
119 Last : out Natural);
120
121 end Ada.Strings.Search;