Adobe Source Libraries 1.49.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
selection_t Class Reference

A container used to represent a linear boolean selection. More...

#include <selection.hpp>

Inheritance diagram for selection_t:

Public Types

typedef std::size_t value_type
 value_type for selection_t
typedef std::vector< value_typestore_type
 store_type for selection_t
typedef store_type::const_iterator iterator
 iterator for selection_t
typedef store_type::const_iterator const_iterator
 const_iterator for selection_t
typedef store_type::size_type size_type
 size_type for selection_t
typedef store_type::difference_type difference_type
 difference_type for selection_t
typedef value_typereference
 reference for selection_t
typedef const value_typeconst_reference
 const_reference for selection_t
typedef value_typepointer
 pointer for selection_t
typedef const value_typeconst_pointer
 const_pointer for selection_t

Public Member Functions

 selection_t (bool start_selected=false)
template<typename I>
 selection_t (I first, I last, bool start_selected=false)
size_type size () const
bool empty () const
void push_back (const value_type &x)
const_iterator begin () const
 gets an iterator to the beginning of the toggle point sequence
const_iterator end () const
 gets an iterator to the end of the toggle point sequence
const value_typeoperator[] (const size_type &i) const
 fetches a toggle point at index i of the toggle point sequence
void invert ()
bool start_selected () const

Friends

bool operator== (const selection_t &x, const selection_t &y)

Detailed Description

A linear boolean selection is a set of context-free indices, each of which toggles the selection "on" or "off". From an implementation standpoint, each selection index must be greater than the one that precedes it (strictly monotonically increasing). There is also a boolean value associated with the selection, and that is to represent whether or not the selection is to start out "on" or "off" – thus the inversion of a selection has the same selection boundary set but a different boolean value.

Selections are context-free, meaning that a selection can be spoken about without making reference to a container. This allows for selections to be manipulated without applying them to a series of elements (e.g., union, size, etc.). Selections can then be applied to a container to get context-relevant information (e.g., the number of elements contained within a selection). Selections can also be used in place of a predicate for some algorithms. There are a series of algorithms associated with the selection container; Please see selection.

Definition at line 47 of file selection.hpp.

Member Typedef Documentation

◆ value_type

typedef std::size_t value_type

Definition at line 50 of file selection.hpp.

◆ store_type

typedef std::vector<value_type> store_type

Definition at line 52 of file selection.hpp.

◆ iterator

typedef store_type::const_iterator iterator

Definition at line 54 of file selection.hpp.

◆ const_iterator

typedef store_type::const_iterator const_iterator

Definition at line 56 of file selection.hpp.

◆ size_type

typedef store_type::size_type size_type

Definition at line 58 of file selection.hpp.

◆ difference_type

typedef store_type::difference_type difference_type

Definition at line 60 of file selection.hpp.

◆ reference

Definition at line 62 of file selection.hpp.

◆ const_reference

typedef const value_type& const_reference

Definition at line 64 of file selection.hpp.

◆ pointer

typedef value_type* pointer

Definition at line 66 of file selection.hpp.

◆ const_pointer

typedef const value_type* const_pointer

Definition at line 68 of file selection.hpp.

Constructor & Destructor Documentation

◆ selection_t() [1/2]

selection_t ( bool start_selected = false)
explicit

Default constructor.

Parameters
start_selectedSpecifies whether or not this selection begins "on" or not. If so, a selection has everything selected when it is first constructed (as it has no other toggle points).

Definition at line 77 of file selection.hpp.

◆ selection_t() [2/2]

template<typename I>
selection_t ( I first,
I last,
bool start_selected = false )

Constructor with the ability to initialize the selection with toggle points from the get-go.

Precondition
[ first, last ) is strictly monotonically increasing
Parameters
firstan iterator to the first toggle point to include
lastan iterator to one past the last toggle point to include
start_selectedSpecifies whether or not this selection begins "on" or not.

Definition at line 90 of file selection.hpp.

Member Function Documentation

◆ size()

size_type size ( ) const
Returns
the number of boundaries in the selection; to get the number of elements contained within a selection, a container must also be supplied, as such: selection_t::size_type selected_element_size(adobe::size(selection, container))

Definition at line 99 of file selection.hpp.

◆ empty()

bool empty ( ) const
Returns
true if there is at least one toggle point, or the selection starts selected.

Definition at line 102 of file selection.hpp.

◆ push_back()

void push_back ( const value_type & x)

pushes a toggle point onto the back of the selection. The index must be greater than the previous toggle point.

Definition at line 106 of file selection.hpp.

◆ begin()

const_iterator begin ( ) const

Definition at line 113 of file selection.hpp.

◆ end()

const_iterator end ( ) const

Definition at line 116 of file selection.hpp.

◆ operator[]()

const value_type & operator[] ( const size_type & i) const

Definition at line 119 of file selection.hpp.

◆ invert()

void invert ( )

inverts the selection.

Definition at line 124 of file selection.hpp.

◆ start_selected()

bool start_selected ( ) const
Returns
Whether or not the selection begins toggled "on"

Definition at line 129 of file selection.hpp.

◆ operator==

bool operator== ( const selection_t & x,
const selection_t & y )
friend

Definition at line 131 of file selection.hpp.