# synfig::ValueBase Class Reference

`#include <value.h>`

Inheritance diagram for synfig::ValueBase:

List of all members.

## Public Types

enum | Type { TYPE_NIL = 0, TYPE_BOOL, TYPE_INTEGER, TYPE_ANGLE, TYPE_TIME, TYPE_REAL, TYPE_VECTOR, TYPE_COLOR, TYPE_SEGMENT, TYPE_BLINEPOINT, TYPE_LIST, TYPE_CANVAS, TYPE_STRING, TYPE_GRADIENT, TYPE_END }

## Public Member Functions

| ValueBase ()
template<typename T>
| ValueBase (const T &x, bool loop_=false)
| ValueBase (Type x)
| ~ValueBase ()
template<class T>
ValueBase & | operator= (const T &x)
ValueBase & | operator= (const ValueBase &x)
bool | operator== (const ValueBase &rhs) const
bool | operator!= (const ValueBase &rhs) const
const ValueBase & | operator[] (int index) const
| Constant index operator for when value is of type TYPE_LIST.
void | clear ()
bool | get_loop () const
void | set_loop (bool x)
bool | empty () const
Type | get_contained_type () const
bool | is_valid () const
| Returns true if the contained value is defined and valid.
String | type_name () const
| Returns a string containing the name of the type.
const Type & | get_type () const
| Returns the type of the contained value.
template<class T>
bool | same_type_as (const T &x) const
| Checks the type of the parameter against itself. Returns true if they are of the same type.
bool | same_type_as (const Type testtype) const
template<typename T>
const T & | get (const T &x __attribute__((unused))) const
float | get (const float &) const
etl::loose_handle< Canvas > | get (const etl::handle< Canvas > &) const
etl::loose_handle< Canvas > | get (Canvas *) const
const char * | get (const char *) const
const list_type & | get_list () const
template<typename T>
void | put (T *x) const
void | put (float *x) const
void | put (char **x) const
template<typename T>
void | set (const T &x)
void | set (const float &x)
void | set (const list_type &x)
void | set (const char *x)
void | set (char *x)
void | set (Canvas *x)
void | set (etl::loose_handle< Canvas > x)
void | set (etl::handle< Canvas > x)
template<class T>
void | set (const std::vector< T > &x)
template<class T>
void | set (const std::list< T > &x)
| operator const list_type & () const
| operator const Real & () const
| operator const Vector & () const
| operator const BLinePoint & () const
| operator const Segment & () const
| operator const Angle & () const
template<class T>
| operator std::list< T > () const
template<class T>
| operator std::vector< T > () const

## Static Public Member Functions

static bool | same_type_as (const Type type1, const Type type2)
| Compares two types. Returns true if they are the same type.
static String | type_name (Type id)
| Returns a string containing the name of the given Type.
static String | type_local_name (Type id)
| Returns a string containing the translated name of the given Type.
static Type | ident_type (const String &str)
| Returns a the corresponding Type of the described type.
static Type | get_type (bool)
static Type | get_type (int)
static Type | get_type (const Time &)
static Type | get_type (const Real &)
static Type | get_type (const float &)
static Type | get_type (const Vector &)
static Type | get_type (const Color &)
static Type | get_type (const Segment &)
static Type | get_type (const BLinePoint &)
static Type | get_type (const String &)
static Type | get_type (const Gradient &)
static Type | get_type (Canvas *)
static Type | get_type (const etl::handle< Canvas > &)
static Type | get_type (const etl::loose_handle< Canvas > &)
static Type | get_type (const list_type &)
template<class T>
static Type | get_type (const std::vector< T > &)
template<class T>
static Type | get_type (const std::list< T > &)
static Type | get_type (const Angle &)

## Protected Attributes

Type | type
void * | data
etl::reference_counter | ref_count
bool | loop_

## Detailed Description

Todo:
  writeme

## Member Enumeration Documentation

enum synfig::ValueBase::Type

Todo:
  This needs to be documented further.

Enumerator:

  TYPE_NIL | Represents an empty value.
  TYPE_BOOL |
  TYPE_INTEGER |
  TYPE_ANGLE | Angle.
  TYPE_TIME | Time.
  TYPE_REAL | Real.
  TYPE_VECTOR | Vector.
  TYPE_COLOR | Color.
  TYPE_SEGMENT | Segment.
  TYPE_BLINEPOINT | BLinePoint.
  TYPE_LIST | List.
  TYPE_CANVAS | Canvas.
  TYPE_STRING | String.
  TYPE_GRADIENT | Color Gradient.
  TYPE_END | Not a valid type, used for sanity checks.

## Constructor & Destructor Documentation

ValueBase::ValueBase | ( |  | ) |

Todo:
  This needs to be documented further.

template<typename T>

synfig::ValueBase::ValueBase | ( | const T & | x,
|  | bool | loop_ = `false` |
| ) |  |  | `[inline]`

Todo:
  This needs to be documented further.

ValueBase::ValueBase | ( | Type | x | ) |

Todo:
  This needs to be documented further.

References data, type, TYPE_ANGLE, TYPE_BLINEPOINT, TYPE_BOOL, TYPE_CANVAS, TYPE_COLOR, TYPE_GRADIENT, TYPE_INTEGER, TYPE_LIST, TYPE_REAL, TYPE_SEGMENT, TYPE_STRING, TYPE_TIME, and TYPE_VECTOR.

ValueBase::~ValueBase | ( |  | ) |

Todo:
  This needs to be documented further.

References clear().

## Member Function Documentation

template<class T>

ValueBase& synfig::ValueBase::operator= | ( | const T & | x | ) | `[inline]`

Todo:
  This needs to be documented further.

Reimplemented in synfig::Value< T >.

ValueBase & ValueBase::operator= | ( | const ValueBase & | x | ) |

Todo:
  This needs to be documented further.

Reimplemented in synfig::Value< T >.

References clear(), data, loop_, ref_count, and type.

bool ValueBase::operator== | ( | const ValueBase & | rhs | ) | const

Todo:
  This needs to be documented further.

References std::abs(), data, get(), get_list(), get_type(), TYPE_ANGLE, TYPE_BLINEPOINT, TYPE_BOOL, TYPE_CANVAS, TYPE_COLOR, TYPE_GRADIENT, TYPE_INTEGER, TYPE_LIST, TYPE_NIL, TYPE_REAL, TYPE_SEGMENT, TYPE_STRING, TYPE_TIME, and TYPE_VECTOR.

Referenced by operator!=().

bool synfig::ValueBase::operator!= | ( | const ValueBase & | rhs | ) | const`[inline]`

Todo:
  This needs to be documented further.

References operator==().

const ValueBase& synfig::ValueBase::operator[] | ( | int | index | ) | const`[inline]`

Constant index operator for when value is of type TYPE_LIST.

References get_list(), type, and TYPE_LIST.

void ValueBase::clear | ( |  | ) |

Todo:
  This needs to be documented further.

References data, ref_count, type, TYPE_ANGLE, TYPE_BLINEPOINT, TYPE_BOOL, TYPE_CANVAS, TYPE_COLOR, TYPE_GRADIENT, TYPE_INTEGER, TYPE_LIST, TYPE_NIL, TYPE_REAL, TYPE_SEGMENT, TYPE_STRING, TYPE_TIME, and TYPE_VECTOR.

Referenced by operator=(), set(), and ~ValueBase().

bool synfig::ValueBase::get_loop | ( |  | ) | const`[inline]`

Todo:
  This needs to be documented further.

References loop_.

Referenced by synfig::convert_bline_to_segment_list(), synfig::convert_bline_to_width_list(), synfig::ValueNode_BLine::create(), Plant::set_param(), CurveGradient::set_param(), Region::sync(), and Outline::sync().

void synfig::ValueBase::set_loop | ( | bool | x | ) | `[inline]`

Todo:
  This needs to be documented further.

References loop_.

Referenced by Outline::sync().

bool ValueBase::empty | ( |  | ) | const

Todo:
  This needs to be documented further.

References get_list(), is_valid(), type, and TYPE_LIST.

Referenced by synfig::convert_bline_to_width_list(), synfig::ValueNode_BLine::create(), and get_contained_type().

ValueBase::Type ValueBase::get_contained_type | ( |  | ) | const

Todo:
  This needs to be documented further.

References empty(), get_list(), type, TYPE_LIST, and TYPE_NIL.

Referenced by synfig::ValueNode_BLine::create(), Region::sync(), and Outline::sync().

bool ValueBase::is_valid | ( |  | ) | const

Returns true if the contained value is defined and valid.

References ref_count, type, TYPE_END, and TYPE_NIL.

Referenced by empty(), encode_layer(), and get().

String synfig::ValueBase::type_name | ( |  | ) | const`[inline]`

Returns a string containing the name of the type.

References type.

Referenced by type_local_name().

const Type& synfig::ValueBase::get_type | ( |  | ) | const`[inline]`

Returns the type of the contained value.

References type.

Referenced by synfig::ValueNode_Stripes::create(), synfig::ValueNode_SegCalcVertex::create(), synfig::ValueNode_SegCalcTangent::create(), synfig::ValueNode_Repeat_Gradient::create(), synfig::ValueNode_GradientRotate::create(), synfig::ValueNode_BLineCalcWidth::create(), synfig::ValueNode_BLineCalcVertex::create(), synfig::ValueNode_BLineCalcTangent::create(), synfig::ValueNode_BLine::create(), synfig::LinkableValueNode::create(), encode_animated(), encode_layer(), encode_value(), operator==(), same_type_as(), Region::set_param(), Plant::set_param(), Outline::set_param(), synfig::Layer_Bitmap::set_param(), CurveWarp::set_param(), CurveGradient::set_param(), synfig::Layer_ColorCorrect::set_param(), synfig::Waypoint::set_value(), synfig::ValueNode_Add::ValueNode_Add(), synfig::ValueNode_Integer::ValueNode_Integer(), synfig::ValueNode_Subtract::ValueNode_Subtract(), and synfig::Waypoint::Waypoint().

template<class T>

bool synfig::ValueBase::same_type_as | ( | const T & | x | ) | const`[inline]`

Checks the type of the parameter against itself. Returns true if they are of the same type.

References get_type(), and type.

Referenced by get(), synfig::Value< T >::operator=(), put(), same_type_as(), Star::set_param(), Rotate::set_param(), Plant::set_param(), Noise::set_param(), Metaballs::set_param(), Mandelbrot::set_param(), LinearGradient::set_param(), synfig::Layer_Polygon::set_param(), synfig::Layer_PasteCanvas::set_param(), synfig::Layer_Composite::set_param(), synfig::Layer::set_param(), Julia::set_param(), Import::set_param(), NoiseDistort::set_param(), synfig::BooleanCurve::set_param(), and synfig::Value< T >::Value().

bool synfig::ValueBase::same_type_as | ( | const Type | testtype | ) | const`[inline]`

References same_type_as(), and type.

static bool synfig::ValueBase::same_type_as | ( | const Type | type1,
|  | const Type | type2 |
| ) |  |  | `[inline, static]`

Compares two types. Returns true if they are the same type.

References TYPE_REAL, and TYPE_TIME.

template<typename T>

const T& synfig::ValueBase::get | ( | const T &x | __attribute__(unused) | ) | const`[inline]`

References data, is_valid(), and same_type_as().

Referenced by synfig::ValueNode_Repeat_Gradient::create(), synfig::ValueNode_GradientRotate::create(), synfig::ValueNode_DynamicList::create_list_entry(), encode_animated(), encode_layer(), encode_value(), synfig::Layer::get_local_name(), synfig::Layer::get_name(), synfig::Layer_Mime::get_version(), synfig::Layer::get_version(), operator==(), Rotate::set_param(), Plant::set_param(), Noise::set_param(), Mandelbrot::set_param(), LinearGradient::set_param(), synfig::Layer_PasteCanvas::set_param(), synfig::Layer_Composite::set_param(), synfig::Layer_Bitmap::set_param(), synfig::Layer::set_param(), Julia::set_param(), Import::set_param(), NoiseDistort::set_param(), synfig::Layer_ColorCorrect::set_param(), synfig::ValueNode_Add::ValueNode_Add(), synfig::ValueNode_And::ValueNode_And(), synfig::ValueNode_Compare::ValueNode_Compare(), synfig::ValueNode_Duplicate::ValueNode_Duplicate(), synfig::ValueNode_Integer::ValueNode_Integer(), synfig::ValueNode_Logarithm::ValueNode_Logarithm(), synfig::ValueNode_Not::ValueNode_Not(), synfig::ValueNode_Or::ValueNode_Or(), synfig::ValueNode_Pow::ValueNode_Pow(), synfig::ValueNode_Reciprocal::ValueNode_Reciprocal(), and synfig::ValueNode_Subtract::ValueNode_Subtract().

float synfig::ValueBase::get | ( | const float & |  | ) | const`[inline]`

etl::loose_handle<Canvas> synfig::ValueBase::get | ( | const etl::handle< Canvas > & |  | ) | const`[inline]`

etl::loose_handle<Canvas> synfig::ValueBase::get | ( | Canvas * |  | ) | const`[inline]`

const char * ValueBase::get | ( | const char * |  | ) | const

const list_type& synfig::ValueBase::get_list | ( |  | ) | const`[inline]`

Referenced by synfig::convert_bline_to_segment_list(), synfig::convert_bline_to_width_list(), synfig::ValueNode_BLine::create(), synfig::ValueNode_DynamicList::create_from(), empty(), synfig::find_closest_point(), get_contained_type(), operator const list_type &(), operator std::list< T >(), operator std::vector< T >(), operator==(), operator[](), synfig::BooleanCurve::set_param(), Region::sync(), and Outline::sync().

template<typename T>

void synfig::ValueBase::put | ( | T * | x | ) | const`[inline]`

Reimplemented in synfig::Value< T >.

References data, and same_type_as().

Referenced by Star::set_param(), and synfig::Layer_PasteCanvas::set_param().

void synfig::ValueBase::put | ( | float * | x | ) | const`[inline]`

void synfig::ValueBase::put | ( | char ** | x | ) | const

template<typename T>

void synfig::ValueBase::set | ( | const T & | x | ) | `[inline]`

Reimplemented in synfig::Value< T >.

void synfig::ValueBase::set | ( | const float & | x | ) | `[inline]`

void ValueBase::set | ( | const list_type & | x | ) |

void ValueBase::set | ( | const char * | x | ) |

void ValueBase::set | ( | char * | x | ) |

void ValueBase::set | ( | Canvas * | x | ) |

References clear(), and synfig::Canvas::is_inline().

void ValueBase::set | ( | etl::loose_handle< Canvas > | x | ) |

References clear().

void ValueBase::set | ( | etl::handle< Canvas > | x | ) |

References clear().

template<class T>

void synfig::ValueBase::set | ( | const std::vector< T > & | x | ) | `[inline]`

template<class T>

void synfig::ValueBase::set | ( | const std::list< T > & | x | ) | `[inline]`

String ValueBase::type_name | ( | Type | id | ) | `[static]`

Returns a string containing the name of the given Type.

References N_, TYPE_ANGLE, TYPE_BLINEPOINT, TYPE_BOOL, TYPE_CANVAS, TYPE_COLOR, TYPE_GRADIENT, TYPE_INTEGER, TYPE_LIST, TYPE_NIL, TYPE_REAL, TYPE_SEGMENT, TYPE_STRING, TYPE_TIME, TYPE_VECTOR, and synfig::warning().

String ValueBase::type_local_name | ( | Type | id | ) | `[static]`

Returns a string containing the translated name of the given Type.

References dgettext, and type_name().

Referenced by synfig::ValueNode_Stripes::create(), synfig::ValueNode_Repeat_Gradient::create(), synfig::ValueNode_GradientRotate::create(), synfig::ValueNode_Animated::create(), synfig::LinkableValueNode::create(), synfig::ValueNode_Integer::operator()(), synfig::ValueNode_Add::ValueNode_Add(), synfig::ValueNode_Integer::ValueNode_Integer(), and synfig::ValueNode_Subtract::ValueNode_Subtract().

ValueBase::Type ValueBase::ident_type | ( | const String & | str | ) | `[static]`

Returns a the corresponding Type of the described type.

References _, TYPE_ANGLE, TYPE_BLINEPOINT, TYPE_BOOL, TYPE_CANVAS, TYPE_COLOR, TYPE_GRADIENT, TYPE_INTEGER, TYPE_LIST, TYPE_NIL, TYPE_REAL, TYPE_SEGMENT, TYPE_STRING, TYPE_TIME, and TYPE_VECTOR.

static Type synfig::ValueBase::get_type | ( | bool |  | ) | `[inline, static]`

References TYPE_BOOL.

static Type synfig::ValueBase::get_type | ( | int |  | ) | `[inline, static]`

References TYPE_INTEGER.

static Type synfig::ValueBase::get_type | ( | const Time & |  | ) | `[inline, static]`

References TYPE_TIME.

static Type synfig::ValueBase::get_type | ( | const Real & |  | ) | `[inline, static]`

References TYPE_REAL.

static Type synfig::ValueBase::get_type | ( | const float & |  | ) | `[inline, static]`

References TYPE_REAL.

static Type synfig::ValueBase::get_type | ( | const Vector & |  | ) | `[inline, static]`

References TYPE_VECTOR.

static Type synfig::ValueBase::get_type | ( | const Color & |  | ) | `[inline, static]`

References TYPE_COLOR.

static Type synfig::ValueBase::get_type | ( | const Segment & |  | ) | `[inline, static]`

References TYPE_SEGMENT.

static Type synfig::ValueBase::get_type | ( | const BLinePoint & |  | ) | `[inline, static]`

References TYPE_BLINEPOINT.

static Type synfig::ValueBase::get_type | ( | const String & |  | ) | `[inline, static]`

References TYPE_STRING.

static Type synfig::ValueBase::get_type | ( | const Gradient & |  | ) | `[inline, static]`

References TYPE_GRADIENT.

static Type synfig::ValueBase::get_type | ( | Canvas * |  | ) | `[inline, static]`

References TYPE_CANVAS.

static Type synfig::ValueBase::get_type | ( | const etl::handle< Canvas > & |  | ) | `[inline, static]`

References TYPE_CANVAS.

static Type synfig::ValueBase::get_type | ( | const etl::loose_handle< Canvas > & |  | ) | `[inline, static]`

References TYPE_CANVAS.

static Type synfig::ValueBase::get_type | ( | const list_type & |  | ) | `[inline, static]`

References TYPE_LIST.

template<class T>

static Type synfig::ValueBase::get_type | ( | const std::vector< T > & |  | ) | `[inline, static]`

References TYPE_LIST.

template<class T>

static Type synfig::ValueBase::get_type | ( | const std::list< T > & |  | ) | `[inline, static]`

References TYPE_LIST.

synfig::ValueBase::operator const list_type & | ( |  | ) | const`[inline]`

References get_list().

synfig::ValueBase::operator const Real & | ( |  | ) | const`[inline]`

synfig::ValueBase::operator const Vector & | ( |  | ) | const`[inline]`

synfig::ValueBase::operator const BLinePoint & | ( |  | ) | const`[inline]`

synfig::ValueBase::operator const Segment & | ( |  | ) | const`[inline]`

synfig::ValueBase::operator const Angle & | ( |  | ) | const`[inline]`

static Type synfig::ValueBase::get_type | ( | const Angle & |  | ) | `[inline, static]`

References TYPE_ANGLE.

template<class T>

synfig::ValueBase::operator std::list< T > | ( |  | ) | const`[inline]`

References get_list(), type, and TYPE_LIST.

template<class T>

synfig::ValueBase::operator std::vector< T > | ( |  | ) | const`[inline]`

References get_list(), type, and TYPE_LIST.

## Member Data Documentation

Type synfig::ValueBase::type `[protected]`

Referenced by clear(), empty(), get_contained_type(), get_type(), is_valid(), operator std::list< T >(), operator std::vector< T >(), operator=(), operator[](), same_type_as(), type_name(), and ValueBase().

void* synfig::ValueBase::data `[protected]`

Referenced by clear(), get(), operator=(), operator==(), put(), and ValueBase().

etl::reference_counter synfig::ValueBase::ref_count `[protected]`

Referenced by clear(), is_valid(), and operator=().

bool synfig::ValueBase::loop_ `[protected]`

Referenced by get_loop(), operator=(), and set_loop().

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

- value.h
- value.cpp