/** Parent class for classes which represent a single scalar property in a Stateful object */
template<class T>
-class LIBPBD_API PropertyTemplate : public PropertyBase
+class /*LIBPBD_API*/ PropertyTemplate : public PropertyBase
{
public:
PropertyTemplate (PropertyDescriptor<T> p, T const& v)
/* MANAGEMENT OF Stateful State */
-
+
bool set_value (XMLNode const & node) {
XMLProperty const* p = node.property (property_name());
node.add_property (property_name(), to_string (_current));
}
-
+
/* MANAGEMENT OF HISTORY */
-
+
void clear_changes () {
_have_old = false;
}
/* TRANSFERRING HISTORY TO / FROM A StatefulDiffCommand */
-
+
void get_changes_as_xml (XMLNode* history_node) const {
XMLNode* node = history_node->add_child (property_name());
node->add_property ("from", to_string (_old));
}
_current = v;
- }
+ }
}
virtual std::string to_string (T const& v) const = 0;
PropertyTemplate (PropertyTemplate<T> const &);
};
-template<class T> LIBPBD_API
+template<class T> /*LIBPBD_API*/
std::ostream & operator<<(std::ostream& os, PropertyTemplate<T> const& s)
{
return os << s.val ();
* with types that can be written to / read from stringstreams.
*/
template<class T>
-class LIBPBD_API Property : public PropertyTemplate<T>
+class /*LIBPBD_API*/ Property : public PropertyTemplate<T>
{
public:
Property (PropertyDescriptor<T> q, T const& v)
Property<T>* clone () const {
return new Property<T> (this->property_id(), this->_old, this->_current);
}
-
+
Property<T>* clone_from_xml (const XMLNode& node) const {
XMLNodeList const & children = node.children ();
XMLNodeList::const_iterator i = children.begin();
}
XMLProperty* from = (*i)->property ("from");
XMLProperty* to = (*i)->property ("to");
-
+
if (!from || !to) {
return 0;
}
-
+
return new Property<T> (this->property_id(), from_string (from->value()), from_string (to->value ()));
}
* separators, etc.
*/
template<>
-class LIBPBD_API Property<std::string> : public PropertyTemplate<std::string>
+class /*LIBPBD_API*/ Property<std::string> : public PropertyTemplate<std::string>
{
public:
Property (PropertyDescriptor<std::string> d, std::string const & v)
Property (PropertyDescriptor<std::string> d, std::string const & o, std::string const & c)
: PropertyTemplate<std::string> (d, o, c)
{}
-
+
Property<std::string>* clone () const {
return new Property<std::string> (this->property_id(), _old, _current);
}
};
template<class T>
-class LIBPBD_API EnumProperty : public Property<T>
+class /*LIBPBD_API*/ EnumProperty : public Property<T>
{
public:
EnumProperty (PropertyDescriptor<T> q, T const& v)
* one.
*/
template <class T>
-class LIBPBD_API SharedStatefulProperty : public PropertyBase
+class /*LIBPBD_API*/ SharedStatefulProperty : public PropertyBase
{
public:
typedef boost::shared_ptr<T> Ptr;
-
+
SharedStatefulProperty (PropertyID d, Ptr p)
: PropertyBase (d)
, _current (p)
{
-
+
}
SharedStatefulProperty (PropertyID d, Ptr o, Ptr c)
, _old (o)
, _current (c)
{
-
+
}
bool set_value (XMLNode const & node) {
}
operator bool () const {
- return _current;
+ return _current ? true : false;
}
protected: