1
2
3
4
5
6
7
8
9
|
1
2
3
4
5
6
7
8
9
|
-
+
|
------------------------------------------------------------------------------
-- Copyright (c) 2013-2016, Natacha Porté --
-- Copyright (c) 2013-2017, 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 --
|
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;
|