avcpp 3.1.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
Loading...
Searching...
No Matches
av::DictionaryArray Class Reference

Array of Dictinaries wrapper. More...

#include <dictionary.h>

Public Member Functions

 DictionaryArray (std::initializer_list< Dictionary > dicts)
 Build an array from a list of dictionaries.
 DictionaryArray (AVDictionary **dicts, size_t count, bool takeOwning=true)
 Wrap an array of raw dictionaries.
 DictionaryArray (const DictionaryArray &rhs)
 Copy the array; each dictionary is copied deeply.
DictionaryArray & operator= (const DictionaryArray &rhs)
 Assign from another array; each dictionary is copied deeply.
 DictionaryArray (DictionaryArray &&)=default
 Move the array; the source is left empty.
DictionaryArray & operator= (DictionaryArray &&)=default
 Move assignment; the source is left empty.
void assign (AVDictionary **dicts, size_t count, bool takeOwning=true)
 Replace the contents with an array of raw dictionaries.
void reserve (size_t size)
 Reserve storage for the given number of dictionaries.
void resize (size_t size)
 Resize the array, adding empty dictionaries at the end.
size_t size () const
 Number of dictionaries in the array.
void pushBack (const Dictionary &dict)
 Append a copy of a dictionary.
void pushBack (Dictionary &&dict)
 Append a dictionary, moving it.
const Dictionary & operator[] (size_t index) const
 Dictionary by index.
Dictionary & operator[] (size_t index)
 Dictionary by index, mutable.
const Dictionary & at (size_t index) const
 Dictionary by index with bounds checking.
Dictionary & at (size_t index)
 Dictionary by index with bounds checking.
const AVDictionary *const * raws () const
 The raw array, read-only.
AVDictionary ** raws ()
 The raw array, mutable.
AVDictionary ** release ()
 Give up ownership of the dictionaries.
void swap (DictionaryArray &rhs)
 Exchange the contents of two arrays.

Detailed Description

Some functions accepts array of dictionaries. This class is a simple proxy to compose such arrays.

It is not iterator-friendly and must not be used generally.

Examples
api2-dict-basic.cpp.

Constructor & Destructor Documentation

◆ DictionaryArray() [1/3]

av::DictionaryArray::DictionaryArray ( std::initializer_list< Dictionary > dicts)
Parameters
dictsthe dictionaries; they are copied into the array

◆ DictionaryArray() [2/3]

av::DictionaryArray::DictionaryArray ( AVDictionary ** dicts,
size_t count,
bool takeOwning = true )
Parameters
dictsthe array; it is copied, the dictionaries are not
countnumber of elements
takeOwningtrue frees the dictionaries on destruction

◆ DictionaryArray() [3/3]

av::DictionaryArray::DictionaryArray ( const DictionaryArray & rhs)
Parameters
rhsthe array to copy

Member Function Documentation

◆ assign()

void av::DictionaryArray::assign ( AVDictionary ** dicts,
size_t count,
bool takeOwning = true )
Parameters
dictsthe array to wrap; existing contents are released
countnumber of elements
takeOwningtrue frees the dictionaries on destruction

◆ at() [1/2]

Dictionary & av::DictionaryArray::at ( size_t index)
Parameters
indexzero-based index; must be less than size()
Returns
the dictionary

◆ at() [2/2]

const Dictionary & av::DictionaryArray::at ( size_t index) const
Parameters
indexzero-based index; must be less than size()
Returns
the dictionary

◆ operator=() [1/2]

DictionaryArray & av::DictionaryArray::operator= ( const DictionaryArray & rhs)
Parameters
rhsthe array to copy
Returns
this array

◆ operator=() [2/2]

DictionaryArray & av::DictionaryArray::operator= ( DictionaryArray && )
default
Returns
this array

◆ operator[]() [1/2]

Dictionary & av::DictionaryArray::operator[] ( size_t index)
Parameters
indexzero-based index
Returns
the dictionary; the array owns it

◆ operator[]() [2/2]

const Dictionary & av::DictionaryArray::operator[] ( size_t index) const
Parameters
indexzero-based index
Returns
the dictionary; the array owns it

◆ pushBack() [1/2]

void av::DictionaryArray::pushBack ( const Dictionary & dict)
Parameters
dictthe dictionary to copy into the array

◆ pushBack() [2/2]

void av::DictionaryArray::pushBack ( Dictionary && dict)
Parameters
dictthe dictionary to move into the array

◆ raws() [1/2]

AVDictionary ** av::DictionaryArray::raws ( )
Returns
a pointer to the internal array of dictionaries
Note
Valid until the array is modified.

◆ raws() [2/2]

const AVDictionary *const * av::DictionaryArray::raws ( ) const
Returns
a pointer to the internal array of dictionaries
Note
Valid until the array is modified.
Examples
api2-dict-basic.cpp.

◆ release()

AVDictionary ** av::DictionaryArray::release ( )
Returns
the raw array, which the caller must free

◆ reserve()

void av::DictionaryArray::reserve ( size_t size)
Parameters
sizeexpected element count

◆ resize()

void av::DictionaryArray::resize ( size_t size)
Parameters
sizethe new element count

◆ size()

size_t av::DictionaryArray::size ( ) const
Returns
the element count

◆ swap()

void av::DictionaryArray::swap ( DictionaryArray & rhs)
Parameters
rhsthe array to swap with

The documentation for this class was generated from the following file: