gnatcoll_syslog_25.0.0_0848cc59/cpp/gnatcoll-cpp-strings.ads

  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
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
------------------------------------------------------------------------------
--                             G N A T C O L L                              --
--                                                                          --
--                        Copyright (C) 2023, AdaCore                       --
--                                                                          --
-- This library is free software;  you can redistribute it and/or modify it --
-- under terms of the  GNU General Public License  as published by the Free --
-- Software  Foundation;  either version 3,  or (at your  option) any later --
-- version. This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            --
--                                                                          --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception,   --
-- version 3.1, as published by the Free Software Foundation.               --
--                                                                          --
-- You should have received a copy of the GNU General Public License and    --
-- a copy of the GCC Runtime Library Exception along with this program;     --
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
-- <http://www.gnu.org/licenses/>.                                          --
--                                                                          --
------------------------------------------------------------------------------

--  This package provides a wrapper of the C++ ISO/IEC 14882:1998(E) string
--  class.

with Interfaces.C;
with Interfaces.C.Strings;
with System;

package GNATCOLL.CPP.Strings is
   type CPP_String is limited private;
   --  Defined limited because it has a pointer to the C++ string (to
   --  forbid copying variables that reference the same string).

   function Npos return Interfaces.C.size_t;
   --  Greatest possible value for string indexes.

   procedure Append
     (Str  : in out CPP_String;
      Text : String);
   --  Append Ada-string: Append to Str the conversion of Text into a null-
   --  terminated character sequence.

   procedure Append
     (Str    : in out CPP_String;
      Text   : CPP_String);
   --  Append string: Append to Str the contents of Text.

   procedure Append
     (Str    : in out CPP_String;
      Text   : CPP_String;
      Subpos : Interfaces.C.size_t;
      Sublen : Interfaces.C.size_t);
   --  Append substring: Append to Str a copy of a substring of Text. The
   --  substring is the portion of Text that begins at the character position
   --  subpos and spans sublen characters (or until the end of Text, if either
   --  Text is too short or if sublen is Npos).

   procedure Append
     (Str  : in out CPP_String;
      Text : Interfaces.C.Strings.chars_ptr);
   --  Append C-string: Append to Str the null-terminated character sequence
   --  pointed by Text.

   procedure Append
     (Str  : in out CPP_String;
      Text : Interfaces.C.Strings.chars_ptr;
      N    : Interfaces.C.size_t);
   --  Append buffer: Append to Str a copy of the first n characters of the
   --  array of characters pointed by Text.

   procedure Append
     (Str  : in out CPP_String;
      N    : Interfaces.C.size_t;
      C    : Character);
   --  Append with fill: Append N consecutive copies of character c.

   procedure Assign
     (Str  : in out CPP_String;
      Text : String);
   --  Ada String: Assign to Str the conversion of Text into a null terminated
   --  character sequence.

   procedure Assign
     (Str  : in out CPP_String;
      Text : CPP_String);
   --  C++ String: Assign to Str a copy of the C++ string Text.

   procedure Assign
     (Str  : in out CPP_String;
      Text : Interfaces.C.Strings.chars_ptr);
   --  Assign to Str a copy of the null-terminated character sequence pointed
   --  by Text.

   procedure Assign
     (Str : in out CPP_String;
      C   : Character);
   --  Assign to Str a copy of the character C, replacing its current contents.

   function Capacity (Str : CPP_String) return Interfaces.C.size_t;
   --  Returns the size of the storage space currently allocated for the string
   --  expressed in terms of bytes.

   procedure Clear (Str : in out CPP_String);
   --  Erases the contents of the string, which becomes an empty string.

   function Char_At
     (Str : CPP_String;
      Pos : Interfaces.C.size_t) return Character;
   --  Return the character located at the given Position.

   function Empty (Str : CPP_String) return Boolean;
   --  Returns whether the string is empty (i.e. whether its length is 0).

   procedure Erase
     (Str  : in out CPP_String;
      Pos  : Interfaces.C.size_t := 0;
      Len  : Interfaces.C.size_t := Npos);
   --  Erases the portion of the string value that begins at the character
   --  position pos and spans len characters (or until the end of the string,
   --  if either the content is too short or if len is Npos). Default values
   --  erase all characters in the string (like function Clear).

   procedure Free (Str : in out CPP_String);
   --  Destroys the C++ string object.

   procedure Insert
     (Str  : in out CPP_String;
      Pos  : Interfaces.C.size_t;
      Text : String);
   --  Insert Ada-string: Inserts at the given position the conversion of Text
   --  into a null-terminated character sequence.

   procedure Insert
     (Str  : in out CPP_String;
      Pos  : Interfaces.C.size_t;
      Text : CPP_String);
   --  Insert string: Inserts into Str a copy of Text at the given position.

   procedure Insert
     (Str    : in out CPP_String;
      Pos    : Interfaces.C.size_t;
      Text   : CPP_String;
      Subpos : Interfaces.C.size_t;
      Sublen : Interfaces.C.size_t);
   --  Insert substring: Inserts into Str a copy of a substring of Text. The
   --  substring is the portion of Text that begins at the character position
   --  subpos and spans sublen characters (or until the end of Text, if either
   --  Text is too short or if sublen is Npos).

   procedure Insert
     (Str  : in out CPP_String;
      Pos  : Interfaces.C.size_t;
      Text : Interfaces.C.Strings.chars_ptr);
   --  Insert C-string: Inserts a copy of the null-terminated character
   --  sequence pointed by Text.

   procedure Insert
     (Str  : in out CPP_String;
      Pos  : Interfaces.C.size_t;
      Text : Interfaces.C.Strings.chars_ptr;
      N    : Interfaces.C.size_t);
   --  Insert buffer: Insert into Str a copy of the first N characters of the
   --  array of characters pointed by Text.

   procedure Insert
     (Str  : in out CPP_String;
      Pos  : Interfaces.C.size_t;
      N    : Interfaces.C.size_t;
      C    : Character);
   --  Insert with character fill: Insert N consecutive copies of character C.

   function Length (Str : CPP_String) return Interfaces.C.size_t;
   --  Return the number of actual bytes that conform the contents of the
   --  string, which is not necessarily equal to its storage capacity.

   function Max_Size (Str : CPP_String) return Interfaces.C.size_t;
   --  Return the maximum length the string can reach.

   function New_CPP_String return CPP_String;
   --  Empty string constructor: allocates and initializes an empty string,
   --  with a length of zero characters.

   function New_CPP_String
     (Text : String) return CPP_String;
   --  Ada string copy constructor: allocates a new string and initializes
   --  it copying the conversion of Text into a C null-terminated character
   --  sequence.

   function New_CPP_String
     (Text : CPP_String) return CPP_String;
   --  C++ string copy constructor: allocates a new string and initializes
   --  it copying the contents of Text.

   function New_CPP_String
     (Text : Interfaces.C.Strings.chars_ptr) return CPP_String;
   --  C-String constructor: allocates a new string and initializes it copying
   --  the contents of the null-terminated character sequence pointed by Text.

   function New_CPP_String
     (N : Interfaces.C.size_t;
      C : Character) return CPP_String;
   --  Fill constructor: allocates a new string and initializes it filling the
   --  string with N consecutive copies of character C.

   procedure Pop_Back
     (Str  : in out CPP_String);
   --  Remove last character of Str.

   procedure Push_Back
     (Str  : in out CPP_String;
      C    : Character);
   --  Append character C to the end of Str.

   procedure Replace
     (Str  : in out CPP_String;
      Pos  : Interfaces.C.size_t;
      Len  : Interfaces.C.size_t;
      Text : String);
   --  Replace string: Replaces the portion of the string that begins at
   --  character Pos and spans Len characters by the contents of Text.

   procedure Replace
     (Str  : in out CPP_String;
      Pos  : Interfaces.C.size_t;
      Len  : Interfaces.C.size_t;
      Text : CPP_String);
   --  Replace string (1): Replaces the portion of the string that begins at
   --  character pos and spans len characters by the contents of Text.

   procedure Replace
     (Str    : in out CPP_String;
      Pos    : Interfaces.C.size_t;
      Len    : Interfaces.C.size_t;
      Text   : CPP_String;
      Subpos : Interfaces.C.size_t;
      Sublen : Interfaces.C.size_t);
   --  Replace substring: Replaces the portion of the string that begins at
   --  character Pos and spans Len characters by the contents of Text that
   --  begins at character Subpos and spans Sublen characters.

   procedure Replace
     (Str  : in out CPP_String;
      Pos  : Interfaces.C.size_t;
      Len  : Interfaces.C.size_t;
      Text : Interfaces.C.Strings.chars_ptr);
   --  Replace c-string: Replaces the portion of the string that begins at
   --  character Pos and spans Len characters by the contents of Text.

   procedure Replace
     (Str  : in out CPP_String;
      Pos  : Interfaces.C.size_t;
      Len  : Interfaces.C.size_t;
      Text : Interfaces.C.Strings.chars_ptr;
      N    : Interfaces.C.size_t);
   --  Replace buffer: Replaces the portion of the string that begins at
   --  character Pos and spans Len characters by the contents of the first
   --  N characters of the array of characters pointed by Text.

   procedure Replace
     (Str  : in out CPP_String;
      Pos  : Interfaces.C.size_t;
      Len  : Interfaces.C.size_t;
      N    : Interfaces.C.size_t;
      C    : Character);
   --  Replace with character fill: Replaces the portion of the string that
   --  begins at character Pos by N consecutive copies of character C.

   procedure Reserve
     (Str : in out CPP_String;
      N   : Interfaces.C.size_t := 0);
   --  Requests that the string capacity be adapted to a planned change in size
   --  to a length of up to N characters. If N is greater than the current
   --  string capacity, the function causes the container to increase its
   --  capacity to N characters (or greater); In all other cases, it is taken
   --  as a non-binding request to shrink the string capacity: the container
   --  implementation is free to optimize otherwise and leave the string with
   --  a capacity greater than n.

   procedure Resize
     (Str : in out CPP_String;
      N   : Interfaces.C.size_t);
   --  Resize the string to a length of N characters. If N is smaller than the
   --  current string length, the current value is shortened to its first N
   --  character, removing the characters beyond the Nth. If N is greater than
   --  the current string length, the current content is extended by inserting
   --  at the end as many null characters as needed to reach a size of N.

   procedure Resize
     (Str : in out CPP_String;
      N   : Interfaces.C.size_t;
      C   : Character);
   --  Resize the string to a length of N characters. If N is smaller than the
   --  current string length, the current value is shortened to its first N
   --  character, removing the characters beyond the Nth. If N is greater than
   --  the current string length, the current content is extended by inserting
   --  at the end as many characters C as needed to reach a size of N.

   function Size (Str : CPP_String) return Interfaces.C.size_t;
   --  Return the number of actual bytes that conform the contents of the
   --  string, which is not necessarily equal to its storage capacity.

   procedure Swap
     (Str  : in out CPP_String;
      Text : in out CPP_String);
   --  Exchange the content of the container Str by the content of Text.

   -----------------------
   -- String operations --
   -----------------------

   function C_Str (Str : CPP_String) return Interfaces.C.Strings.chars_ptr;
   --  Return a pointer to an array that contains a null-terminated sequence
   --  of characters (i.e., a C-string) representing the current value of the
   --  string object.

   function Compare
     (Left  : CPP_String;
      Right : CPP_String) return Integer;
   --  Compare the value of the string objects. Returns a signed integral
   --  indicating the relation between the strings:
   --    0: They compare equal
   --   <0: Either the value of the first character that does not match is
   --       lower in the compared string, or all compared characters match
   --       but the compared string is shorter.
   --   >0: Either the value of the first character that does not match is
   --       greater in the compared string, or all compared characters match
   --       but the compared string is longer.

   function Compare
     (Left  : CPP_String;
      Pos   : Interfaces.C.size_t;
      Len   : Interfaces.C.size_t;
      Right : CPP_String) return Integer;
   --  Compare the substring that begins at its character in position Pos and
   --  spans Len characters with the value of string Right.

   function Compare
     (Left   : CPP_String;
      Pos    : Interfaces.C.size_t;
      Len    : Interfaces.C.size_t;
      Right  : CPP_String;
      Subpos : Interfaces.C.size_t;
      Sublen : Interfaces.C.size_t) return Integer;
   --  Compare the substring that begins at its character in position Pos and
   --  spans Len characters with the value of string Right from position Subpos
   --  spanning Sublen chars.

   function Compare
     (Left  : CPP_String;
      Right : Interfaces.C.Strings.chars_ptr) return Integer;
   --  Compare string with null-terminated C string.

   function Compare
     (Left  : CPP_String;
      Pos   : Interfaces.C.size_t;
      Len   : Interfaces.C.size_t;
      Right : Interfaces.C.Strings.chars_ptr) return Integer;
   --  Compare substring with null-terminated C string.

   function Compare
     (Left  : CPP_String;
      Pos   : Interfaces.C.size_t;
      Len   : Interfaces.C.size_t;
      Right : Interfaces.C.Strings.chars_ptr;
      N     : Interfaces.C.size_t) return Integer;
   --  Compare the substring that begins at its character in position Pos and
   --  spans Len characters with the value of string Right. N is the number of
   --  characters to compare.

   procedure Copy
     (From_Str  : CPP_String;
      To_Str    : Interfaces.C.Strings.chars_ptr;
      Len       : Interfaces.C.size_t;
      Pos       : Interfaces.C.size_t;
      Num_Chars : out Interfaces.C.size_t);
   --  Copies a substring of the current value of the string object From_Str
   --  into the C array pointed by To_Str. This substring contains the Len
   --  characters that start at position Pos. The function does not append
   --  a null character at the end of the copied content.

   function Data (Str : CPP_String) return String;
   --  Return the string data.

   function Data (Str : CPP_String) return Interfaces.C.Strings.chars_ptr;
   --  Return the null-terminated character sequence contained in Str.

   function Find
     (Str  : CPP_String;
      Text : CPP_String;
      Pos  : Interfaces.C.size_t := 0) return Interfaces.C.size_t;
   --  Searches in Str for the first occurrence of the sequence Text. Pos is
   --  the position of the first character in Str to be considered in the
   --  search.

   function Find
     (Str  : CPP_String;
      Text : Interfaces.C.Strings.chars_ptr;
      Pos  : Interfaces.C.size_t := 0) return Interfaces.C.size_t;
   --  Searches in Str for the first occurrence of the sequence Text. Pos is
   --  the position of the first character in Str to be considered in the
   --  search.

   function Find
     (Str  : CPP_String;
      Text : Interfaces.C.Strings.chars_ptr;
      Pos  : Interfaces.C.size_t;
      N    : Interfaces.C.size_t) return Interfaces.C.size_t;
   --  Searches in Str for the first occurrence of the sequence Text. Pos is
   --  the position of the first character in Str to be considered in the
   --  search; N is the length of the sequence of characters to match.

   function Find
     (Str  : CPP_String;
      C    : Character;
      Pos  : Interfaces.C.size_t := 0) return Interfaces.C.size_t;
   --  Searches in Str for the first occurrence of character C. Pos is the
   --  position of the first character in Str to be considered in the search.

   function Find_First_Not_Of
     (Str  : CPP_String;
      Text : CPP_String;
      Pos  : Interfaces.C.size_t := 0) return Interfaces.C.size_t;
   --  Searches the string for the first character that does not match any of
   --  the characters specified in Text. When Pos is specified, the search only
   --  includes characters at or after position Pos, ignoring any possible
   --  occurrences before Pos.

   function Find_First_Not_Of
     (Str  : CPP_String;
      Text : Interfaces.C.Strings.chars_ptr;
      Pos  : Interfaces.C.size_t := 0) return Interfaces.C.size_t;
   --  Searches the string for the first character that does not match any of
   --  the characters specified in Text. When Pos is specified, the search only
   --  includes characters at or after position Pos, ignoring any possible
   --  occurrences before Pos.

   function Find_First_Not_Of
     (Str  : CPP_String;
      Text : Interfaces.C.Strings.chars_ptr;
      Pos  : Interfaces.C.size_t;
      N    : Interfaces.C.size_t) return Interfaces.C.size_t;
   --  Searches the string for the first character that does not match any of
   --  the characters specified in Text. When Pos is specified, the search only
   --  includes characters at or after position Pos, ignoring any possible
   --  occurrences before Pos. N is the number of characters to search for.

   function Find_First_Not_Of
     (Str  : CPP_String;
      C    : Character;
      Pos  : Interfaces.C.size_t := 0) return Interfaces.C.size_t;
   --  Searches the string for the first character that does not match C.
   --  When Pos is specified, the search only includes characters at or after
   --  position Pos, ignoring any possible occurrences before Pos.

   function Find_First_Of
     (Str  : CPP_String;
      Text : CPP_String;
      Pos  : Interfaces.C.size_t := 0) return Interfaces.C.size_t;
   --  Searches the string for the first character that matches any of the
   --  characters specified in Text. When Pos is specified, the search only
   --  includes characters at or after position Pos, ignoring any possible
   --  occurrences before Pos.

   function Find_First_Of
     (Str  : CPP_String;
      Text : Interfaces.C.Strings.chars_ptr;
      Pos  : Interfaces.C.size_t := 0) return Interfaces.C.size_t;
   --  Searches the string for the first character that matches any of the
   --  characters specified in Text. When Pos is specified, the search only
   --  includes characters at or after position Pos, ignoring any possible
   --  occurrences before Pos.

   function Find_First_Of
     (Str  : CPP_String;
      Text : Interfaces.C.Strings.chars_ptr;
      Pos  : Interfaces.C.size_t;
      N    : Interfaces.C.size_t) return Interfaces.C.size_t;
   --  Searches the string for the first character that matches any of the
   --  characters specified in Text. When Pos is specified, the search only
   --  includes characters at or after position Pos, ignoring any possible
   --  occurrences before Pos. N is the number of characters to search for.

   function Find_First_Of
     (Str  : CPP_String;
      C    : Character;
      Pos  : Interfaces.C.size_t := 0) return Interfaces.C.size_t;
   --  Searches the string for the first character that matches character C.
   --  When pos is specified, the search only includes characters at or after
   --  position pos, ignoring any possible occurrences before Pos. N is the
   --  number of characters to search for.

   function Find_Last_Not_Of
     (Str  : CPP_String;
      Text : CPP_String;
      Pos  : Interfaces.C.size_t := Npos) return Interfaces.C.size_t;
   --  Searches the string for the last character that does not match any of
   --  the characters specified in Text. When Pos is specified, the search only
   --  includes characters at or before position Pos, ignoring any possible
   --  occurrences after Pos.

   function Find_Last_Not_Of
     (Str  : CPP_String;
      Text : Interfaces.C.Strings.chars_ptr;
      Pos  : Interfaces.C.size_t := Npos) return Interfaces.C.size_t;
   --  Searches the string for the last character that does not match any of
   --  the characters specified in Text. When Pos is specified, the search only
   --  includes characters at or before position Pos, ignoring any possible
   --  occurrences after Pos.

   function Find_Last_Not_Of
     (Str  : CPP_String;
      Text : Interfaces.C.Strings.chars_ptr;
      Pos  : Interfaces.C.size_t;
      N    : Interfaces.C.size_t) return Interfaces.C.size_t;
   --  Searches the string for the last character that does not match any of
   --  the characters specified in Text. When pos is specified, the search only
   --  includes characters at or before position Pos, ignoring any possible
   --  occurrences after Pos. N is the number of characters to search for.

   function Find_Last_Not_Of
     (Str  : CPP_String;
      C    : Character;
      Pos  : Interfaces.C.size_t := Npos) return Interfaces.C.size_t;
   --  Searches the string for the last character that does not match C.
   --  When pos is specified, the search only includes characters at or before
   --  position pos, ignoring any possible occurrences after Pos. N is the
   --  number of characters to search for.

   function Find_Last_Of
     (Str  : CPP_String;
      Text : CPP_String;
      Pos  : Interfaces.C.size_t := Npos) return Interfaces.C.size_t;
   --  Searches the string for the last character that matches any of the
   --  characters specified in Text. When pos is specified, the search only
   --  includes characters at or before position pos, ignoring any possible
   --  occurrences after Pos.

   function Find_Last_Of
     (Str  : CPP_String;
      Text : Interfaces.C.Strings.chars_ptr;
      Pos  : Interfaces.C.size_t := Npos) return Interfaces.C.size_t;
   --  Searches the string for the last character that matches any of the
   --  characters specified in Text. When pos is specified, the search only
   --  includes characters at or before position pos, ignoring any possible
   --  occurrences after Pos.

   function Find_Last_Of
     (Str  : CPP_String;
      Text : Interfaces.C.Strings.chars_ptr;
      Pos  : Interfaces.C.size_t;
      N    : Interfaces.C.size_t) return Interfaces.C.size_t;
   --  Searches the string for the last character that matches any of the
   --  characters specified in Text. When pos is specified, the search only
   --  includes characters at or before position pos, ignoring any possible
   --  occurrences after Pos. N is the number of characters to search for.

   function Find_Last_Of
     (Str  : CPP_String;
      C    : Character;
      Pos  : Interfaces.C.size_t := Npos) return Interfaces.C.size_t;
   --  Searches the string for the last character that matches character C.
   --  When pos is specified, the search only includes characters at or before
   --  position pos, ignoring any possible occurrences after Pos. N is the
   --  number of characters to search for.

   function Reverse_Find
     (Str  : CPP_String;
      Text : CPP_String;
      Pos  : Interfaces.C.size_t := Npos) return Interfaces.C.size_t;
   --  Searches in Str for the last occurrence of the sequence Text. When Pos
   --  is specified, the search only includes sequences of characters that
   --  begin at or before position Pos, ignoring any possible match beginning
   --  after Pos.

   function Reverse_Find
     (Str  : CPP_String;
      Text : Interfaces.C.Strings.chars_ptr;
      Pos  : Interfaces.C.size_t := Npos) return Interfaces.C.size_t;
   --  Searches in Str for the last occurrence of the sequence Text. When Pos
   --  is specified, the search only includes sequences of characters that
   --  begin at or before position Pos, ignoring any possible match beginning
   --  after Pos.

   function Reverse_Find
     (Str  : CPP_String;
      Text : Interfaces.C.Strings.chars_ptr;
      Pos  : Interfaces.C.size_t;
      N    : Interfaces.C.size_t) return Interfaces.C.size_t;
   --  Searches in Str for the last occurrence of the sequence Text. Pos is
   --  the position of the last character in Str to be considered in the
   --  search; N is the length of the sequence of characters to match.

   function Reverse_Find
     (Str  : CPP_String;
      C    : Character;
      Pos  : Interfaces.C.size_t := Npos) return Interfaces.C.size_t;
   --  Searches in Str for the last occurrence of character C. Pos is the
   --  position of the last character in Str to be considered in the search.

   function Substr
     (Str  : CPP_String;
      Pos  : Interfaces.C.size_t := 0;
      Len  : Interfaces.C.size_t := Npos) return CPP_String;
   --  Returns a newly constructed string object with its value initialized to
   --  a copy of a substring of this object.

   --------------------------
   -- Relational Operators --
   --------------------------

   function "="
     (Left  : CPP_String;
      Right : CPP_String) return Boolean;
   function "="
     (Left  : Interfaces.C.Strings.chars_ptr;
      Right : CPP_String) return Boolean;
   function "="
     (Left  : CPP_String;
      Right : Interfaces.C.Strings.chars_ptr) return Boolean;

   function "<"
     (Left  : CPP_String;
      Right : CPP_String) return Boolean;
   function "<"
     (Left  : Interfaces.C.Strings.chars_ptr;
      Right : CPP_String) return Boolean;
   function "<"
     (Left  : CPP_String;
      Right : Interfaces.C.Strings.chars_ptr) return Boolean;

   function "<="
     (Left  : CPP_String;
      Right : CPP_String) return Boolean;
   function "<="
     (Left  : Interfaces.C.Strings.chars_ptr;
      Right : CPP_String) return Boolean;
   function "<="
     (Left : CPP_String;
      Right : Interfaces.C.Strings.chars_ptr) return Boolean;

   function ">"
     (Left  : CPP_String;
      Right : CPP_String) return Boolean;
   function ">"
     (Left  : Interfaces.C.Strings.chars_ptr;
      Right : CPP_String) return Boolean;
   function ">"
     (Left  : CPP_String;
      Right : Interfaces.C.Strings.chars_ptr) return Boolean;

   function ">="
     (Left  : CPP_String;
      Right : CPP_String) return Boolean;
   function ">="
     (Left  : Interfaces.C.Strings.chars_ptr;
      Right : CPP_String) return Boolean;
   function ">="
     (Left  : CPP_String;
      Right : Interfaces.C.Strings.chars_ptr) return Boolean;

private
   type CPP_String is record
      Wrapped_String_Address : System.Address := System.Null_Address;
   end record;
end GNATCOLL.CPP.Strings;