1 ------------------------------------------------------------------------------
3 -- GNAT RUNTIME 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-2005 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 2, 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. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
32 ------------------------------------------------------------------------------
34 with Ada
.Strings
.Wide_Wide_Fixed
;
35 with Ada
.Strings
.Wide_Wide_Search
;
36 with Ada
.Unchecked_Deallocation
;
38 package body Ada
.Strings
.Wide_Wide_Unbounded
is
47 (Left
: Unbounded_Wide_Wide_String
;
48 Right
: Unbounded_Wide_Wide_String
) return Unbounded_Wide_Wide_String
50 L_Length
: constant Natural := Left
.Last
;
51 R_Length
: constant Natural := Right
.Last
;
52 Result
: Unbounded_Wide_Wide_String
;
55 Result
.Last
:= L_Length
+ R_Length
;
57 Result
.Reference
:= new Wide_Wide_String
(1 .. Result
.Last
);
59 Result
.Reference
(1 .. L_Length
) :=
60 Left
.Reference
(1 .. Left
.Last
);
61 Result
.Reference
(L_Length
+ 1 .. Result
.Last
) :=
62 Right
.Reference
(1 .. Right
.Last
);
68 (Left
: Unbounded_Wide_Wide_String
;
69 Right
: Wide_Wide_String
) return Unbounded_Wide_Wide_String
71 L_Length
: constant Natural := Left
.Last
;
72 Result
: Unbounded_Wide_Wide_String
;
75 Result
.Last
:= L_Length
+ Right
'Length;
77 Result
.Reference
:= new Wide_Wide_String
(1 .. Result
.Last
);
79 Result
.Reference
(1 .. L_Length
) := Left
.Reference
(1 .. Left
.Last
);
80 Result
.Reference
(L_Length
+ 1 .. Result
.Last
) := Right
;
86 (Left
: Wide_Wide_String
;
87 Right
: Unbounded_Wide_Wide_String
) return Unbounded_Wide_Wide_String
89 R_Length
: constant Natural := Right
.Last
;
90 Result
: Unbounded_Wide_Wide_String
;
93 Result
.Last
:= Left
'Length + R_Length
;
95 Result
.Reference
:= new Wide_Wide_String
(1 .. Result
.Last
);
97 Result
.Reference
(1 .. Left
'Length) := Left
;
98 Result
.Reference
(Left
'Length + 1 .. Result
.Last
) :=
99 Right
.Reference
(1 .. Right
.Last
);
105 (Left
: Unbounded_Wide_Wide_String
;
106 Right
: Wide_Wide_Character
) return Unbounded_Wide_Wide_String
108 Result
: Unbounded_Wide_Wide_String
;
111 Result
.Last
:= Left
.Last
+ 1;
113 Result
.Reference
:= new Wide_Wide_String
(1 .. Result
.Last
);
115 Result
.Reference
(1 .. Result
.Last
- 1) :=
116 Left
.Reference
(1 .. Left
.Last
);
117 Result
.Reference
(Result
.Last
) := Right
;
123 (Left
: Wide_Wide_Character
;
124 Right
: Unbounded_Wide_Wide_String
) return Unbounded_Wide_Wide_String
126 Result
: Unbounded_Wide_Wide_String
;
129 Result
.Last
:= Right
.Last
+ 1;
131 Result
.Reference
:= new Wide_Wide_String
(1 .. Result
.Last
);
132 Result
.Reference
(1) := Left
;
133 Result
.Reference
(2 .. Result
.Last
) :=
134 Right
.Reference
(1 .. Right
.Last
);
144 Right
: Wide_Wide_Character
) return Unbounded_Wide_Wide_String
146 Result
: Unbounded_Wide_Wide_String
;
151 Result
.Reference
:= new Wide_Wide_String
(1 .. Left
);
152 for J
in Result
.Reference
'Range loop
153 Result
.Reference
(J
) := Right
;
161 Right
: Wide_Wide_String
) return Unbounded_Wide_Wide_String
163 Len
: constant Natural := Right
'Length;
165 Result
: Unbounded_Wide_Wide_String
;
168 Result
.Last
:= Left
* Len
;
170 Result
.Reference
:= new Wide_Wide_String
(1 .. Result
.Last
);
173 for J
in 1 .. Left
loop
174 Result
.Reference
(K
.. K
+ Len
- 1) := Right
;
183 Right
: Unbounded_Wide_Wide_String
) return Unbounded_Wide_Wide_String
185 Len
: constant Natural := Right
.Last
;
187 Result
: Unbounded_Wide_Wide_String
;
190 Result
.Last
:= Left
* Len
;
192 Result
.Reference
:= new Wide_Wide_String
(1 .. Result
.Last
);
195 for J
in 1 .. Left
loop
196 Result
.Reference
(K
.. K
+ Len
- 1) :=
197 Right
.Reference
(1 .. Right
.Last
);
209 (Left
: Unbounded_Wide_Wide_String
;
210 Right
: Unbounded_Wide_Wide_String
) return Boolean
214 Left
.Reference
(1 .. Left
.Last
) < Right
.Reference
(1 .. Right
.Last
);
218 (Left
: Unbounded_Wide_Wide_String
;
219 Right
: Wide_Wide_String
) return Boolean
222 return Left
.Reference
(1 .. Left
.Last
) < Right
;
226 (Left
: Wide_Wide_String
;
227 Right
: Unbounded_Wide_Wide_String
) return Boolean
230 return Left
< Right
.Reference
(1 .. Right
.Last
);
238 (Left
: Unbounded_Wide_Wide_String
;
239 Right
: Unbounded_Wide_Wide_String
) return Boolean
243 Left
.Reference
(1 .. Left
.Last
) <= Right
.Reference
(1 .. Right
.Last
);
247 (Left
: Unbounded_Wide_Wide_String
;
248 Right
: Wide_Wide_String
) return Boolean
251 return Left
.Reference
(1 .. Left
.Last
) <= Right
;
255 (Left
: Wide_Wide_String
;
256 Right
: Unbounded_Wide_Wide_String
) return Boolean
259 return Left
<= Right
.Reference
(1 .. Right
.Last
);
267 (Left
: Unbounded_Wide_Wide_String
;
268 Right
: Unbounded_Wide_Wide_String
) return Boolean
272 Left
.Reference
(1 .. Left
.Last
) = Right
.Reference
(1 .. Right
.Last
);
276 (Left
: Unbounded_Wide_Wide_String
;
277 Right
: Wide_Wide_String
) return Boolean
280 return Left
.Reference
(1 .. Left
.Last
) = Right
;
284 (Left
: Wide_Wide_String
;
285 Right
: Unbounded_Wide_Wide_String
) return Boolean
288 return Left
= Right
.Reference
(1 .. Right
.Last
);
296 (Left
: Unbounded_Wide_Wide_String
;
297 Right
: Unbounded_Wide_Wide_String
) return Boolean
301 Left
.Reference
(1 .. Left
.Last
) > Right
.Reference
(1 .. Right
.Last
);
305 (Left
: Unbounded_Wide_Wide_String
;
306 Right
: Wide_Wide_String
) return Boolean
309 return Left
.Reference
(1 .. Left
.Last
) > Right
;
313 (Left
: Wide_Wide_String
;
314 Right
: Unbounded_Wide_Wide_String
) return Boolean
317 return Left
> Right
.Reference
(1 .. Right
.Last
);
325 (Left
: Unbounded_Wide_Wide_String
;
326 Right
: Unbounded_Wide_Wide_String
) return Boolean
330 Left
.Reference
(1 .. Left
.Last
) >= Right
.Reference
(1 .. Right
.Last
);
334 (Left
: Unbounded_Wide_Wide_String
;
335 Right
: Wide_Wide_String
) return Boolean
338 return Left
.Reference
(1 .. Left
.Last
) >= Right
;
342 (Left
: Wide_Wide_String
;
343 Right
: Unbounded_Wide_Wide_String
) return Boolean
346 return Left
>= Right
.Reference
(1 .. Right
.Last
);
353 procedure Adjust
(Object
: in out Unbounded_Wide_Wide_String
) is
355 -- Copy string, except we do not copy the statically allocated null
356 -- string, since it can never be deallocated. Note that we do not copy
357 -- extra string room here to avoid dragging unused allocated memory.
359 if Object
.Reference
/= Null_Wide_Wide_String
'Access then
361 new Wide_Wide_String
'(Object.Reference (1 .. Object.Last));
370 (Source : in out Unbounded_Wide_Wide_String;
371 New_Item : Unbounded_Wide_Wide_String)
374 Realloc_For_Chunk (Source, New_Item.Last);
375 Source.Reference (Source.Last + 1 .. Source.Last + New_Item.Last) :=
376 New_Item.Reference (1 .. New_Item.Last);
377 Source.Last := Source.Last + New_Item.Last;
381 (Source : in out Unbounded_Wide_Wide_String;
382 New_Item : Wide_Wide_String)
385 Realloc_For_Chunk (Source, New_Item'Length);
386 Source.Reference (Source.Last + 1 .. Source.Last + New_Item'Length) :=
388 Source.Last := Source.Last + New_Item'Length;
392 (Source : in out Unbounded_Wide_Wide_String;
393 New_Item : Wide_Wide_Character)
396 Realloc_For_Chunk (Source, 1);
397 Source.Reference (Source.Last + 1) := New_Item;
398 Source.Last := Source.Last + 1;
406 (Source : Unbounded_Wide_Wide_String;
407 Pattern : Wide_Wide_String;
408 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping :=
409 Wide_Wide_Maps.Identity)
414 Wide_Wide_Search.Count
415 (Source.Reference (1 .. Source.Last), Pattern, Mapping);
419 (Source : Unbounded_Wide_Wide_String;
420 Pattern : Wide_Wide_String;
421 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
426 Wide_Wide_Search.Count
427 (Source.Reference (1 .. Source.Last), Pattern, Mapping);
431 (Source : Unbounded_Wide_Wide_String;
432 Set : Wide_Wide_Maps.Wide_Wide_Character_Set) return Natural
436 Wide_Wide_Search.Count
437 (Source.Reference (1 .. Source.Last), Set);
445 (Source : Unbounded_Wide_Wide_String;
447 Through : Natural) return Unbounded_Wide_Wide_String
451 To_Unbounded_Wide_Wide_String
452 (Wide_Wide_Fixed.Delete
453 (Source.Reference (1 .. Source.Last), From, Through));
457 (Source : in out Unbounded_Wide_Wide_String;
462 if From > Through then
465 elsif From < Source.Reference'First or else Through > Source.Last then
470 Len : constant Natural := Through - From + 1;
473 Source.Reference (From .. Source.Last - Len) :=
474 Source.Reference (Through + 1 .. Source.Last);
475 Source.Last := Source.Last - Len;
485 (Source : Unbounded_Wide_Wide_String;
486 Index : Positive) return Wide_Wide_Character
489 if Index <= Source.Last then
490 return Source.Reference (Index);
492 raise Strings.Index_Error;
500 procedure Finalize (Object : in out Unbounded_Wide_Wide_String) is
501 procedure Deallocate is
502 new Ada.Unchecked_Deallocation
503 (Wide_Wide_String, Wide_Wide_String_Access);
506 -- Note: Don't try to free statically allocated null string
508 if Object.Reference /= Null_Wide_Wide_String'Access then
509 Deallocate (Object.Reference);
510 Object.Reference := Null_Unbounded_Wide_Wide_String.Reference;
520 (Source : Unbounded_Wide_Wide_String;
521 Set : Wide_Wide_Maps.Wide_Wide_Character_Set;
522 Test : Strings.Membership;
523 First : out Positive;
527 Wide_Wide_Search.Find_Token
528 (Source.Reference (1 .. Source.Last), Set, Test, First, Last);
535 procedure Free (X : in out Wide_Wide_String_Access) is
536 procedure Deallocate is
537 new Ada.Unchecked_Deallocation
538 (Wide_Wide_String, Wide_Wide_String_Access);
541 -- Note: Do not try to free statically allocated null string
543 if X /= Null_Unbounded_Wide_Wide_String.Reference then
553 (Source : Unbounded_Wide_Wide_String;
555 Pad : Wide_Wide_Character := Wide_Wide_Space)
556 return Unbounded_Wide_Wide_String
559 return To_Unbounded_Wide_Wide_String
560 (Wide_Wide_Fixed.Head
561 (Source.Reference (1 .. Source.Last), Count, Pad));
565 (Source : in out Unbounded_Wide_Wide_String;
567 Pad : Wide_Wide_Character := Wide_Wide_Space)
569 Old : Wide_Wide_String_Access := Source.Reference;
572 new Wide_Wide_String'
573 (Wide_Wide_Fixed
.Head
574 (Source
.Reference
(1 .. Source
.Last
), Count
, Pad
));
575 Source
.Last
:= Source
.Reference
'Length;
584 (Source
: Unbounded_Wide_Wide_String
;
585 Pattern
: Wide_Wide_String
;
586 Going
: Strings
.Direction
:= Strings
.Forward
;
587 Mapping
: Wide_Wide_Maps
.Wide_Wide_Character_Mapping
:=
588 Wide_Wide_Maps
.Identity
)
593 Wide_Wide_Search
.Index
594 (Source
.Reference
(1 .. Source
.Last
), Pattern
, Going
, Mapping
);
598 (Source
: Unbounded_Wide_Wide_String
;
599 Pattern
: Wide_Wide_String
;
600 Going
: Direction
:= Forward
;
601 Mapping
: Wide_Wide_Maps
.Wide_Wide_Character_Mapping_Function
)
606 Wide_Wide_Search
.Index
607 (Source
.Reference
(1 .. Source
.Last
), Pattern
, Going
, Mapping
);
611 (Source
: Unbounded_Wide_Wide_String
;
612 Set
: Wide_Wide_Maps
.Wide_Wide_Character_Set
;
613 Test
: Strings
.Membership
:= Strings
.Inside
;
614 Going
: Strings
.Direction
:= Strings
.Forward
) return Natural
617 return Wide_Wide_Search
.Index
618 (Source
.Reference
(1 .. Source
.Last
), Set
, Test
, Going
);
622 (Source
: Unbounded_Wide_Wide_String
;
623 Pattern
: Wide_Wide_String
;
625 Going
: Direction
:= Forward
;
626 Mapping
: Wide_Wide_Maps
.Wide_Wide_Character_Mapping
:=
627 Wide_Wide_Maps
.Identity
)
632 Wide_Wide_Search
.Index
633 (Source
.Reference
(1 .. Source
.Last
), Pattern
, From
, Going
, Mapping
);
637 (Source
: Unbounded_Wide_Wide_String
;
638 Pattern
: Wide_Wide_String
;
640 Going
: Direction
:= Forward
;
641 Mapping
: Wide_Wide_Maps
.Wide_Wide_Character_Mapping_Function
)
646 Wide_Wide_Search
.Index
647 (Source
.Reference
(1 .. Source
.Last
), Pattern
, From
, Going
, Mapping
);
652 (Source
: Unbounded_Wide_Wide_String
;
653 Set
: Wide_Wide_Maps
.Wide_Wide_Character_Set
;
655 Test
: Membership
:= Inside
;
656 Going
: Direction
:= Forward
) return Natural
660 Wide_Wide_Search
.Index
661 (Source
.Reference
(1 .. Source
.Last
), Set
, From
, Test
, Going
);
664 function Index_Non_Blank
665 (Source
: Unbounded_Wide_Wide_String
;
666 Going
: Strings
.Direction
:= Strings
.Forward
) return Natural
670 Wide_Wide_Search
.Index_Non_Blank
671 (Source
.Reference
(1 .. Source
.Last
), Going
);
674 function Index_Non_Blank
675 (Source
: Unbounded_Wide_Wide_String
;
677 Going
: Direction
:= Forward
) return Natural
681 Wide_Wide_Search
.Index_Non_Blank
682 (Source
.Reference
(1 .. Source
.Last
), From
, Going
);
689 procedure Initialize
(Object
: in out Unbounded_Wide_Wide_String
) is
691 Object
.Reference
:= Null_Unbounded_Wide_Wide_String
.Reference
;
700 (Source
: Unbounded_Wide_Wide_String
;
702 New_Item
: Wide_Wide_String
) return Unbounded_Wide_Wide_String
706 To_Unbounded_Wide_Wide_String
707 (Wide_Wide_Fixed
.Insert
708 (Source
.Reference
(1 .. Source
.Last
), Before
, New_Item
));
712 (Source
: in out Unbounded_Wide_Wide_String
;
714 New_Item
: Wide_Wide_String
)
717 if Before
not in Source
.Reference
'First .. Source
.Last
+ 1 then
721 Realloc_For_Chunk
(Source
, New_Item
'Size);
724 (Before
+ New_Item
'Length .. Source
.Last
+ New_Item
'Length) :=
725 Source
.Reference
(Before
.. Source
.Last
);
727 Source
.Reference
(Before
.. Before
+ New_Item
'Length - 1) := New_Item
;
728 Source
.Last
:= Source
.Last
+ New_Item
'Length;
735 function Length
(Source
: Unbounded_Wide_Wide_String
) return Natural is
745 (Source
: Unbounded_Wide_Wide_String
;
747 New_Item
: Wide_Wide_String
) return Unbounded_Wide_Wide_String
751 To_Unbounded_Wide_Wide_String
752 (Wide_Wide_Fixed
.Overwrite
753 (Source
.Reference
(1 .. Source
.Last
), Position
, New_Item
));
757 (Source
: in out Unbounded_Wide_Wide_String
;
759 New_Item
: Wide_Wide_String
)
761 NL
: constant Natural := New_Item
'Length;
763 if Position
<= Source
.Last
- NL
+ 1 then
764 Source
.Reference
(Position
.. Position
+ NL
- 1) := New_Item
;
767 Old
: Wide_Wide_String_Access
:= Source
.Reference
;
769 Source
.Reference
:= new Wide_Wide_String
'
770 (Wide_Wide_Fixed.Overwrite
771 (Source.Reference (1 .. Source.Last), Position, New_Item));
772 Source.Last := Source.Reference'Length;
778 -----------------------
779 -- Realloc_For_Chunk --
780 -----------------------
782 procedure Realloc_For_Chunk
783 (Source : in out Unbounded_Wide_Wide_String;
784 Chunk_Size : Natural)
786 Growth_Factor : constant := 50;
787 S_Length : constant Natural := Source.Reference'Length;
790 if Chunk_Size > S_Length - Source.Last then
792 Alloc_Chunk_Size : constant Positive :=
793 Chunk_Size + (S_Length / Growth_Factor);
794 Tmp : Wide_Wide_String_Access;
796 Tmp := new Wide_Wide_String (1 .. S_Length + Alloc_Chunk_Size);
797 Tmp (1 .. Source.Last) := Source.Reference (1 .. Source.Last);
798 Free (Source.Reference);
799 Source.Reference := Tmp;
802 end Realloc_For_Chunk;
804 ---------------------
805 -- Replace_Element --
806 ---------------------
808 procedure Replace_Element
809 (Source : in out Unbounded_Wide_Wide_String;
811 By : Wide_Wide_Character)
814 if Index <= Source.Last then
815 Source.Reference (Index) := By;
817 raise Strings.Index_Error;
825 function Replace_Slice
826 (Source : Unbounded_Wide_Wide_String;
829 By : Wide_Wide_String) return Unbounded_Wide_Wide_String
832 return To_Unbounded_Wide_Wide_String
833 (Wide_Wide_Fixed.Replace_Slice
834 (Source.Reference (1 .. Source.Last), Low, High, By));
837 procedure Replace_Slice
838 (Source : in out Unbounded_Wide_Wide_String;
841 By : Wide_Wide_String)
843 Old : Wide_Wide_String_Access := Source.Reference;
845 Source.Reference := new Wide_Wide_String'
846 (Wide_Wide_Fixed
.Replace_Slice
847 (Source
.Reference
(1 .. Source
.Last
), Low
, High
, By
));
848 Source
.Last
:= Source
.Reference
'Length;
852 ------------------------------------
853 -- Set_Unbounded_Wide_Wide_String --
854 ------------------------------------
856 procedure Set_Unbounded_Wide_Wide_String
857 (Target
: out Unbounded_Wide_Wide_String
;
858 Source
: Wide_Wide_String
)
861 Target
.Last
:= Source
'Length;
862 Target
.Reference
:= new Wide_Wide_String
(1 .. Source
'Length);
863 Target
.Reference
.all := Source
;
864 end Set_Unbounded_Wide_Wide_String
;
871 (Source
: Unbounded_Wide_Wide_String
;
873 High
: Natural) return Wide_Wide_String
876 -- Note: test of High > Length is in accordance with AI95-00128
878 if Low
> Source
.Last
+ 1 or else High
> Source
.Last
then
881 return Source
.Reference
(Low
.. High
);
890 (Source
: Unbounded_Wide_Wide_String
;
892 Pad
: Wide_Wide_Character
:= Wide_Wide_Space
)
893 return Unbounded_Wide_Wide_String
is
895 return To_Unbounded_Wide_Wide_String
896 (Wide_Wide_Fixed
.Tail
897 (Source
.Reference
(1 .. Source
.Last
), Count
, Pad
));
901 (Source
: in out Unbounded_Wide_Wide_String
;
903 Pad
: Wide_Wide_Character
:= Wide_Wide_Space
)
905 Old
: Wide_Wide_String_Access
:= Source
.Reference
;
907 Source
.Reference
:= new Wide_Wide_String
'
908 (Wide_Wide_Fixed.Tail
909 (Source.Reference (1 .. Source.Last), Count, Pad));
910 Source.Last := Source.Reference'Length;
914 ------------------------------
915 -- To_Unbounded_Wide_Wide_String --
916 ------------------------------
918 function To_Unbounded_Wide_Wide_String
919 (Source : Wide_Wide_String) return Unbounded_Wide_Wide_String
921 Result : Unbounded_Wide_Wide_String;
923 Result.Last := Source'Length;
924 Result.Reference := new Wide_Wide_String (1 .. Source'Length);
925 Result.Reference.all := Source;
927 end To_Unbounded_Wide_Wide_String;
929 function To_Unbounded_Wide_Wide_String
930 (Length : Natural) return Unbounded_Wide_Wide_String
932 Result : Unbounded_Wide_Wide_String;
934 Result.Last := Length;
935 Result.Reference := new Wide_Wide_String (1 .. Length);
937 end To_Unbounded_Wide_Wide_String;
940 -- To_Wide_Wide_String --
943 function To_Wide_Wide_String
944 (Source : Unbounded_Wide_Wide_String) return Wide_Wide_String
947 return Source.Reference (1 .. Source.Last);
948 end To_Wide_Wide_String;
956 (Source : Unbounded_Wide_Wide_String;
957 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping)
958 return Unbounded_Wide_Wide_String
962 To_Unbounded_Wide_Wide_String
963 (Wide_Wide_Fixed.Translate
964 (Source.Reference (1 .. Source.Last), Mapping));
968 (Source : in out Unbounded_Wide_Wide_String;
969 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping)
972 Wide_Wide_Fixed.Translate (Source.Reference (1 .. Source.Last), Mapping);
976 (Source : Unbounded_Wide_Wide_String;
977 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
978 return Unbounded_Wide_Wide_String
982 To_Unbounded_Wide_Wide_String
983 (Wide_Wide_Fixed.Translate
984 (Source.Reference (1 .. Source.Last), Mapping));
988 (Source : in out Unbounded_Wide_Wide_String;
989 Mapping : Wide_Wide_Maps.Wide_Wide_Character_Mapping_Function)
992 Wide_Wide_Fixed.Translate (Source.Reference (1 .. Source.Last), Mapping);
1000 (Source : Unbounded_Wide_Wide_String;
1001 Side : Trim_End) return Unbounded_Wide_Wide_String
1005 To_Unbounded_Wide_Wide_String
1006 (Wide_Wide_Fixed.Trim (Source.Reference (1 .. Source.Last), Side));
1010 (Source : in out Unbounded_Wide_Wide_String;
1013 Old : Wide_Wide_String_Access := Source.Reference;
1016 new Wide_Wide_String'
1017 (Wide_Wide_Fixed
.Trim
(Source
.Reference
(1 .. Source
.Last
), Side
));
1018 Source
.Last
:= Source
.Reference
'Length;
1023 (Source
: Unbounded_Wide_Wide_String
;
1024 Left
: Wide_Wide_Maps
.Wide_Wide_Character_Set
;
1025 Right
: Wide_Wide_Maps
.Wide_Wide_Character_Set
)
1026 return Unbounded_Wide_Wide_String
1030 To_Unbounded_Wide_Wide_String
1031 (Wide_Wide_Fixed
.Trim
1032 (Source
.Reference
(1 .. Source
.Last
), Left
, Right
));
1036 (Source
: in out Unbounded_Wide_Wide_String
;
1037 Left
: Wide_Wide_Maps
.Wide_Wide_Character_Set
;
1038 Right
: Wide_Wide_Maps
.Wide_Wide_Character_Set
)
1040 Old
: Wide_Wide_String_Access
:= Source
.Reference
;
1043 new Wide_Wide_String
'
1044 (Wide_Wide_Fixed.Trim
1045 (Source.Reference (1 .. Source.Last), Left, Right));
1046 Source.Last := Source.Reference'Length;
1050 ---------------------
1051 -- Unbounded_Slice --
1052 ---------------------
1054 function Unbounded_Slice
1055 (Source : Unbounded_Wide_Wide_String;
1057 High : Natural) return Unbounded_Wide_Wide_String
1060 if Low > Source.Last + 1 or else High > Source.Last then
1064 To_Unbounded_Wide_Wide_String (Source.Reference.all (Low .. High));
1066 end Unbounded_Slice;
1068 procedure Unbounded_Slice
1069 (Source : Unbounded_Wide_Wide_String;
1070 Target : out Unbounded_Wide_Wide_String;
1075 if Low > Source.Last + 1 or else High > Source.Last then
1079 To_Unbounded_Wide_Wide_String (Source.Reference.all (Low .. High));
1081 end Unbounded_Slice;
1083 end Ada.Strings.Wide_Wide_Unbounded;