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