1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- A D A . S T R I N G S . W I D E _ W I D E _ U N B O U N D E D --
9 -- Copyright (C) 1992-2020, Free Software Foundation, Inc. --
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. --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
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/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 with Ada.Strings.Wide_Wide_Fixed;
33 with Ada.Strings.Wide_Wide_Search;
34 with Ada.Unchecked_Deallocation;
36 package body Ada.Strings.Wide_Wide_Unbounded is
43 (Left : Unbounded_Wide_Wide_String;
44 Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String
46 L_Length : constant Natural := Left.Last;
47 R_Length : constant Natural := Right.Last;
48 Result : Unbounded_Wide_Wide_String;
51 Result.Last := L_Length + R_Length;
53 Result.Reference := new Wide_Wide_String (1 .. Result.Last);
55 Result.Reference (1 .. L_Length) :=
56 Left.Reference (1 .. Left.Last);
57 Result.Reference (L_Length + 1 .. Result.Last) :=
58 Right.Reference (1 .. Right.Last);
64 (Left : Unbounded_Wide_Wide_String;
65 Right : Wide_Wide_String) return Unbounded_Wide_Wide_String
67 L_Length : constant Natural := Left.Last;
68 Result : Unbounded_Wide_Wide_String;
71 Result.Last := L_Length + Right'Length;
73 Result.Reference := new Wide_Wide_String (1 .. Result.Last);
75 Result.Reference (1 .. L_Length) := Left.Reference (1 .. Left.Last);
76 Result.Reference (L_Length + 1 .. Result.Last) := Right;
82 (Left : Wide_Wide_String;
83 Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String
85 R_Length : constant Natural := Right.Last;
86 Result : Unbounded_Wide_Wide_String;
89 Result.Last := Left'Length + R_Length;
91 Result.Reference := new Wide_Wide_String (1 .. Result.Last);
93 Result.Reference (1 .. Left'Length) := Left;
94 Result.Reference (Left'Length + 1 .. Result.Last) :=
95 Right.Reference (1 .. Right.Last);
101 (Left : Unbounded_Wide_Wide_String;
102 Right : Wide_Wide_Character) return Unbounded_Wide_Wide_String
104 Result : Unbounded_Wide_Wide_String;
107 Result.Last := Left.Last + 1;
109 Result.Reference := new Wide_Wide_String (1 .. Result.Last);
111 Result.Reference (1 .. Result.Last - 1) :=
112 Left.Reference (1 .. Left.Last);
113 Result.Reference (Result.Last) := Right;
119 (Left : Wide_Wide_Character;
120 Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String
122 Result : Unbounded_Wide_Wide_String;
125 Result.Last := Right.Last + 1;
127 Result.Reference := new Wide_Wide_String (1 .. Result.Last);
128 Result.Reference (1) := Left;
129 Result.Reference (2 .. Result.Last) :=
130 Right.Reference (1 .. Right.Last);
140 Right : Wide_Wide_Character) return Unbounded_Wide_Wide_String
142 Result : Unbounded_Wide_Wide_String;
147 Result.Reference := new Wide_Wide_String (1 .. Left);
148 for J in Result.Reference'Range loop
149 Result.Reference (J) := Right;
157 Right : Wide_Wide_String) return Unbounded_Wide_Wide_String
159 Len : constant Natural := Right'Length;
161 Result : Unbounded_Wide_Wide_String;
164 Result.Last := Left * Len;
166 Result.Reference := new Wide_Wide_String (1 .. Result.Last);
169 for J in 1 .. Left loop
170 Result.Reference (K .. K + Len - 1) := Right;
179 Right : Unbounded_Wide_Wide_String) return Unbounded_Wide_Wide_String
181 Len : constant Natural := Right.Last;
183 Result : Unbounded_Wide_Wide_String;
186 Result.Last := Left * Len;
188 Result.Reference := new Wide_Wide_String (1 .. Result.Last);
191 for J in 1 .. Left loop
192 Result.Reference (K .. K + Len - 1) :=
193 Right.Reference (1 .. Right.Last);
205 (Left : Unbounded_Wide_Wide_String;
206 Right : Unbounded_Wide_Wide_String) return Boolean
210 Left.Reference (1 .. Left.Last) < Right.Reference (1 .. Right.Last);
214 (Left : Unbounded_Wide_Wide_String;
215 Right : Wide_Wide_String) return Boolean
218 return Left.Reference (1 .. Left.Last) < Right;
222 (Left : Wide_Wide_String;
223 Right : Unbounded_Wide_Wide_String) return Boolean
226 return Left < Right.Reference (1 .. Right.Last);
234 (Left : Unbounded_Wide_Wide_String;
235 Right : Unbounded_Wide_Wide_String) return Boolean
239 Left.Reference (1 .. Left.Last) <= Right.Reference (1 .. Right.Last);
243 (Left : Unbounded_Wide_Wide_String;
244 Right : Wide_Wide_String) return Boolean
247 return Left.Reference (1 .. Left.Last) <= Right;
251 (Left : Wide_Wide_String;
252 Right : Unbounded_Wide_Wide_String) return Boolean
255 return Left <= Right.Reference (1 .. Right.Last);
263 (Left : Unbounded_Wide_Wide_String;
264 Right : Unbounded_Wide_Wide_String) return Boolean
268 Left.Reference (1 .. Left.Last) = Right.Reference (1 .. Right.Last);
272 (Left : Unbounded_Wide_Wide_String;
273 Right : Wide_Wide_String) return Boolean
276 return Left.Reference (1 .. Left.Last) = Right;
280 (Left : Wide_Wide_String;
281 Right : Unbounded_Wide_Wide_String) return Boolean
284 return Left = Right.Reference (1 .. Right.Last);
292 (Left : Unbounded_Wide_Wide_String;
293 Right : Unbounded_Wide_Wide_String) return Boolean
297 Left.Reference (1 .. Left.Last) > Right.Reference (1 .. Right.Last);
301 (Left : Unbounded_Wide_Wide_String;
302 Right : Wide_Wide_String) return Boolean
305 return Left.Reference (1 .. Left.Last) > Right;
309 (Left : Wide_Wide_String;
310 Right : Unbounded_Wide_Wide_String) return Boolean
313 return Left > Right.Reference (1 .. Right.Last);
321 (Left : Unbounded_Wide_Wide_String;
322 Right : Unbounded_Wide_Wide_String) return Boolean
326 Left.Reference (1 .. Left.Last) >= Right.Reference (1 .. Right.Last);
330 (Left : Unbounded_Wide_Wide_String;
331 Right : Wide_Wide_String) return Boolean
334 return Left.Reference (1 .. Left.Last) >= Right;
338 (Left : Wide_Wide_String;
339 Right : Unbounded_Wide_Wide_String) return Boolean
342 return Left >= Right.Reference (1 .. Right.Last);
349 procedure Adjust (Object : in out Unbounded_Wide_Wide_String) is
351 -- Copy string, except we do not copy the statically allocated null
352 -- string, since it can never be deallocated. Note that we do not copy
353 -- extra string room here to avoid dragging unused allocated memory.
355 if Object.Reference /= Null_Wide_Wide_String'Access then
357 new Wide_Wide_String'(Object.Reference (1 .. Object.Last));
366 (Source : in out Unbounded_Wide_Wide_String;
367 New_Item : Unbounded_Wide_Wide_String)
370 Realloc_For_Chunk (Source, New_Item.Last);
371 Source.Reference (Source.Last + 1 .. Source.Last + New_Item.Last) :=
372 New_Item.Reference (1 .. New_Item.Last);
373 Source.Last := Source.Last + New_Item.Last;
377 (Source : in out Unbounded_Wide_Wide_String;
378 New_Item : Wide_Wide_String)
381 Realloc_For_Chunk (Source, New_Item'Length);
382 Source.Reference (Source.Last + 1 .. Source.Last + New_Item'Length) :=
384 Source.Last := Source.Last + New_Item'Length;
388 (Source : in out Unbounded_Wide_Wide_String;
389 New_Item : Wide_Wide_Character)
392 Realloc_For_Chunk (Source, 1);
393 Source.Reference (Source.Last + 1) := New_Item;
394 Source.Last := Source.Last + 1;
402 (Source : Unbounded_Wide_Wide_String;
403 Pattern : Wide_Wide_String;
404 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping :=
405 Wide_Wide_Maps.Identity) return Natural
409 Wide_Wide_Search.Count
410 (Source.Reference (1 .. Source.Last), Pattern, Mapping);
414 (Source : Unbounded_Wide_Wide_String;
415 Pattern : Wide_Wide_String;
416 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
421 Wide_Wide_Search.Count
422 (Source.Reference (1 .. Source.Last), Pattern, Mapping);
426 (Source : Unbounded_Wide_Wide_String;
427 Set : Wide_Wide_Maps.Wide_Wide_Character_Set) return Natural
431 Wide_Wide_Search.Count
432 (Source.Reference (1 .. Source.Last), Set);
440 (Source : Unbounded_Wide_Wide_String;
442 Through : Natural) return Unbounded_Wide_Wide_String
446 To_Unbounded_Wide_Wide_String
447 (Wide_Wide_Fixed.Delete
448 (Source.Reference (1 .. Source.Last), From, Through));
452 (Source : in out Unbounded_Wide_Wide_String;
457 if From > Through then
460 elsif From < Source.Reference'First or else Through > Source.Last then
465 Len : constant Natural := Through - From + 1;
468 Source.Reference (From .. Source.Last - Len) :=
469 Source.Reference (Through + 1 .. Source.Last);
470 Source.Last := Source.Last - Len;
480 (Source : Unbounded_Wide_Wide_String;
481 Index : Positive) return Wide_Wide_Character
484 if Index <= Source.Last then
485 return Source.Reference (Index);
487 raise Strings.Index_Error;
495 procedure Finalize (Object : in out Unbounded_Wide_Wide_String) is
496 procedure Deallocate is
497 new Ada.Unchecked_Deallocation
498 (Wide_Wide_String, Wide_Wide_String_Access);
501 -- Note: Don't try to free statically allocated null string
503 if Object.Reference /= Null_Wide_Wide_String'Access then
504 Deallocate (Object.Reference);
505 Object.Reference := Null_Unbounded_Wide_Wide_String.Reference;
515 (Source : Unbounded_Wide_Wide_String;
516 Set : Wide_Wide_Maps.Wide_Wide_Character_Set;
518 Test : Strings.Membership;
519 First : out Positive;
523 Wide_Wide_Search.Find_Token
524 (Source.Reference (From .. Source.Last), Set, Test, First, Last);
528 (Source : Unbounded_Wide_Wide_String;
529 Set : Wide_Wide_Maps.Wide_Wide_Character_Set;
530 Test : Strings.Membership;
531 First : out Positive;
535 Wide_Wide_Search.Find_Token
536 (Source.Reference (1 .. Source.Last), Set, Test, First, Last);
543 procedure Free (X : in out Wide_Wide_String_Access) is
544 procedure Deallocate is
545 new Ada.Unchecked_Deallocation
546 (Wide_Wide_String, Wide_Wide_String_Access);
549 -- Note: Do not try to free statically allocated null string
551 if X /= Null_Unbounded_Wide_Wide_String.Reference then
561 (Source : Unbounded_Wide_Wide_String;
563 Pad : Wide_Wide_Character := Wide_Wide_Space)
564 return Unbounded_Wide_Wide_String
567 return To_Unbounded_Wide_Wide_String
568 (Wide_Wide_Fixed.Head
569 (Source.Reference (1 .. Source.Last), Count, Pad));
573 (Source : in out Unbounded_Wide_Wide_String;
575 Pad : Wide_Wide_Character := Wide_Wide_Space)
577 Old : Wide_Wide_String_Access := Source.Reference;
580 new Wide_Wide_String'
581 (Wide_Wide_Fixed.Head
582 (Source.Reference (1 .. Source.Last), Count, Pad));
583 Source.Last := Source.Reference'Length;
592 (Source : Unbounded_Wide_Wide_String;
593 Pattern : Wide_Wide_String;
594 Going : Strings.Direction := Strings.Forward;
595 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping :=
596 Wide_Wide_Maps.Identity) return Natural
600 Wide_Wide_Search.Index
601 (Source.Reference (1 .. Source.Last), Pattern, Going, Mapping);
605 (Source : Unbounded_Wide_Wide_String;
606 Pattern : Wide_Wide_String;
607 Going : Direction := Forward;
608 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
613 Wide_Wide_Search.Index
614 (Source.Reference (1 .. Source.Last), Pattern, Going, Mapping);
618 (Source : Unbounded_Wide_Wide_String;
619 Set : Wide_Wide_Maps.Wide_Wide_Character_Set;
620 Test : Strings.Membership := Strings.Inside;
621 Going : Strings.Direction := Strings.Forward) return Natural
624 return Wide_Wide_Search.Index
625 (Source.Reference (1 .. Source.Last), Set, Test, Going);
629 (Source : Unbounded_Wide_Wide_String;
630 Pattern : Wide_Wide_String;
632 Going : Direction := Forward;
633 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping :=
634 Wide_Wide_Maps.Identity) return Natural
638 Wide_Wide_Search.Index
639 (Source.Reference (1 .. Source.Last), Pattern, From, Going, Mapping);
643 (Source : Unbounded_Wide_Wide_String;
644 Pattern : Wide_Wide_String;
646 Going : Direction := Forward;
647 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
652 Wide_Wide_Search.Index
653 (Source.Reference (1 .. Source.Last), Pattern, From, Going, Mapping);
657 (Source : Unbounded_Wide_Wide_String;
658 Set : Wide_Wide_Maps.Wide_Wide_Character_Set;
660 Test : Membership := Inside;
661 Going : Direction := Forward) return Natural
665 Wide_Wide_Search.Index
666 (Source.Reference (1 .. Source.Last), Set, From, Test, Going);
669 function Index_Non_Blank
670 (Source : Unbounded_Wide_Wide_String;
671 Going : Strings.Direction := Strings.Forward) return Natural
675 Wide_Wide_Search.Index_Non_Blank
676 (Source.Reference (1 .. Source.Last), Going);
679 function Index_Non_Blank
680 (Source : Unbounded_Wide_Wide_String;
682 Going : Direction := Forward) return Natural
686 Wide_Wide_Search.Index_Non_Blank
687 (Source.Reference (1 .. Source.Last), From, Going);
694 procedure Initialize (Object : in out Unbounded_Wide_Wide_String) is
696 Object.Reference := Null_Unbounded_Wide_Wide_String.Reference;
705 (Source : Unbounded_Wide_Wide_String;
707 New_Item : Wide_Wide_String) return Unbounded_Wide_Wide_String
711 To_Unbounded_Wide_Wide_String
712 (Wide_Wide_Fixed.Insert
713 (Source.Reference (1 .. Source.Last), Before, New_Item));
717 (Source : in out Unbounded_Wide_Wide_String;
719 New_Item : Wide_Wide_String)
722 if Before not in Source.Reference'First .. Source.Last + 1 then
726 Realloc_For_Chunk (Source, New_Item'Length);
729 (Before + New_Item'Length .. Source.Last + New_Item'Length) :=
730 Source.Reference (Before .. Source.Last);
732 Source.Reference (Before .. Before + New_Item'Length - 1) := New_Item;
733 Source.Last := Source.Last + New_Item'Length;
740 function Length (Source : Unbounded_Wide_Wide_String) return Natural is
750 (Source : Unbounded_Wide_Wide_String;
752 New_Item : Wide_Wide_String) return Unbounded_Wide_Wide_String
756 To_Unbounded_Wide_Wide_String
757 (Wide_Wide_Fixed.Overwrite
758 (Source.Reference (1 .. Source.Last), Position, New_Item));
762 (Source : in out Unbounded_Wide_Wide_String;
764 New_Item : Wide_Wide_String)
766 NL : constant Natural := New_Item'Length;
768 if Position <= Source.Last - NL + 1 then
769 Source.Reference (Position .. Position + NL - 1) := New_Item;
772 Old : Wide_Wide_String_Access := Source.Reference;
774 Source.Reference := new Wide_Wide_String'
775 (Wide_Wide_Fixed.Overwrite
776 (Source.Reference (1 .. Source.Last), Position, New_Item));
777 Source.Last := Source.Reference'Length;
783 -----------------------
784 -- Realloc_For_Chunk --
785 -----------------------
787 procedure Realloc_For_Chunk
788 (Source : in out Unbounded_Wide_Wide_String;
789 Chunk_Size : Natural)
791 Growth_Factor : constant := 32;
792 -- The growth factor controls how much extra space is allocated when
793 -- we have to increase the size of an allocated unbounded string. By
794 -- allocating extra space, we avoid the need to reallocate on every
795 -- append, particularly important when a string is built up by repeated
796 -- append operations of small pieces. This is expressed as a factor so
797 -- 32 means add 1/32 of the length of the string as growth space.
799 Min_Mul_Alloc : constant := Standard'Maximum_Alignment;
800 -- Allocation will be done by a multiple of Min_Mul_Alloc This causes
801 -- no memory loss as most (all?) malloc implementations are obliged to
802 -- align the returned memory on the maximum alignment as malloc does not
803 -- know the target alignment.
805 S_Length : constant Natural := Source.Reference'Length;
808 if Chunk_Size > S_Length - Source.Last then
810 New_Size : constant Positive :=
811 S_Length + Chunk_Size + (S_Length / Growth_Factor);
813 New_Rounded_Up_Size : constant Positive :=
814 ((New_Size - 1) / Min_Mul_Alloc + 1) * Min_Mul_Alloc;
816 Tmp : constant Wide_Wide_String_Access :=
817 new Wide_Wide_String (1 .. New_Rounded_Up_Size);
820 Tmp (1 .. Source.Last) := Source.Reference (1 .. Source.Last);
821 Free (Source.Reference);
822 Source.Reference := Tmp;
825 end Realloc_For_Chunk;
827 ---------------------
828 -- Replace_Element --
829 ---------------------
831 procedure Replace_Element
832 (Source : in out Unbounded_Wide_Wide_String;
834 By : Wide_Wide_Character)
837 if Index <= Source.Last then
838 Source.Reference (Index) := By;
840 raise Strings.Index_Error;
848 function Replace_Slice
849 (Source : Unbounded_Wide_Wide_String;
852 By : Wide_Wide_String) return Unbounded_Wide_Wide_String
855 return To_Unbounded_Wide_Wide_String
856 (Wide_Wide_Fixed.Replace_Slice
857 (Source.Reference (1 .. Source.Last), Low, High, By));
860 procedure Replace_Slice
861 (Source : in out Unbounded_Wide_Wide_String;
864 By : Wide_Wide_String)
866 Old : Wide_Wide_String_Access := Source.Reference;
868 Source.Reference := new Wide_Wide_String'
869 (Wide_Wide_Fixed.Replace_Slice
870 (Source.Reference (1 .. Source.Last), Low, High, By));
871 Source.Last := Source.Reference'Length;
875 ------------------------------------
876 -- Set_Unbounded_Wide_Wide_String --
877 ------------------------------------
879 procedure Set_Unbounded_Wide_Wide_String
880 (Target : out Unbounded_Wide_Wide_String;
881 Source : Wide_Wide_String)
884 Target.Last := Source'Length;
885 Target.Reference := new Wide_Wide_String (1 .. Source'Length);
886 Target.Reference.all := Source;
887 end Set_Unbounded_Wide_Wide_String;
894 (Source : Unbounded_Wide_Wide_String;
896 High : Natural) return Wide_Wide_String
899 -- Note: test of High > Length is in accordance with AI95-00128
901 if Low > Source.Last + 1 or else High > Source.Last then
904 return Source.Reference (Low .. High);
913 (Source : Unbounded_Wide_Wide_String;
915 Pad : Wide_Wide_Character := Wide_Wide_Space)
916 return Unbounded_Wide_Wide_String is
918 return To_Unbounded_Wide_Wide_String
919 (Wide_Wide_Fixed.Tail
920 (Source.Reference (1 .. Source.Last), Count, Pad));
924 (Source : in out Unbounded_Wide_Wide_String;
926 Pad : Wide_Wide_Character := Wide_Wide_Space)
928 Old : Wide_Wide_String_Access := Source.Reference;
930 Source.Reference := new Wide_Wide_String'
931 (Wide_Wide_Fixed.Tail
932 (Source.Reference (1 .. Source.Last), Count, Pad));
933 Source.Last := Source.Reference'Length;
937 -----------------------------------
938 -- To_Unbounded_Wide_Wide_String --
939 -----------------------------------
941 function To_Unbounded_Wide_Wide_String
942 (Source : Wide_Wide_String) return Unbounded_Wide_Wide_String
944 Result : Unbounded_Wide_Wide_String;
946 Result.Last := Source'Length;
947 Result.Reference := new Wide_Wide_String (1 .. Source'Length);
948 Result.Reference.all := Source;
950 end To_Unbounded_Wide_Wide_String;
952 function To_Unbounded_Wide_Wide_String
953 (Length : Natural) return Unbounded_Wide_Wide_String
955 Result : Unbounded_Wide_Wide_String;
957 Result.Last := Length;
958 Result.Reference := new Wide_Wide_String (1 .. Length);
960 end To_Unbounded_Wide_Wide_String;
962 -------------------------
963 -- To_Wide_Wide_String --
964 -------------------------
966 function To_Wide_Wide_String
967 (Source : Unbounded_Wide_Wide_String) return Wide_Wide_String
970 return Source.Reference (1 .. Source.Last);
971 end To_Wide_Wide_String;
978 (Source : Unbounded_Wide_Wide_String;
979 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping)
980 return Unbounded_Wide_Wide_String
984 To_Unbounded_Wide_Wide_String
985 (Wide_Wide_Fixed.Translate
986 (Source.Reference (1 .. Source.Last), Mapping));
990 (Source : in out Unbounded_Wide_Wide_String;
991 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping)
994 Wide_Wide_Fixed.Translate (Source.Reference (1 .. Source.Last), Mapping);
998 (Source : Unbounded_Wide_Wide_String;
999 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
1000 return Unbounded_Wide_Wide_String
1004 To_Unbounded_Wide_Wide_String
1005 (Wide_Wide_Fixed.Translate
1006 (Source.Reference (1 .. Source.Last), Mapping));
1010 (Source : in out Unbounded_Wide_Wide_String;
1011 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
1014 Wide_Wide_Fixed.Translate (Source.Reference (1 .. Source.Last), Mapping);
1022 (Source : Unbounded_Wide_Wide_String;
1023 Side : Trim_End) return Unbounded_Wide_Wide_String
1027 To_Unbounded_Wide_Wide_String
1028 (Wide_Wide_Fixed.Trim (Source.Reference (1 .. Source.Last), Side));
1032 (Source : in out Unbounded_Wide_Wide_String;
1035 Old : Wide_Wide_String_Access := Source.Reference;
1038 new Wide_Wide_String'
1039 (Wide_Wide_Fixed.Trim (Source.Reference (1 .. Source.Last), Side));
1040 Source.Last := Source.Reference'Length;
1045 (Source : Unbounded_Wide_Wide_String;
1046 Left : Wide_Wide_Maps.Wide_Wide_Character_Set;
1047 Right : Wide_Wide_Maps.Wide_Wide_Character_Set)
1048 return Unbounded_Wide_Wide_String
1052 To_Unbounded_Wide_Wide_String
1053 (Wide_Wide_Fixed.Trim
1054 (Source.Reference (1 .. Source.Last), Left, Right));
1058 (Source : in out Unbounded_Wide_Wide_String;
1059 Left : Wide_Wide_Maps.Wide_Wide_Character_Set;
1060 Right : Wide_Wide_Maps.Wide_Wide_Character_Set)
1062 Old : Wide_Wide_String_Access := Source.Reference;
1065 new Wide_Wide_String'
1066 (Wide_Wide_Fixed.Trim
1067 (Source.Reference (1 .. Source.Last), Left, Right));
1068 Source.Last := Source.Reference'Length;
1072 ---------------------
1073 -- Unbounded_Slice --
1074 ---------------------
1076 function Unbounded_Slice
1077 (Source : Unbounded_Wide_Wide_String;
1079 High : Natural) return Unbounded_Wide_Wide_String
1082 if Low > Source.Last + 1 or else High > Source.Last then
1086 To_Unbounded_Wide_Wide_String (Source.Reference.all (Low .. High));
1088 end Unbounded_Slice;
1090 procedure Unbounded_Slice
1091 (Source : Unbounded_Wide_Wide_String;
1092 Target : out Unbounded_Wide_Wide_String;
1097 if Low > Source.Last + 1 or else High > Source.Last then
1101 To_Unbounded_Wide_Wide_String (Source.Reference.all (Low .. High));
1103 end Unbounded_Slice;
1105 end Ada.Strings.Wide_Wide_Unbounded;