- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files
- Examples

- Data Structures
- Data Structure Index
- Class Hierarchy
- Data Fields

Public Types | Public Member Functions
efl::eina::accessor< T > Struct Template Reference
Eina C++Eina C++ » | Data Types » Content Access » Accessor Eina C++Eina C++ » | Data Types » | Content Access

Wraps an native Eina_Accessor and provide random access to data structures. More...

## Public Types
typedef unsigned int | key_type
| Type for accessor key. More...
typedef T | mapped_type
| Type for accessor mapped elements. More...
typedef T | value_type
| Type for accessor elements. More...
typedef std::size_t | size_type
| Type for size information used in the accessor. More...

## Public Member Functions
| accessor ()
| Default constructor. More...
| accessor (Eina_Accessor *impl)
| Create an accessor object that wraps the given Eina accessor. More...
| accessor (accessor< T > const &other)
| Copy constructor. More...
accessor< T > & | operator= (accessor< T > const &other)
| Assignment Operator. More...
| ~accessor ()
| Destructor. More...
mapped_type & | operator[] (size_type i) const
| Retrieve the data of the accessor at a given position. More...
Eina_Accessor * | native_handle () const
| Get the handle for the wrapped `Eina_Accessor`. More...
void | swap (accessor< T > &other)
| Swap content between both objects. More...
| operator bool () const
| Cast to `boolean` based on the wrapped `Eina_Accessor`. More...

## Detailed Description

### template<typename T>
struct efl::eina::accessor< T >

Wraps an native Eina_Accessor and provide random access to data structures.

## Member Typedef Documentation

template<typename T>

typedef unsigned int efl::eina::accessor< T >::key_type

Type for accessor key.

template<typename T>

typedef T efl::eina::accessor< T >::mapped_type

Type for accessor mapped elements.

template<typename T>

typedef T efl::eina::accessor< T >::value_type

Type for accessor elements.

Same as mapped_type.

template<typename T>

typedef std::size_t efl::eina::accessor< T >::size_type

Type for size information used in the accessor.

## Constructor & Destructor Documentation

template<typename T>

efl::eina::accessor< T >::accessor | ( |  | ) |
| inline

Default constructor.

Creates an empty accessor.

template<typename T>

efl::eina::accessor< T >::accessor | ( | Eina_Accessor * | impl | ) |
| inline explicit

Create an accessor object that wraps the given Eina accessor.

Parameters

  impl | Native `Eina_Accessor` to be wrapped.

This constructor creates an accessor object that wraps the given Eina_Accessor and provides access to the data pointed by it.

Warning
  It is important to note that the created accessor object gains ownership of the given handle, deallocating it at destruction time.

template<typename T>

efl::eina::accessor< T >::accessor | ( | accessor< T > const & | other | ) |
| inline

Copy constructor.

Creates a copy of the given accessor object.

Parameters

  other | Other accessor object.

This constructor clones the internal `Eina_Accessor` of the given accessor object, so that the newly created object can be used freely.

template<typename T>

efl::eina::accessor< T >::~accessor | ( |  | ) |
| inline

Destructor.

Free the internal `Eina_Acessor`.

References eina_accessor_free().

## Member Function Documentation

template<typename T>

accessor<T>& efl::eina::accessor< T >::operator= | ( | accessor< T > const & | other | ) |
| inline

Assignment Operator.

Replace the current content.

Parameters

  other | Other accessor object.

Exceptions

  <tt>eina::system_error</tt> | if the Eina accessor could not be cloned.

This operator replaces the current native Eina accessor by a copy of the native accessor inside the given object.

References eina_accessor_clone(), eina_accessor_free(), and efl::eina::get_error_code().

template<typename T>

mapped_type& efl::eina::accessor< T >::operator[] | ( | size_type | i | ) | const
| inline

Retrieve the data of the accessor at a given position.

Parameters

  i | The position of the element.

Returns
  Constant reference to the retrieved data.

Exceptions

  <tt>eina::system_error</tt> | if the given element could not be retrieved.

This operator retrieves a constant reference to the element at the given position. If the element could not be retrieved an `eina::system_error` is thrown.

References eina_accessor_data_get(), and efl::eina::get_error_code().

template<typename T>

Eina_Accessor* efl::eina::accessor< T >::native_handle | ( |  | ) | const

Get the handle for the wrapped `Eina_Accessor`.

Returns
  Internal handle for the native Eina accessor.

This member function returns the native `Eina_Accessor` handle that is wrapped inside this object.

Warning
  It is important to take care when using it, since the handle will be automatically release upon object destruction.

Referenced by efl::eina::accessor< T >::operator bool().

template<typename T>

void efl::eina::accessor< T >::swap | ( | accessor< T > & | other | ) |
| inline

Swap content between both objects.

Parameters

  other | Other accessor object.

This member function swaps the internal `Eina_Acessor` with the given accessor object.

References efl::eina::swap().

Referenced by efl::eina::swap().

template<typename T>

efl::eina::accessor< T >::operator bool | ( |  | ) | const
| inline explicit

Cast to `boolean` based on the wrapped `Eina_Accessor`.

Returns
  `true` if the wrapped handle is not `NULL`, `false` otherwise.

Boolean typecast overload for easy validation of the accessor object. Returns `false` if it does not have an internal `Eina_Accessor`, i.e. if the current handle is not `NULL`.

References efl::eina::accessor< T >::native_handle().