1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 /* 25 * Conversion parameters: 26 * inFile = glib-Sequences.html 27 * outPack = glib 28 * outFile = Sequence 29 * strct = GSequence 30 * realStrct= 31 * ctorStrct= 32 * clss = Sequence 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - g_sequence_ 41 * omit structs: 42 * omit prefixes: 43 * - g_sequence_iter_ 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.SequenceIter 48 * structWrap: 49 * - GSequence* -> Sequence 50 * - GSequenceIter* -> SequenceIter 51 * module aliases: 52 * local aliases: 53 * overrides: 54 */ 55 56 module glib.Sequence; 57 58 public import gtkc.glibtypes; 59 60 private import gtkc.glib; 61 private import glib.ConstructionException; 62 63 64 private import glib.SequenceIter; 65 66 67 68 69 /** 70 * The GSequence data structure has the API of a list, but is 71 * implemented internally with a balanced binary tree. This means that 72 * it is possible to maintain a sorted list of n elements in time O(n 73 * log n). The data contained in each element can be either integer 74 * values, by using of the Type Conversion Macros, 75 * or simply pointers to any type of data. 76 * 77 * A GSequence is accessed through iterators, 78 * represented by a GSequenceIter. An iterator represents a position 79 * between two elements of the sequence. For example, the 80 * begin iterator represents the gap immediately 81 * before the first element of the sequence, and the 82 * end iterator represents the gap immediately 83 * after the last element. In an empty sequence, the begin and end 84 * iterators are the same. 85 * 86 * Some methods on GSequence operate on ranges of items. For example 87 * g_sequence_foreach_range() will call a user-specified function on 88 * each element with the given range. The range is delimited by the 89 * gaps represented by the passed-in iterators, so if you pass in the 90 * begin and end iterators, the range in question is the entire 91 * sequence. 92 * 93 * The function g_sequence_get() is used with an iterator to access the 94 * element immediately following the gap that the iterator represents. 95 * The iterator is said to point to that element. 96 * 97 * Iterators are stable across most operations on a GSequence. For 98 * example an iterator pointing to some element of a sequence will 99 * continue to point to that element even after the sequence is sorted. 100 * Even moving an element to another sequence using for example 101 * g_sequence_move_range() will not invalidate the iterators pointing 102 * to it. The only operation that will invalidate an iterator is when 103 * the element it points to is removed from any sequence. 104 */ 105 public class Sequence 106 { 107 108 /** the main Gtk struct */ 109 protected GSequence* gSequence; 110 111 112 public GSequence* getSequenceStruct() 113 { 114 return gSequence; 115 } 116 117 118 /** the main Gtk struct as a void* */ 119 protected void* getStruct() 120 { 121 return cast(void*)gSequence; 122 } 123 124 /** 125 * Sets our main struct and passes it to the parent class 126 */ 127 public this (GSequence* gSequence) 128 { 129 this.gSequence = gSequence; 130 } 131 132 /** 133 */ 134 135 /** 136 * Creates a new GSequence. The data_destroy function, if non-NULL will 137 * be called on all items when the sequence is destroyed and on items that 138 * are removed from the sequence. 139 * Since 2.14 140 * Params: 141 * dataDestroy = a GDestroyNotify function, or NULL. [allow-none] 142 * Throws: ConstructionException GTK+ fails to create the object. 143 */ 144 public this (GDestroyNotify dataDestroy) 145 { 146 // GSequence * g_sequence_new (GDestroyNotify data_destroy); 147 auto p = g_sequence_new(dataDestroy); 148 if(p is null) 149 { 150 throw new ConstructionException("null returned by g_sequence_new(dataDestroy)"); 151 } 152 this(cast(GSequence*) p); 153 } 154 155 /** 156 * Frees the memory allocated for seq. If seq has a data destroy 157 * function associated with it, that function is called on all items in 158 * seq. 159 * Since 2.14 160 */ 161 public void free() 162 { 163 // void g_sequence_free (GSequence *seq); 164 g_sequence_free(gSequence); 165 } 166 167 /** 168 * Returns the length of seq 169 * Since 2.14 170 * Returns: the length of seq 171 */ 172 public int getLength() 173 { 174 // gint g_sequence_get_length (GSequence *seq); 175 return g_sequence_get_length(gSequence); 176 } 177 178 /** 179 * Calls func for each item in the sequence passing user_data 180 * to the function. 181 * Since 2.14 182 * Params: 183 * func = the function to call for each item in seq 184 * userData = user data passed to func 185 */ 186 public void foreac(GFunc func, void* userData) 187 { 188 // void g_sequence_foreach (GSequence *seq, GFunc func, gpointer user_data); 189 g_sequence_foreach(gSequence, func, userData); 190 } 191 192 /** 193 * Calls func for each item in the range (begin, end) passing 194 * user_data to the function. 195 * Since 2.14 196 * Params: 197 * begin = a GSequenceIter 198 * end = a GSequenceIter 199 * func = a GFunc 200 * userData = user data passed to func 201 */ 202 public static void foreachRange(SequenceIter begin, SequenceIter end, GFunc func, void* userData) 203 { 204 // void g_sequence_foreach_range (GSequenceIter *begin, GSequenceIter *end, GFunc func, gpointer user_data); 205 g_sequence_foreach_range((begin is null) ? null : begin.getSequenceIterStruct(), (end is null) ? null : end.getSequenceIterStruct(), func, userData); 206 } 207 208 /** 209 * Sorts seq using cmp_func. 210 * cmp_func is passed two items of seq and should 211 * return 0 if they are equal, a negative value if the 212 * first comes before the second, and a positive value 213 * if the second comes before the first. 214 * Since 2.14 215 * Params: 216 * cmpFunc = the function used to sort the sequence 217 * cmpData = user data passed to cmp_func 218 */ 219 public void sort(GCompareDataFunc cmpFunc, void* cmpData) 220 { 221 // void g_sequence_sort (GSequence *seq, GCompareDataFunc cmp_func, gpointer cmp_data); 222 g_sequence_sort(gSequence, cmpFunc, cmpData); 223 } 224 225 /** 226 * Like g_sequence_sort(), but uses a GSequenceIterCompareFunc instead 227 * of a GCompareDataFunc as the compare function 228 * cmp_func is called with two iterators pointing into seq. It should 229 * return 0 if the iterators are equal, a negative value if the first 230 * iterator comes before the second, and a positive value if the second 231 * iterator comes before the first. 232 * Since 2.14 233 * Params: 234 * cmpFunc = the function used to compare iterators in the sequence 235 * cmpData = user data passed to cmp_func 236 */ 237 public void sortIter(GSequenceIterCompareFunc cmpFunc, void* cmpData) 238 { 239 // void g_sequence_sort_iter (GSequence *seq, GSequenceIterCompareFunc cmp_func, gpointer cmp_data); 240 g_sequence_sort_iter(gSequence, cmpFunc, cmpData); 241 } 242 243 /** 244 * Returns the begin iterator for seq. 245 * Since 2.14 246 * Returns: the begin iterator for seq. 247 */ 248 public SequenceIter getBeginIter() 249 { 250 // GSequenceIter * g_sequence_get_begin_iter (GSequence *seq); 251 auto p = g_sequence_get_begin_iter(gSequence); 252 253 if(p is null) 254 { 255 return null; 256 } 257 258 return new SequenceIter(cast(GSequenceIter*) p); 259 } 260 261 /** 262 * Returns the end iterator for seg 263 * Since 2.14 264 * Returns: the end iterator for seq 265 */ 266 public SequenceIter getEndIter() 267 { 268 // GSequenceIter * g_sequence_get_end_iter (GSequence *seq); 269 auto p = g_sequence_get_end_iter(gSequence); 270 271 if(p is null) 272 { 273 return null; 274 } 275 276 return new SequenceIter(cast(GSequenceIter*) p); 277 } 278 279 /** 280 * Returns the iterator at position pos. If pos is negative or larger 281 * than the number of items in seq, the end iterator is returned. 282 * Since 2.14 283 * Params: 284 * pos = a position in seq, or -1 for the end. 285 * Returns: The GSequenceIter at position pos 286 */ 287 public SequenceIter getIterAtPos(int pos) 288 { 289 // GSequenceIter * g_sequence_get_iter_at_pos (GSequence *seq, gint pos); 290 auto p = g_sequence_get_iter_at_pos(gSequence, pos); 291 292 if(p is null) 293 { 294 return null; 295 } 296 297 return new SequenceIter(cast(GSequenceIter*) p); 298 } 299 300 /** 301 * Adds a new item to the end of seq. 302 * Since 2.14 303 * Params: 304 * data = the data for the new item 305 * Returns: an iterator pointing to the new item 306 */ 307 public SequenceIter append(void* data) 308 { 309 // GSequenceIter * g_sequence_append (GSequence *seq, gpointer data); 310 auto p = g_sequence_append(gSequence, data); 311 312 if(p is null) 313 { 314 return null; 315 } 316 317 return new SequenceIter(cast(GSequenceIter*) p); 318 } 319 320 /** 321 * Adds a new item to the front of seq 322 * Since 2.14 323 * Params: 324 * data = the data for the new item 325 * Returns: an iterator pointing to the new item 326 */ 327 public SequenceIter prepend(void* data) 328 { 329 // GSequenceIter * g_sequence_prepend (GSequence *seq, gpointer data); 330 auto p = g_sequence_prepend(gSequence, data); 331 332 if(p is null) 333 { 334 return null; 335 } 336 337 return new SequenceIter(cast(GSequenceIter*) p); 338 } 339 340 /** 341 * Inserts a new item just before the item pointed to by iter. 342 * Since 2.14 343 * Params: 344 * iter = a GSequenceIter 345 * data = the data for the new item 346 * Returns: an iterator pointing to the new item 347 */ 348 public static SequenceIter insertBefore(SequenceIter iter, void* data) 349 { 350 // GSequenceIter * g_sequence_insert_before (GSequenceIter *iter, gpointer data); 351 auto p = g_sequence_insert_before((iter is null) ? null : iter.getSequenceIterStruct(), data); 352 353 if(p is null) 354 { 355 return null; 356 } 357 358 return new SequenceIter(cast(GSequenceIter*) p); 359 } 360 361 /** 362 * Moves the item pointed to by src to the position indicated by dest. 363 * After calling this function dest will point to the position immediately 364 * after src. It is allowed for src and dest to point into different 365 * sequences. 366 * Since 2.14 367 * Params: 368 * src = a GSequenceIter pointing to the item to move 369 * dest = a GSequenceIter pointing to the position to which 370 * the item is moved. 371 */ 372 public static void move(SequenceIter src, SequenceIter dest) 373 { 374 // void g_sequence_move (GSequenceIter *src, GSequenceIter *dest); 375 g_sequence_move((src is null) ? null : src.getSequenceIterStruct(), (dest is null) ? null : dest.getSequenceIterStruct()); 376 } 377 378 /** 379 * Swaps the items pointed to by a and b. It is allowed for a and b 380 * to point into difference sequences. 381 * Since 2.14 382 * Params: 383 * a = a GSequenceIter 384 * b = a GSequenceIter 385 */ 386 public static void swap(SequenceIter a, SequenceIter b) 387 { 388 // void g_sequence_swap (GSequenceIter *a, GSequenceIter *b); 389 g_sequence_swap((a is null) ? null : a.getSequenceIterStruct(), (b is null) ? null : b.getSequenceIterStruct()); 390 } 391 392 /** 393 * Inserts data into sequence using func to determine the new 394 * position. The sequence must already be sorted according to cmp_func; 395 * otherwise the new position of data is undefined. 396 * cmp_func is called with two items of the seq and user_data. 397 * It should return 0 if the items are equal, a negative value 398 * if the first item comes before the second, and a positive value 399 * if the second item comes before the first. 400 * Since 2.14 401 * Params: 402 * data = the data to insert 403 * cmpFunc = the function used to compare items in the sequence 404 * cmpData = user data passed to cmp_func. 405 * Returns: a GSequenceIter pointing to the new item. 406 */ 407 public SequenceIter insertSorted(void* data, GCompareDataFunc cmpFunc, void* cmpData) 408 { 409 // GSequenceIter * g_sequence_insert_sorted (GSequence *seq, gpointer data, GCompareDataFunc cmp_func, gpointer cmp_data); 410 auto p = g_sequence_insert_sorted(gSequence, data, cmpFunc, cmpData); 411 412 if(p is null) 413 { 414 return null; 415 } 416 417 return new SequenceIter(cast(GSequenceIter*) p); 418 } 419 420 /** 421 * Like g_sequence_insert_sorted(), but uses 422 * a GSequenceIterCompareFunc instead of a GCompareDataFunc as 423 * the compare function. 424 * iter_cmp is called with two iterators pointing into seq. 425 * It should return 0 if the iterators are equal, a negative 426 * value if the first iterator comes before the second, and a 427 * positive value if the second iterator comes before the first. 428 * It is called with two iterators pointing into seq. It should 429 * return 0 if the iterators are equal, a negative value if the 430 * first iterator comes before the second, and a positive value 431 * if the second iterator comes before the first. 432 * Since 2.14 433 * Params: 434 * data = data for the new item 435 * iterCmp = the function used to compare iterators in the sequence 436 * cmpData = user data passed to cmp_func 437 * Returns: a GSequenceIter pointing to the new item 438 */ 439 public SequenceIter insertSortedIter(void* data, GSequenceIterCompareFunc iterCmp, void* cmpData) 440 { 441 // GSequenceIter * g_sequence_insert_sorted_iter (GSequence *seq, gpointer data, GSequenceIterCompareFunc iter_cmp, gpointer cmp_data); 442 auto p = g_sequence_insert_sorted_iter(gSequence, data, iterCmp, cmpData); 443 444 if(p is null) 445 { 446 return null; 447 } 448 449 return new SequenceIter(cast(GSequenceIter*) p); 450 } 451 452 /** 453 * Moves the data pointed to a new position as indicated by cmp_func. This 454 * function should be called for items in a sequence already sorted according 455 * to cmp_func whenever some aspect of an item changes so that cmp_func 456 * may return different values for that item. 457 * cmp_func is called with two items of the seq and user_data. 458 * It should return 0 if the items are equal, a negative value if 459 * the first item comes before the second, and a positive value if 460 * the second item comes before the first. 461 * Since 2.14 462 * Params: 463 * iter = A GSequenceIter 464 * cmpFunc = the function used to compare items in the sequence 465 * cmpData = user data passed to cmp_func. 466 */ 467 public static void sortChanged(SequenceIter iter, GCompareDataFunc cmpFunc, void* cmpData) 468 { 469 // void g_sequence_sort_changed (GSequenceIter *iter, GCompareDataFunc cmp_func, gpointer cmp_data); 470 g_sequence_sort_changed((iter is null) ? null : iter.getSequenceIterStruct(), cmpFunc, cmpData); 471 } 472 473 /** 474 * Like g_sequence_sort_changed(), but uses 475 * a GSequenceIterCompareFunc instead of a GCompareDataFunc as 476 * the compare function. 477 * iter_cmp is called with two iterators pointing into seq. It should 478 * return 0 if the iterators are equal, a negative value if the first 479 * iterator comes before the second, and a positive value if the second 480 * iterator comes before the first. 481 * Since 2.14 482 * Params: 483 * iter = a GSequenceIter 484 * iterCmp = the function used to compare iterators in the sequence 485 * cmpData = user data passed to cmp_func 486 */ 487 public static void sortChangedIter(SequenceIter iter, GSequenceIterCompareFunc iterCmp, void* cmpData) 488 { 489 // void g_sequence_sort_changed_iter (GSequenceIter *iter, GSequenceIterCompareFunc iter_cmp, gpointer cmp_data); 490 g_sequence_sort_changed_iter((iter is null) ? null : iter.getSequenceIterStruct(), iterCmp, cmpData); 491 } 492 493 /** 494 * Removes the item pointed to by iter. It is an error to pass the 495 * end iterator to this function. 496 * If the sequence has a data destroy function associated with it, this 497 * function is called on the data for the removed item. 498 * Since 2.14 499 * Params: 500 * iter = a GSequenceIter 501 */ 502 public static void remove(SequenceIter iter) 503 { 504 // void g_sequence_remove (GSequenceIter *iter); 505 g_sequence_remove((iter is null) ? null : iter.getSequenceIterStruct()); 506 } 507 508 /** 509 * Removes all items in the (begin, end) range. 510 * If the sequence has a data destroy function associated with it, this 511 * function is called on the data for the removed items. 512 * Since 2.14 513 * Params: 514 * begin = a GSequenceIter 515 * end = a GSequenceIter 516 */ 517 public static void removeRange(SequenceIter begin, SequenceIter end) 518 { 519 // void g_sequence_remove_range (GSequenceIter *begin, GSequenceIter *end); 520 g_sequence_remove_range((begin is null) ? null : begin.getSequenceIterStruct(), (end is null) ? null : end.getSequenceIterStruct()); 521 } 522 523 /** 524 * Inserts the (begin, end) range at the destination pointed to by ptr. 525 * The begin and end iters must point into the same sequence. It is 526 * allowed for dest to point to a different sequence than the one pointed 527 * into by begin and end. 528 * If dest is NULL, the range indicated by begin and end is 529 * removed from the sequence. If dest iter points to a place within 530 * the (begin, end) range, the range does not move. 531 * Since 2.14 532 * Params: 533 * dest = a GSequenceIter 534 * begin = a GSequenceIter 535 * end = a GSequenceIter 536 */ 537 public static void moveRange(SequenceIter dest, SequenceIter begin, SequenceIter end) 538 { 539 // void g_sequence_move_range (GSequenceIter *dest, GSequenceIter *begin, GSequenceIter *end); 540 g_sequence_move_range((dest is null) ? null : dest.getSequenceIterStruct(), (begin is null) ? null : begin.getSequenceIterStruct(), (end is null) ? null : end.getSequenceIterStruct()); 541 } 542 543 /** 544 * Returns an iterator pointing to the position where data would 545 * be inserted according to cmp_func and cmp_data. 546 * cmp_func is called with two items of the seq and user_data. 547 * It should return 0 if the items are equal, a negative value if 548 * the first item comes before the second, and a positive value if 549 * the second item comes before the first. 550 * If you are simply searching for an existing element of the sequence, 551 * consider using g_sequence_lookup(). 552 * Note 553 * This function will fail if the data contained in the sequence is 554 * unsorted. Use g_sequence_insert_sorted() or 555 * g_sequence_insert_sorted_iter() to add data to your sequence or, if 556 * you want to add a large amount of data, call g_sequence_sort() after 557 * doing unsorted insertions. 558 * Since 2.14 559 * Params: 560 * data = data for the new item 561 * cmpFunc = the function used to compare items in the sequence 562 * cmpData = user data passed to cmp_func. 563 * Returns: an GSequenceIter pointing to the position where data would have been inserted according to cmp_func and cmp_data. 564 */ 565 public SequenceIter search(void* data, GCompareDataFunc cmpFunc, void* cmpData) 566 { 567 // GSequenceIter * g_sequence_search (GSequence *seq, gpointer data, GCompareDataFunc cmp_func, gpointer cmp_data); 568 auto p = g_sequence_search(gSequence, data, cmpFunc, cmpData); 569 570 if(p is null) 571 { 572 return null; 573 } 574 575 return new SequenceIter(cast(GSequenceIter*) p); 576 } 577 578 /** 579 * Like g_sequence_search(), but uses a GSequenceIterCompareFunc 580 * instead of a GCompareDataFunc as the compare function. 581 * iter_cmp is called with two iterators pointing into seq. 582 * It should return 0 if the iterators are equal, a negative value 583 * if the first iterator comes before the second, and a positive 584 * value if the second iterator comes before the first. 585 * If you are simply searching for an existing element of the sequence, 586 * consider using g_sequence_lookup_iter(). 587 * Note 588 * This function will fail if the data contained in the sequence is 589 * unsorted. Use g_sequence_insert_sorted() or 590 * g_sequence_insert_sorted_iter() to add data to your sequence or, if 591 * you want to add a large amount of data, call g_sequence_sort() after 592 * doing unsorted insertions. 593 * Since 2.14 594 * Params: 595 * data = data for the new item 596 * iterCmp = the function used to compare iterators in the sequence 597 * cmpData = user data passed to iter_cmp 598 * Returns: a GSequenceIter pointing to the position in seq where data would have been inserted according to iter_cmp and cmp_data. 599 */ 600 public SequenceIter searchIter(void* data, GSequenceIterCompareFunc iterCmp, void* cmpData) 601 { 602 // GSequenceIter * g_sequence_search_iter (GSequence *seq, gpointer data, GSequenceIterCompareFunc iter_cmp, gpointer cmp_data); 603 auto p = g_sequence_search_iter(gSequence, data, iterCmp, cmpData); 604 605 if(p is null) 606 { 607 return null; 608 } 609 610 return new SequenceIter(cast(GSequenceIter*) p); 611 } 612 613 /** 614 * Returns an iterator pointing to the position of the first item found 615 * equal to data according to cmp_func and cmp_data. If more than one 616 * item is equal, it is not guaranteed that it is the first which is 617 * returned. In that case, you can use g_sequence_iter_next() and 618 * g_sequence_iter_prev() to get others. 619 * cmp_func is called with two items of the seq and user_data. 620 * It should return 0 if the items are equal, a negative value if 621 * the first item comes before the second, and a positive value if 622 * the second item comes before the first. 623 * Note 624 * This function will fail if the data contained in the sequence is 625 * unsorted. Use g_sequence_insert_sorted() or 626 * g_sequence_insert_sorted_iter() to add data to your sequence or, if 627 * you want to add a large amount of data, call g_sequence_sort() after 628 * doing unsorted insertions. 629 * Since 2.28 630 * Params: 631 * data = data to lookup 632 * cmpFunc = the function used to compare items in the sequence 633 * cmpData = user data passed to cmp_func. 634 * Returns: an GSequenceIter pointing to the position of the first item found equal to data according to cmp_func and cmp_data, or NULL if no such item exists. 635 */ 636 public SequenceIter lookup(void* data, GCompareDataFunc cmpFunc, void* cmpData) 637 { 638 // GSequenceIter * g_sequence_lookup (GSequence *seq, gpointer data, GCompareDataFunc cmp_func, gpointer cmp_data); 639 auto p = g_sequence_lookup(gSequence, data, cmpFunc, cmpData); 640 641 if(p is null) 642 { 643 return null; 644 } 645 646 return new SequenceIter(cast(GSequenceIter*) p); 647 } 648 649 /** 650 * Like g_sequence_lookup(), but uses a GSequenceIterCompareFunc 651 * instead of a GCompareDataFunc as the compare function. 652 * iter_cmp is called with two iterators pointing into seq. 653 * It should return 0 if the iterators are equal, a negative value 654 * if the first iterator comes before the second, and a positive 655 * value if the second iterator comes before the first. 656 * Note 657 * This function will fail if the data contained in the sequence is 658 * unsorted. Use g_sequence_insert_sorted() or 659 * g_sequence_insert_sorted_iter() to add data to your sequence or, if 660 * you want to add a large amount of data, call g_sequence_sort() after 661 * doing unsorted insertions. 662 * Since 2.28 663 * Params: 664 * data = data to lookup 665 * iterCmp = the function used to compare iterators in the sequence 666 * cmpData = user data passed to iter_cmp 667 * Returns: an GSequenceIter pointing to the position of the first item found equal to data according to cmp_func and cmp_data, or NULL if no such item exists. 668 */ 669 public SequenceIter lookupIter(void* data, GSequenceIterCompareFunc iterCmp, void* cmpData) 670 { 671 // GSequenceIter * g_sequence_lookup_iter (GSequence *seq, gpointer data, GSequenceIterCompareFunc iter_cmp, gpointer cmp_data); 672 auto p = g_sequence_lookup_iter(gSequence, data, iterCmp, cmpData); 673 674 if(p is null) 675 { 676 return null; 677 } 678 679 return new SequenceIter(cast(GSequenceIter*) p); 680 } 681 682 /** 683 * Returns the data that iter points to. 684 * Since 2.14 685 * Params: 686 * iter = a GSequenceIter 687 * Returns: the data that iter points to 688 */ 689 public static void* get(SequenceIter iter) 690 { 691 // gpointer g_sequence_get (GSequenceIter *iter); 692 return g_sequence_get((iter is null) ? null : iter.getSequenceIterStruct()); 693 } 694 695 /** 696 * Changes the data for the item pointed to by iter to be data. If 697 * the sequence has a data destroy function associated with it, that 698 * function is called on the existing data that iter pointed to. 699 * Since 2.14 700 * Params: 701 * iter = a GSequenceIter 702 * data = new data for the item 703 */ 704 public static void set(SequenceIter iter, void* data) 705 { 706 // void g_sequence_set (GSequenceIter *iter, gpointer data); 707 g_sequence_set((iter is null) ? null : iter.getSequenceIterStruct(), data); 708 } 709 710 /** 711 * Finds an iterator somewhere in the range (begin, end). This 712 * iterator will be close to the middle of the range, but is not 713 * guaranteed to be exactly in the middle. 714 * The begin and end iterators must both point to the same sequence and 715 * begin must come before or be equal to end in the sequence. 716 * Since 2.14 717 * Params: 718 * begin = a GSequenceIter 719 * end = a GSequenceIter 720 * Returns: A GSequenceIter pointing somewhere in the (begin, end) range. 721 */ 722 public static SequenceIter rangeGetMidpoint(SequenceIter begin, SequenceIter end) 723 { 724 // GSequenceIter * g_sequence_range_get_midpoint (GSequenceIter *begin, GSequenceIter *end); 725 auto p = g_sequence_range_get_midpoint((begin is null) ? null : begin.getSequenceIterStruct(), (end is null) ? null : end.getSequenceIterStruct()); 726 727 if(p is null) 728 { 729 return null; 730 } 731 732 return new SequenceIter(cast(GSequenceIter*) p); 733 } 734 }