/usr/include/d/gtkd-3/glib/StringG.d is in libgtkd-3-dev 3.7.5-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 | /*
* This file is part of gtkD.
*
* gtkD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* gtkD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
module glib.StringG;
private import glib.Bytes;
private import glib.Str;
private import glib.c.functions;
public import glib.c.types;
public import gtkc.glibtypes;
/**
* The GString struct contains the public fields of a GString.
*/
public class StringG
{
/** the main Gtk struct */
protected GString* gString;
protected bool ownedRef;
/** Get the main Gtk struct */
public GString* getStringGStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gString;
}
/** the main Gtk struct as a void* */
protected void* getStruct()
{
return cast(void*)gString;
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GString* gString, bool ownedRef = false)
{
this.gString = gString;
this.ownedRef = ownedRef;
}
/**
* Adds a string onto the end of a #GString, expanding
* it if necessary.
*
* Params:
* val = the string to append onto the end of @string
*
* Returns: @string
*/
public StringG append(string val)
{
auto p = g_string_append(gString, Str.toStringz(val));
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Adds a byte onto the end of a #GString, expanding
* it if necessary.
*
* Params:
* c = the byte to append onto the end of @string
*
* Returns: @string
*/
public StringG appendC(char c)
{
auto p = g_string_append_c(gString, c);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Appends @len bytes of @val to @string. Because @len is
* provided, @val may contain embedded nuls and need not
* be nul-terminated.
*
* Since this function does not stop at nul bytes, it is
* the caller's responsibility to ensure that @val has at
* least @len addressable bytes.
*
* Params:
* val = bytes to append
* len = number of bytes of @val to use
*
* Returns: @string
*/
public StringG appendLen(string val, ptrdiff_t len)
{
auto p = g_string_append_len(gString, Str.toStringz(val), len);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Converts a Unicode character into UTF-8, and appends it
* to the string.
*
* Params:
* wc = a Unicode character
*
* Returns: @string
*/
public StringG appendUnichar(dchar wc)
{
auto p = g_string_append_unichar(gString, wc);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Appends @unescaped to @string, escaped any characters that
* are reserved in URIs using URI-style escape sequences.
*
* Params:
* unescaped = a string
* reservedCharsAllowed = a string of reserved characters allowed
* to be used, or %NULL
* allowUtf8 = set %TRUE if the escaped string may include UTF8 characters
*
* Returns: @string
*
* Since: 2.16
*/
public StringG appendUriEscaped(string unescaped, string reservedCharsAllowed, bool allowUtf8)
{
auto p = g_string_append_uri_escaped(gString, Str.toStringz(unescaped), Str.toStringz(reservedCharsAllowed), allowUtf8);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Appends a formatted string onto the end of a #GString.
* This function is similar to g_string_append_printf()
* except that the arguments to the format string are passed
* as a va_list.
*
* Params:
* format = the string format. See the printf() documentation
* args = the list of arguments to insert in the output
*
* Since: 2.14
*/
public void appendVprintf(string format, void* args)
{
g_string_append_vprintf(gString, Str.toStringz(format), args);
}
/**
* Converts all uppercase ASCII letters to lowercase ASCII letters.
*
* Returns: passed-in @string pointer, with all the
* uppercase characters converted to lowercase in place,
* with semantics that exactly match g_ascii_tolower().
*/
public StringG asciiDown()
{
auto p = g_string_ascii_down(gString);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Converts all lowercase ASCII letters to uppercase ASCII letters.
*
* Returns: passed-in @string pointer, with all the
* lowercase characters converted to uppercase in place,
* with semantics that exactly match g_ascii_toupper().
*/
public StringG asciiUp()
{
auto p = g_string_ascii_up(gString);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Copies the bytes from a string into a #GString,
* destroying any previous contents. It is rather like
* the standard strcpy() function, except that you do not
* have to worry about having enough space to copy the string.
*
* Params:
* rval = the string to copy into @string
*
* Returns: @string
*/
public StringG assign(string rval)
{
auto p = g_string_assign(gString, Str.toStringz(rval));
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Converts a #GString to lowercase.
*
* Deprecated: This function uses the locale-specific
* tolower() function, which is almost never the right thing.
* Use g_string_ascii_down() or g_utf8_strdown() instead.
*
* Returns: the #GString
*/
public StringG down()
{
auto p = g_string_down(gString);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Compares two strings for equality, returning %TRUE if they are equal.
* For use with #GHashTable.
*
* Params:
* v2 = another #GString
*
* Returns: %TRUE if the strings are the same length and contain the
* same bytes
*/
public bool equal(StringG v2)
{
return g_string_equal(gString, (v2 is null) ? null : v2.getStringGStruct()) != 0;
}
/**
* Removes @len bytes from a #GString, starting at position @pos.
* The rest of the #GString is shifted down to fill the gap.
*
* Params:
* pos = the position of the content to remove
* len = the number of bytes to remove, or -1 to remove all
* following bytes
*
* Returns: @string
*/
public StringG erase(ptrdiff_t pos, ptrdiff_t len)
{
auto p = g_string_erase(gString, pos, len);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Frees the memory allocated for the #GString.
* If @free_segment is %TRUE it also frees the character data. If
* it's %FALSE, the caller gains ownership of the buffer and must
* free it after use with g_free().
*
* Params:
* freeSegment = if %TRUE, the actual character data is freed as well
*
* Returns: the character data of @string
* (i.e. %NULL if @free_segment is %TRUE)
*/
public string free(bool freeSegment)
{
auto retStr = g_string_free(gString, freeSegment);
scope(exit) Str.freeString(retStr);
return Str.toString(retStr);
}
/**
* Transfers ownership of the contents of @string to a newly allocated
* #GBytes. The #GString structure itself is deallocated, and it is
* therefore invalid to use @string after invoking this function.
*
* Note that while #GString ensures that its buffer always has a
* trailing nul character (not reflected in its "len"), the returned
* #GBytes does not include this extra nul; i.e. it has length exactly
* equal to the "len" member.
*
* Returns: A newly allocated #GBytes containing contents of @string; @string itself is freed
*
* Since: 2.34
*/
public Bytes freeToBytes()
{
auto p = g_string_free_to_bytes(gString);
if(p is null)
{
return null;
}
return new Bytes(cast(GBytes*) p, true);
}
/**
* Creates a hash code for @str; for use with #GHashTable.
*
* Returns: hash code for @str
*/
public uint hash()
{
return g_string_hash(gString);
}
/**
* Inserts a copy of a string into a #GString,
* expanding it if necessary.
*
* Params:
* pos = the position to insert the copy of the string
* val = the string to insert
*
* Returns: @string
*/
public StringG insert(ptrdiff_t pos, string val)
{
auto p = g_string_insert(gString, pos, Str.toStringz(val));
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Inserts a byte into a #GString, expanding it if necessary.
*
* Params:
* pos = the position to insert the byte
* c = the byte to insert
*
* Returns: @string
*/
public StringG insertC(ptrdiff_t pos, char c)
{
auto p = g_string_insert_c(gString, pos, c);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Inserts @len bytes of @val into @string at @pos.
* Because @len is provided, @val may contain embedded
* nuls and need not be nul-terminated. If @pos is -1,
* bytes are inserted at the end of the string.
*
* Since this function does not stop at nul bytes, it is
* the caller's responsibility to ensure that @val has at
* least @len addressable bytes.
*
* Params:
* pos = position in @string where insertion should
* happen, or -1 for at the end
* val = bytes to insert
* len = number of bytes of @val to insert
*
* Returns: @string
*/
public StringG insertLen(ptrdiff_t pos, string val, ptrdiff_t len)
{
auto p = g_string_insert_len(gString, pos, Str.toStringz(val), len);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Converts a Unicode character into UTF-8, and insert it
* into the string at the given position.
*
* Params:
* pos = the position at which to insert character, or -1
* to append at the end of the string
* wc = a Unicode character
*
* Returns: @string
*/
public StringG insertUnichar(ptrdiff_t pos, dchar wc)
{
auto p = g_string_insert_unichar(gString, pos, wc);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Overwrites part of a string, lengthening it if necessary.
*
* Params:
* pos = the position at which to start overwriting
* val = the string that will overwrite the @string starting at @pos
*
* Returns: @string
*
* Since: 2.14
*/
public StringG overwrite(size_t pos, string val)
{
auto p = g_string_overwrite(gString, pos, Str.toStringz(val));
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Overwrites part of a string, lengthening it if necessary.
* This function will work with embedded nuls.
*
* Params:
* pos = the position at which to start overwriting
* val = the string that will overwrite the @string starting at @pos
* len = the number of bytes to write from @val
*
* Returns: @string
*
* Since: 2.14
*/
public StringG overwriteLen(size_t pos, string val, ptrdiff_t len)
{
auto p = g_string_overwrite_len(gString, pos, Str.toStringz(val), len);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Adds a string on to the start of a #GString,
* expanding it if necessary.
*
* Params:
* val = the string to prepend on the start of @string
*
* Returns: @string
*/
public StringG prepend(string val)
{
auto p = g_string_prepend(gString, Str.toStringz(val));
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Adds a byte onto the start of a #GString,
* expanding it if necessary.
*
* Params:
* c = the byte to prepend on the start of the #GString
*
* Returns: @string
*/
public StringG prependC(char c)
{
auto p = g_string_prepend_c(gString, c);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Prepends @len bytes of @val to @string.
* Because @len is provided, @val may contain
* embedded nuls and need not be nul-terminated.
*
* Since this function does not stop at nul bytes,
* it is the caller's responsibility to ensure that
* @val has at least @len addressable bytes.
*
* Params:
* val = bytes to prepend
* len = number of bytes in @val to prepend
*
* Returns: @string
*/
public StringG prependLen(string val, ptrdiff_t len)
{
auto p = g_string_prepend_len(gString, Str.toStringz(val), len);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Converts a Unicode character into UTF-8, and prepends it
* to the string.
*
* Params:
* wc = a Unicode character
*
* Returns: @string
*/
public StringG prependUnichar(dchar wc)
{
auto p = g_string_prepend_unichar(gString, wc);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Sets the length of a #GString. If the length is less than
* the current length, the string will be truncated. If the
* length is greater than the current length, the contents
* of the newly added area are undefined. (However, as
* always, string->str[string->len] will be a nul byte.)
*
* Params:
* len = the new length
*
* Returns: @string
*/
public StringG setSize(size_t len)
{
auto p = g_string_set_size(gString, len);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Cuts off the end of the GString, leaving the first @len bytes.
*
* Params:
* len = the new size of @string
*
* Returns: @string
*/
public StringG truncate(size_t len)
{
auto p = g_string_truncate(gString, len);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Converts a #GString to uppercase.
*
* Deprecated: This function uses the locale-specific
* toupper() function, which is almost never the right thing.
* Use g_string_ascii_up() or g_utf8_strup() instead.
*
* Returns: @string
*/
public StringG up()
{
auto p = g_string_up(gString);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p);
}
/**
* Writes a formatted string into a #GString.
* This function is similar to g_string_printf() except that
* the arguments to the format string are passed as a va_list.
*
* Params:
* format = the string format. See the printf() documentation
* args = the parameters to insert into the format string
*
* Since: 2.14
*/
public void vprintf(string format, void* args)
{
g_string_vprintf(gString, Str.toStringz(format), args);
}
/**
* Creates a new #GString, initialized with the given string.
*
* Params:
* init = the initial text to copy into the string, or %NULL to
* start with an empty string
*
* Returns: the new #GString
*/
public static StringG stringNew(string init)
{
auto p = g_string_new(Str.toStringz(init));
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p, true);
}
/**
* Creates a new #GString with @len bytes of the @init buffer.
* Because a length is provided, @init need not be nul-terminated,
* and can contain embedded nul bytes.
*
* Since this function does not stop at nul bytes, it is the caller's
* responsibility to ensure that @init has at least @len addressable
* bytes.
*
* Params:
* init = initial contents of the string
* len = length of @init to use
*
* Returns: a new #GString
*/
public static StringG stringNewLen(string init, ptrdiff_t len)
{
auto p = g_string_new_len(Str.toStringz(init), len);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p, true);
}
/**
* Creates a new #GString, with enough space for @dfl_size
* bytes. This is useful if you are going to add a lot of
* text to the string and don't want it to be reallocated
* too often.
*
* Params:
* dflSize = the default size of the space allocated to
* hold the string
*
* Returns: the new #GString
*/
public static StringG stringSizedNew(size_t dflSize)
{
auto p = g_string_sized_new(dflSize);
if(p is null)
{
return null;
}
return new StringG(cast(GString*) p, true);
}
}
|