/usr/include/glibmm-2.4/glibmm/arrayhandle.h is in libglibmm-2.4-dev 2.56.0-1.
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 | #ifndef _GLIBMM_ARRAYHANDLE_H
#define _GLIBMM_ARRAYHANDLE_H
/* Copyright (C) 2002 The gtkmm Development Team
*
* This library 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 2.1 of the License, 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
* 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 this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include <glibmmconfig.h>
#include <glibmm/containerhandle_shared.h>
namespace Glib
{
namespace Container_Helpers
{
#ifndef DOXYGEN_SHOULD_SKIP_THIS
/* Count the number of elements in a 0-terminated sequence.
*/
template <class T>
inline std::size_t
compute_array_size(const T* array)
{
const T* pend = array;
while (*pend)
++pend;
return (pend - array);
}
/* Allocate and fill a 0-terminated array. The size argument
* specifies the number of elements in the input sequence.
*/
template <class For, class Tr>
typename Tr::CType*
create_array(For pbegin, std::size_t size, Tr)
{
using CType = typename Tr::CType;
CType* const array = static_cast<CType*>(g_malloc((size + 1) * sizeof(CType)));
CType* const array_end = array + size;
for (CType* pdest = array; pdest != array_end; ++pdest)
{
// Use & to force a warning if the iterator returns a temporary object.
*pdest = Tr::to_c_type(*&*pbegin);
++pbegin;
}
*array_end = CType();
return array;
}
template <class For>
gboolean*
create_bool_array(For pbegin, std::size_t size)
{
gboolean* const array(static_cast<gboolean*>(g_malloc((size + 1) * sizeof(gboolean))));
gboolean* const array_end(array + size);
for (gboolean* pdest(array); pdest != array_end; ++pdest)
{
*pdest = *pbegin;
++pbegin;
}
*array_end = false;
return array;
}
/* Convert from any container that supports forward
* iterators and has a size() method.
*/
template <class Tr, class Cont>
struct ArraySourceTraits
{
using CType = typename Tr::CType;
static std::size_t get_size(const Cont& cont) { return cont.size(); }
static const CType* get_data(const Cont& cont, std::size_t size)
{
return Glib::Container_Helpers::create_array(cont.begin(), size, Tr());
}
static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW;
};
// source traits for bools.
template <class Cont>
struct BoolArraySourceTraits
{
using CType = gboolean;
static std::size_t get_size(const Cont& cont) { return cont.size(); }
static const CType* get_data(const Cont& cont, std::size_t size)
{
return Glib::Container_Helpers::create_bool_array(cont.begin(), size);
}
static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_SHALLOW;
};
/* Convert from a 0-terminated array. The Cont argument must be a pointer
* to the first element. Note that only arrays of the C type are supported.
*/
template <class Tr, class Cont>
struct ArraySourceTraits<Tr, Cont*>
{
using CType = typename Tr::CType;
static std::size_t get_size(const CType* array)
{
return (array) ? Glib::Container_Helpers::compute_array_size(array) : 0;
}
static const CType* get_data(const CType* array, std::size_t) { return array; }
static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE;
};
template <class Tr, class Cont>
struct ArraySourceTraits<Tr, const Cont*> : ArraySourceTraits<Tr, Cont*>
{
};
/* Convert from a 0-terminated array. The Cont argument must be a pointer
* to the first element. Note that only arrays of the C type are supported.
* For consistency, the array must be 0-terminated, even though the array
* size is known at compile time.
*/
template <class Tr, class Cont, std::size_t N>
struct ArraySourceTraits<Tr, Cont[N]>
{
using CType = typename Tr::CType;
static std::size_t get_size(const CType*) { return (N - 1); }
static const CType* get_data(const CType* array, std::size_t) { return array; }
static const Glib::OwnershipType initial_ownership = Glib::OWNERSHIP_NONE;
};
template <class Tr, class Cont, std::size_t N>
struct ArraySourceTraits<Tr, const Cont[N]> : ArraySourceTraits<Tr, Cont[N]>
{
};
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
/**
* @ingroup ContHelpers
*/
template <class Tr>
class ArrayHandleIterator
{
public:
using CppType = typename Tr::CppType;
using CType = typename Tr::CType;
using iterator_category = std::random_access_iterator_tag;
using value_type = CppType;
using difference_type = std::ptrdiff_t;
using reference = value_type;
using pointer = void;
explicit inline ArrayHandleIterator(const CType* pos);
inline value_type operator*() const;
inline value_type operator[](difference_type offset) const;
inline ArrayHandleIterator<Tr>& operator++();
inline const ArrayHandleIterator<Tr> operator++(int);
// these are needed by msvc 2005 when using deque.
inline ArrayHandleIterator<Tr>& operator--();
inline const ArrayHandleIterator<Tr> operator--(int);
// All this random access stuff is only there because STL algorithms
// usually have optimized specializations for random access iterators,
// and we don't want to give away efficiency for nothing.
//
inline ArrayHandleIterator<Tr>& operator+=(difference_type rhs);
inline ArrayHandleIterator<Tr>& operator-=(difference_type rhs);
inline const ArrayHandleIterator<Tr> operator+(difference_type rhs) const;
inline const ArrayHandleIterator<Tr> operator-(difference_type rhs) const;
inline difference_type operator-(const ArrayHandleIterator<Tr>& rhs) const;
inline bool operator==(const ArrayHandleIterator<Tr>& rhs) const;
inline bool operator!=(const ArrayHandleIterator<Tr>& rhs) const;
inline bool operator<(const ArrayHandleIterator<Tr>& rhs) const;
inline bool operator>(const ArrayHandleIterator<Tr>& rhs) const;
inline bool operator<=(const ArrayHandleIterator<Tr>& rhs) const;
inline bool operator>=(const ArrayHandleIterator<Tr>& rhs) const;
private:
const CType* pos_;
};
} // namespace Container_Helpers
// TODO: When we can break ABI, remove this and replace uses of it with std::vector.
// We cannot deprecate it yet, because we cannot easily deprecate methods that use it
//- for instance, we cannot just override methods that use it as a return type.
/** This is an intermediate type. When a method takes this, or returns this, you
* should use a standard C++ container of your choice, such as std::list or
* std::vector.
*
* However, this is not used in new API. We now prefer to just use std::vector,
* which is less flexibile, but makes the API clearer.
*
* @ingroup ContHandles
*/
template <class T, class Tr = Glib::Container_Helpers::TypeTraits<T>>
class ArrayHandle
{
public:
using CppType = typename Tr::CppType;
using CType = typename Tr::CType;
using value_type = CppType;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
using const_iterator = Glib::Container_Helpers::ArrayHandleIterator<Tr>;
using iterator = Glib::Container_Helpers::ArrayHandleIterator<Tr>;
template <class Cont>
inline ArrayHandle(const Cont& container);
// Take over ownership of an array created by GTK+ functions.
inline ArrayHandle(const CType* array, std::size_t array_size, Glib::OwnershipType ownership);
inline ArrayHandle(const CType* array, Glib::OwnershipType ownership);
// Copying clears the ownership flag of the source handle.
inline ArrayHandle(const ArrayHandle<T, Tr>& other);
~ArrayHandle() noexcept;
inline const_iterator begin() const;
inline const_iterator end() const;
template <class U>
inline operator std::vector<U>() const;
template <class U>
inline operator std::deque<U>() const;
template <class U>
inline operator std::list<U>() const;
template <class Cont>
inline void assign_to(Cont& container) const;
template <class Out>
inline void copy(Out pdest) const;
inline const CType* data() const;
inline std::size_t size() const;
inline bool empty() const;
private:
std::size_t size_;
const CType* parray_;
mutable Glib::OwnershipType ownership_;
// No copy assignment.
ArrayHandle<T, Tr>& operator=(const ArrayHandle<T, Tr>&);
};
template <>
class ArrayHandle<bool, Container_Helpers::TypeTraits<bool>>
{
public:
using Me = ArrayHandle<bool, Container_Helpers::TypeTraits<bool>>;
using Tr = Container_Helpers::TypeTraits<bool>;
using CppType = Tr::CppType;
using CType = Tr::CType;
using value_type = CppType;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
using const_iterator = Glib::Container_Helpers::ArrayHandleIterator<Tr>;
using iterator = Glib::Container_Helpers::ArrayHandleIterator<Tr>;
template <class Cont>
inline ArrayHandle(const Cont& container);
// Take over ownership of an array created by GTK+ functions.
inline ArrayHandle(const CType* array, std::size_t array_size, Glib::OwnershipType ownership);
inline ArrayHandle(const CType* array, Glib::OwnershipType ownership);
// Copying clears the ownership flag of the source handle.
inline ArrayHandle(const Me& other);
~ArrayHandle() noexcept;
inline const_iterator begin() const;
inline const_iterator end() const;
// this is inside class definition, so msvc 2005, 2008 and 2010 can compile this code.
template <class U>
inline operator std::vector<U>() const
{
#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS
return std::vector<U>(this->begin(), this->end());
#else
std::vector<U> temp;
temp.reserve(this->size());
Glib::Container_Helpers::fill_container(temp, this->begin(), this->end());
return temp;
#endif
}
// this is inside class definition, so msvc 2005, 2008 and 2010 can compile this code.
template <class U>
inline operator std::deque<U>() const
{
#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS
return std::deque<U>(this->begin(), this->end());
#else
std::deque<U> temp;
Glib::Container_Helpers::fill_container(temp, this->begin(), this->end());
return temp;
#endif
}
// this is inside class definition, so msvc 2005, 2008 and 2010 can compile this code.
template <class U>
inline operator std::list<U>() const
{
#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS
return std::list<U>(this->begin(), this->end());
#else
std::list<U> temp;
Glib::Container_Helpers::fill_container(temp, this->begin(), this->end());
return temp;
#endif
}
template <class Cont>
inline void assign_to(Cont& container) const;
template <class Out>
inline void copy(Out pdest) const;
inline const CType* data() const;
inline std::size_t size() const;
inline bool empty() const;
private:
std::size_t size_;
const CType* parray_;
mutable Glib::OwnershipType ownership_;
// No copy assignment.
Me& operator=(const Me&);
};
// TODO: Remove this when we can break glibmm API.
/** If a method takes this as an argument, or has this as a return type, then you can use a standard
* container such as std::list<Glib::ustring> or std::vector<Glib::ustring>.
*
*
* However, this is not used in new API. We now prefer to just use std::vector,
* which is less flexibile, but makes the API clearer.
*
* @ingroup ContHandles
*/
using StringArrayHandle = ArrayHandle<Glib::ustring>;
/***************************************************************************/
/* Inline implementation */
/***************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Container_Helpers
{
/**** Glib::Container_Helpers::ArrayHandleIterator<> ***********************/
template <class Tr>
inline ArrayHandleIterator<Tr>::ArrayHandleIterator(const CType* pos) : pos_(pos)
{
}
template <class Tr>
inline typename ArrayHandleIterator<Tr>::value_type ArrayHandleIterator<Tr>::operator*() const
{
return Tr::to_cpp_type(*pos_);
}
template <class Tr>
inline typename ArrayHandleIterator<Tr>::value_type ArrayHandleIterator<Tr>::operator[](
difference_type offset) const
{
return Tr::to_cpp_type(pos_[offset]);
}
template <class Tr>
inline ArrayHandleIterator<Tr>& ArrayHandleIterator<Tr>::operator++()
{
++pos_;
return *this;
}
template <class Tr>
inline const ArrayHandleIterator<Tr> ArrayHandleIterator<Tr>::operator++(int)
{
return ArrayHandleIterator<Tr>(pos_++);
}
template <class Tr>
inline ArrayHandleIterator<Tr>& ArrayHandleIterator<Tr>::operator--()
{
--pos_;
return *this;
}
template <class Tr>
inline const ArrayHandleIterator<Tr> ArrayHandleIterator<Tr>::operator--(int)
{
return ArrayHandleIterator<Tr>(pos_--);
}
template <class Tr>
inline ArrayHandleIterator<Tr>&
ArrayHandleIterator<Tr>::operator+=(typename ArrayHandleIterator<Tr>::difference_type rhs)
{
pos_ += rhs;
return *this;
}
template <class Tr>
inline ArrayHandleIterator<Tr>&
ArrayHandleIterator<Tr>::operator-=(typename ArrayHandleIterator<Tr>::difference_type rhs)
{
pos_ -= rhs;
return *this;
}
template <class Tr>
inline const ArrayHandleIterator<Tr>
ArrayHandleIterator<Tr>::operator+(typename ArrayHandleIterator<Tr>::difference_type rhs) const
{
return ArrayHandleIterator<Tr>(pos_ + rhs);
}
template <class Tr>
inline const ArrayHandleIterator<Tr>
ArrayHandleIterator<Tr>::operator-(typename ArrayHandleIterator<Tr>::difference_type rhs) const
{
return ArrayHandleIterator<Tr>(pos_ - rhs);
}
template <class Tr>
inline typename ArrayHandleIterator<Tr>::difference_type
ArrayHandleIterator<Tr>::operator-(const ArrayHandleIterator<Tr>& rhs) const
{
return (pos_ - rhs.pos_);
}
template <class Tr>
inline bool
ArrayHandleIterator<Tr>::operator==(const ArrayHandleIterator<Tr>& rhs) const
{
return (pos_ == rhs.pos_);
}
template <class Tr>
inline bool
ArrayHandleIterator<Tr>::operator!=(const ArrayHandleIterator<Tr>& rhs) const
{
return (pos_ != rhs.pos_);
}
template <class Tr>
inline bool
ArrayHandleIterator<Tr>::operator<(const ArrayHandleIterator<Tr>& rhs) const
{
return (pos_ < rhs.pos_);
}
template <class Tr>
inline bool
ArrayHandleIterator<Tr>::operator>(const ArrayHandleIterator<Tr>& rhs) const
{
return (pos_ > rhs.pos_);
}
template <class Tr>
inline bool
ArrayHandleIterator<Tr>::operator<=(const ArrayHandleIterator<Tr>& rhs) const
{
return (pos_ <= rhs.pos_);
}
template <class Tr>
inline bool
ArrayHandleIterator<Tr>::operator>=(const ArrayHandleIterator<Tr>& rhs) const
{
return (pos_ >= rhs.pos_);
}
} // namespace Container_Helpers
/**** Glib::ArrayHandle<> **************************************************/
template <class T, class Tr>
template <class Cont>
inline ArrayHandle<T, Tr>::ArrayHandle(const Cont& container)
: size_(Glib::Container_Helpers::ArraySourceTraits<Tr, Cont>::get_size(container)),
parray_(Glib::Container_Helpers::ArraySourceTraits<Tr, Cont>::get_data(container, size_)),
ownership_(Glib::Container_Helpers::ArraySourceTraits<Tr, Cont>::initial_ownership)
{
}
template <class T, class Tr>
inline ArrayHandle<T, Tr>::ArrayHandle(const typename ArrayHandle<T, Tr>::CType* array,
std::size_t array_size, Glib::OwnershipType ownership)
: size_((array) ? array_size : 0), parray_(array), ownership_(ownership)
{
}
template <class T, class Tr>
inline ArrayHandle<T, Tr>::ArrayHandle(
const typename ArrayHandle<T, Tr>::CType* array, Glib::OwnershipType ownership)
: size_((array) ? Glib::Container_Helpers::compute_array_size(array) : 0),
parray_(array),
ownership_(ownership)
{
}
template <class T, class Tr>
inline ArrayHandle<T, Tr>::ArrayHandle(const ArrayHandle<T, Tr>& other)
: size_(other.size_), parray_(other.parray_), ownership_(other.ownership_)
{
other.ownership_ = Glib::OWNERSHIP_NONE;
}
template <class T, class Tr>
ArrayHandle<T, Tr>::~ArrayHandle() noexcept
{
if (parray_ && ownership_ != Glib::OWNERSHIP_NONE)
{
if (ownership_ != Glib::OWNERSHIP_SHALLOW)
{
// Deep ownership: release each container element.
const CType* const pend = parray_ + size_;
for (const CType* p = parray_; p != pend; ++p)
Tr::release_c_type(*p);
}
g_free(const_cast<CType*>(parray_));
}
}
template <class T, class Tr>
inline typename ArrayHandle<T, Tr>::const_iterator
ArrayHandle<T, Tr>::begin() const
{
return Glib::Container_Helpers::ArrayHandleIterator<Tr>(parray_);
}
template <class T, class Tr>
inline typename ArrayHandle<T, Tr>::const_iterator
ArrayHandle<T, Tr>::end() const
{
return Glib::Container_Helpers::ArrayHandleIterator<Tr>(parray_ + size_);
}
template <class T, class Tr>
template <class U>
inline ArrayHandle<T, Tr>::operator std::vector<U>() const
{
#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS
return std::vector<U>(this->begin(), this->end());
#else
std::vector<U> temp;
temp.reserve(this->size());
Glib::Container_Helpers::fill_container(temp, this->begin(), this->end());
return temp;
#endif
}
template <class T, class Tr>
template <class U>
inline ArrayHandle<T, Tr>::operator std::deque<U>() const
{
#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS
return std::deque<U>(this->begin(), this->end());
#else
std::deque<U> temp;
Glib::Container_Helpers::fill_container(temp, this->begin(), this->end());
return temp;
#endif
}
template <class T, class Tr>
template <class U>
inline ArrayHandle<T, Tr>::operator std::list<U>() const
{
#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS
return std::list<U>(this->begin(), this->end());
#else
std::list<U> temp;
Glib::Container_Helpers::fill_container(temp, this->begin(), this->end());
return temp;
#endif
}
template <class T, class Tr>
template <class Cont>
inline void
ArrayHandle<T, Tr>::assign_to(Cont& container) const
{
#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS
container.assign(this->begin(), this->end());
#else
Cont temp;
Glib::Container_Helpers::fill_container(temp, this->begin(), this->end());
container.swap(temp);
#endif
}
template <class T, class Tr>
template <class Out>
inline void
ArrayHandle<T, Tr>::copy(Out pdest) const
{
std::copy(this->begin(), this->end(), pdest);
}
template <class T, class Tr>
inline const typename ArrayHandle<T, Tr>::CType*
ArrayHandle<T, Tr>::data() const
{
return parray_;
}
template <class T, class Tr>
inline std::size_t
ArrayHandle<T, Tr>::size() const
{
return size_;
}
template <class T, class Tr>
inline bool
ArrayHandle<T, Tr>::empty() const
{
return (size_ == 0);
}
/**** Glib::ArrayHandle<bool> **********************************************/
template <class Cont>
inline ArrayHandle<bool, Container_Helpers::TypeTraits<bool>>::ArrayHandle(const Cont& container)
: size_(Glib::Container_Helpers::BoolArraySourceTraits<Cont>::get_size(container)),
parray_(Glib::Container_Helpers::BoolArraySourceTraits<Cont>::get_data(container, size_)),
ownership_(Glib::Container_Helpers::BoolArraySourceTraits<Cont>::initial_ownership)
{
}
inline ArrayHandle<bool, Container_Helpers::TypeTraits<bool>>::ArrayHandle(
const gboolean* array, std::size_t array_size, Glib::OwnershipType ownership)
: size_((array) ? array_size : 0), parray_(array), ownership_(ownership)
{
}
inline ArrayHandle<bool, Container_Helpers::TypeTraits<bool>>::ArrayHandle(
const gboolean* array, Glib::OwnershipType ownership)
: size_((array) ? Glib::Container_Helpers::compute_array_size(array) : 0),
parray_(array),
ownership_(ownership)
{
}
inline ArrayHandle<bool, Container_Helpers::TypeTraits<bool>>::ArrayHandle(
const ArrayHandle<bool, Container_Helpers::TypeTraits<bool>>& other)
: size_(other.size_), parray_(other.parray_), ownership_(other.ownership_)
{
other.ownership_ = Glib::OWNERSHIP_NONE;
}
inline ArrayHandle<bool, Container_Helpers::TypeTraits<bool>>::const_iterator
ArrayHandle<bool, Container_Helpers::TypeTraits<bool>>::begin() const
{
return Glib::Container_Helpers::ArrayHandleIterator<Tr>(parray_);
}
inline ArrayHandle<bool, Container_Helpers::TypeTraits<bool>>::const_iterator
ArrayHandle<bool, Container_Helpers::TypeTraits<bool>>::end() const
{
return Glib::Container_Helpers::ArrayHandleIterator<Tr>(parray_ + size_);
}
template <class Cont>
inline void
ArrayHandle<bool, Container_Helpers::TypeTraits<bool>>::assign_to(Cont& container) const
{
#ifdef GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS
container.assign(this->begin(), this->end());
#else
Cont temp;
Glib::Container_Helpers::fill_container(temp, this->begin(), this->end());
container.swap(temp);
#endif
}
template <class Out>
inline void
ArrayHandle<bool, Container_Helpers::TypeTraits<bool>>::copy(Out pdest) const
{
std::copy(this->begin(), this->end(), pdest);
}
inline const gboolean*
ArrayHandle<bool, Container_Helpers::TypeTraits<bool>>::data() const
{
return parray_;
}
inline std::size_t
ArrayHandle<bool, Container_Helpers::TypeTraits<bool>>::size() const
{
return size_;
}
inline bool
ArrayHandle<bool, Container_Helpers::TypeTraits<bool>>::empty() const
{
return (size_ == 0);
}
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
} // namespace Glib
#endif /* _GLIBMM_ARRAYHANDLE_H */
|