Natools

Check-in [74bf50894a]
Login
Overview
Comment:string_slices: use an immutable reference to protect from overwriting
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 74bf50894ae099c518b83410975aa9f5353b081a
User & Date: nat on 2017-06-12 19:15:32
Other Links: manifest | tags
Context
2017-06-13
19:15
string_slices-slice_sets: drop uneeded mutability of string references check-in: 7521b2a2e6 user: nat tags: trunk
2017-06-12
19:15
string_slices: use an immutable reference to protect from overwriting check-in: 74bf50894a user: nat tags: trunk
2017-05-26
20:02
smaz_generic-tools: use Dict_Entry_Length when possible check-in: b6557bf0ac user: nat tags: trunk
Changes

Modified src/natools-string_slices.adb from [c5e18cd3df] to [55fc41b4d8].

1
2

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

20
21
22
23
24
25
26
1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

19
20
21
22
23
24
25
26

-
+
















-
+







------------------------------------------------------------------------------
-- Copyright (c) 2013, Natacha Porté                                        --
-- Copyright (c) 2013-2016, Natacha Porté                                   --
--                                                                          --
-- Permission to use, copy, modify, and distribute this software for any    --
-- purpose with or without fee is hereby granted, provided that the above   --
-- copyright notice and this permission notice appear in all copies.        --
--                                                                          --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF         --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR  --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES   --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN    --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF  --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.           --
------------------------------------------------------------------------------

package body Natools.String_Slices is

   use type String_Refs.Reference;
   use type String_Refs.Immutable_Reference;


   -----------------------------
   -- String_Range primitives --
   -----------------------------

   function Is_In (Point : Natural; Reference : String_Range) return Boolean is

Modified src/natools-string_slices.ads from [c2919f372f] to [865a368eb3].

1
2

3
4
5
6
7
8
9
1

2
3
4
5
6
7
8
9

-
+







------------------------------------------------------------------------------
-- Copyright (c) 2013, Natacha Porté                                        --
-- Copyright (c) 2013-2016, Natacha Porté                                   --
--                                                                          --
-- Permission to use, copy, modify, and distribute this software for any    --
-- purpose with or without fee is hereby granted, provided that the above   --
-- copyright notice and this permission notice appear in all copies.        --
--                                                                          --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF         --
182
183
184
185
186
187
188
189

190
191
192
193
194
182
183
184
185
186
187
188

189
190
191
192
193
194







-
+





   package String_Refs is new References
     (String,
      Storage_Pools.Access_In_Default_Pool'Storage_Pool,
      Storage_Pools.Access_In_Default_Pool'Storage_Pool);

   type Slice is tagged record
      Bounds : String_Range := (1, 0);
      Ref : String_Refs.Reference;
      Ref : String_Refs.Immutable_Reference;
   end record;

   Null_Slice : constant Slice := ((1, 0), Ref => <>);

end Natools.String_Slices;