Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | string_slices: new callback-based constructor |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
cd40fb63c6ba2afb0defe48228dd0469 |
| User & Date: | nat 2017-06-14 20:58:49.862 |
Context
|
2017-06-15
| ||
| 19:23 | string_slice_tests: test the new callback-based constructor check-in: 4b6433de7a user: nat tags: trunk | |
|
2017-06-14
| ||
| 20:58 | string_slices: new callback-based constructor check-in: cd40fb63c6 user: nat tags: trunk | |
|
2017-06-13
| ||
| 19:15 | string_slices-slice_sets: drop uneeded mutability of string references check-in: 7521b2a2e6 user: nat tags: trunk | |
Changes
Changes to src/natools-string_slices.adb.
1 | 1 2 3 4 5 6 7 8 9 | - + | ------------------------------------------------------------------------------ |
| ︙ | |||
112 113 114 115 116 117 118 119 120 121 122 123 124 125 | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | + + + + + + + + + + + + + + + |
end Image;
--------------------------
-- Conversion functions --
--------------------------
function New_Slice
(First : Positive;
Last : Natural;
Initialize : not null access procedure (S : out String))
return Slice
is
Data : constant String_Refs.Data_Access := new String (First .. Last);
Ref : constant String_Refs.Immutable_Reference
:= String_Refs.Create (Data);
begin
Initialize (Data.all);
return Slice'(Bounds => (First, Last + 1 - First), Ref => Ref);
end New_Slice;
function To_Slice (S : String) return Slice is
function Create return String;
function Create return String is
begin
return S;
|
| ︙ |
Changes to src/natools-string_slices.ads.
1 | 1 2 3 4 5 6 7 8 9 | - + | ------------------------------------------------------------------------------ |
| ︙ | |||
72 73 74 75 76 77 78 79 80 81 82 83 84 85 | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | + + + + + + + |
Null_Slice : constant Slice;
--------------------------
-- Conversion functions --
--------------------------
function New_Slice
(First : Positive;
Last : Natural;
Initialize : not null access procedure (S : out String))
return Slice;
-- Create a callback-initialized slice
function To_Slice (S : String) return Slice;
-- Create a new slice containing the whole given string
function To_String (S : Slice) return String;
-- Return the string represented by the slice
|
| ︙ |