projects
/
synfig.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Possibly fix 1841280: "Insert Item in animation mode renders badly before insertion"
[synfig.git]
/
synfig-core
/
trunk
/
src
/
synfig
/
value.h
diff --git
a/synfig-core/trunk/src/synfig/value.h
b/synfig-core/trunk/src/synfig/value.h
index
bbf83cf
..
2bf39bb
100644
(file)
--- a/
synfig-core/trunk/src/synfig/value.h
+++ b/
synfig-core/trunk/src/synfig/value.h
@@
-2,10
+2,11
@@
/*! \file value.h
** \brief Template Header
**
/*! \file value.h
** \brief Template Header
**
-** $Id
: value.h,v 1.1.1.1 2005/01/04 01:23:15 darco Exp
$
+** $Id$
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** Copyright (c) 2007 Chris Moore
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
@@
-200,10
+201,15
@@
public:
//! Checks the type of the parameter against itself. Returns true if they are of the same type.
template <class T> bool
//! Checks the type of the parameter against itself. Returns true if they are of the same type.
template <class T> bool
- same_as(const T &x)const
+ same_
type_
as(const T &x)const
{
const Type testtype(get_type(x));
{
const Type testtype(get_type(x));
+ return same_type_as(testtype);
+ }
+
+ bool same_type_as(const Type testtype)const
+ {
if(testtype==type)return true;
if( (type==TYPE_REAL || type==TYPE_TIME) &&
(testtype==TYPE_REAL || testtype==TYPE_TIME) )
if(testtype==type)return true;
if( (type==TYPE_REAL || type==TYPE_TIME) &&
(testtype==TYPE_REAL || testtype==TYPE_TIME) )
@@
-216,7
+222,7
@@
public:
template <typename T>
const T &get(const T& x)const
{
template <typename T>
const T &get(const T& x)const
{
- assert(is_valid() && same_as(x));
+ assert(is_valid() && same_
type_
as(x));
return *static_cast<const T*>(data);
}
float get(const float &)const { return get(Real()); }
return *static_cast<const T*>(data);
}
float get(const float &)const { return get(Real()); }
@@
-234,7
+240,7
@@
public:
template <typename T>
void put(T* x)const
{
template <typename T>
void put(T* x)const
{
- assert(same_as(*x));
+ assert(same_
type_
as(*x));
*x=*static_cast<const T*>(data);
}
void put(float* x)const { *x=get(Real()); }
*x=*static_cast<const T*>(data);
}
void put(float* x)const { *x=get(Real()); }
@@
-289,9
+295,9
@@
public:
static const Type get_type(const etl::loose_handle<Canvas>&)
{ return TYPE_CANVAS; }
static const Type get_type(const list_type&) { return TYPE_LIST; }
static const Type get_type(const etl::loose_handle<Canvas>&)
{ return TYPE_CANVAS; }
static const Type get_type(const list_type&) { return TYPE_LIST; }
- template <class T> static const Type get_type(const std::vector<T> &
x
)
+ template <class T> static const Type get_type(const std::vector<T> &
/*x*/
)
{ return TYPE_LIST; }
{ return TYPE_LIST; }
- template <class T> static const Type get_type(const std::list<T> &
x
)
+ template <class T> static const Type get_type(const std::list<T> &
/*x*/
)
{ return TYPE_LIST; }
// ========================================================================
{ return TYPE_LIST; }
// ========================================================================
@@
-390,7
+396,7
@@
public:
Value(const ValueBase &x):ValueBase(x)
{
Value(const ValueBase &x):ValueBase(x)
{
- if(!x.same_as(T()))
+ if(!x.same_
type_
as(T()))
throw Exception::BadType("Value<T>(ValueBase): Type Mismatch");
}
throw Exception::BadType("Value<T>(ValueBase): Type Mismatch");
}
@@
-410,7
+416,7
@@
public:
Value<T>& operator=(const ValueBase& x)
{
Value<T>& operator=(const ValueBase& x)
{
- if(!x.same_as(T()))
+ if(!x.same_
type_
as(T()))
throw Exception::BadType("Value<T>(ValueBase): Type Mismatch");
return ValueBase::operator=(x);
}
throw Exception::BadType("Value<T>(ValueBase): Type Mismatch");
return ValueBase::operator=(x);
}
@@
-427,7
+433,7
@@
public:
}
Value(const ValueBase &x):ValueBase(x)
{
}
Value(const ValueBase &x):ValueBase(x)
{
- if(!x.same_as(T()))
+ if(!x.same_
type_
as(T()))
throw Exception::BadType("Value<T>(ValueBase): Type Mismatch");
}
Value()
throw Exception::BadType("Value<T>(ValueBase): Type Mismatch");
}
Value()
@@
-446,7
+452,7
@@
public:
Value<T>& operator=(const ValueBase& x)
{
Value<T>& operator=(const ValueBase& x)
{
- if(!x.same_as(T()))
+ if(!x.same_
type_
as(T()))
throw Exception::BadType("Value<T>(ValueBase): Type Mismatch");
return ValueBase::operator=(x);
}
throw Exception::BadType("Value<T>(ValueBase): Type Mismatch");
return ValueBase::operator=(x);
}