2 #pragma warning(disable : 4251) 15 #include <boost/unordered_set.hpp> 24 static const char*
Get() {
return typeid(T).
name(); }
47 cDebug(
"ERROR: Trying to fill PropertyLink with object of wrong type!");
70 const boost::unordered_set<T>&
getValue()
const {
return *(
const boost::unordered_set<T>*)(&
_linkSet); }
96 virtual void setValue(
const std::list<Core::DocObject*>& list)
override;
97 virtual bool setValueFromVariant(
const Core::Variant& value)
override;
102 virtual void setEmpty()
override;
107 virtual bool isEqual(
const Property* p)
const override;
115 template <
typename T>
121 void setValue(
const std::list<T>& aList);
141 template <
typename T>
147 template <
typename T>
150 return std::find(_linkList.begin(), _linkList.end(), link) != _linkList.end();
153 template <
typename T>
157 return _linkList == other->_linkList;
162 template <
typename T>
168 _linkList.push_back(link);
172 template <
typename T>
178 _linkList.remove(link);
182 template <
typename T>
192 _linkList = *(
const std::list<Core::DocObject*>*)(&list);
202 template <
typename T>
207 std::list<Core::DocObject*> linkList = value.
toLinkList();
210 if (o && !dynamic_cast<T>(o))
212 cDebug(
"ERROR: Cannot set Core::PropertyTypedLinkList value");
216 setValue(*(
const std::list<T>*)(&linkList));
220 cDebug(
"ERROR: Cannot set Core::PropertyTypedLinkList value");
224 template <
typename T>
227 assert(p->
getTypeId() == getTypeId() &&
"Wrong property type!");
235 template <
typename T>
248 template <
typename T>
253 std::vector<Core::DocObject*> toSave;
259 toSave.push_back(obj);
261 else if (obj && (!obj->isTemporary() || obj->mustbeSaved()))
263 toSave.push_back(obj);
267 writer <<
"<Link size=\"" << toSave.
size() <<
"\"/>";
271 writer <<
"<Link value=\"" << (link ? link->getId() : std::string()) <<
"\"/>";
275 template <
typename T>
284 for (
int i = 0; i < size; i++)
293 T link = dynamic_cast<T>(cd->getObjectById(
id));
297 _linkList.push_back(link);
301 cDebug(
"Error: Core::PropertyLinkList::restore ExecObject: %s not found!",
id.c_str());
T getValue() const
Definition: PropertyLink.h:39
void setValue(const std::list< T > &aList)
Definition: PropertyLink.h:183
Definition: PropertyLink.h:22
const std::list< T > & getValue() const
Definition: PropertyLink.h:124
bool isEqual(const Property *) const override
compare properties
Definition: PropertyLink.h:154
#define CORE_EXPORT
Definition: core_defines2.h:10
std::list< Core::DocObject * > _linkList
Definition: PropertyLinkListBase.h:45
Definition: PropertyLink.h:116
void addLinks(const boost::unordered_set< T > &linkset)
Definition: PropertyLink.h:75
virtual Base::String getAttribute(const char *AttrName) const =0
bool hasLink(T link) const
Definition: PropertyLink.h:148
Definition: PropertyLink.h:32
bool setValueFromVariant(const Core::Variant &value) override
Definition: PropertyLink.h:203
virtual bool removeLink(Core::DocObject *link)
Definition: Object_Hnd.h:17
Definition: PropertyLink.h:88
virtual long getAttributeAsInteger(const char *AttrName) const =0
CORE_EXPORT Core::LogClass cDebug()
void save(Base::AbstractWriter &writer, Base::PersistanceVersion &version) override
This method is used to save properties or very small amounts of data to an XML document.
Definition: PropertyLink.h:249
virtual void readElement(const char *ElementName=0)=0
void setValue(const boost::unordered_set< T > &linkset)
Definition: PropertyLink.h:69
Core::PropertyText name
Definition: CoreDocument.h:143
Definition: PropertyLinkListBase.h:13
virtual Type getTypeId(void) const
virtual bool addLink(Core::DocObject *link)
const boost::unordered_set< T > & getValue() const
Definition: PropertyLink.h:70
bool canConvert(Variant::Type t) const
Definition: PropertyLink.h:63
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:29
Definition: Persistance.h:20
LX_CORE_EXPORT Version & version
size_t getSize() const
Definition: PropertyLink.h:133
Definition: CoreDocument.h:197
virtual void setValue(Core::DocObject *o)
std::list< Core::DocObject * > toLinkList(bool *ok=nullptr) const
#define UNUSED(expr)
Definition: Enums.h:16
Definition: AbstractXMLReader.h:10
virtual void restore(Base::AbstractXMLReader &reader, Base::PersistanceVersion &version) override
This method is used to restore properties from an XML document.
Definition: PropertyLink.h:41
Definition: PropertyLinkBase.h:15
static const char * Get()
Definition: PropertyLink.h:24
static const Type createType(const Type parent, const char *name, instantiationMethod method=0)
bool removeLink(T link)
Definition: PropertyLink.h:73
bool addLink(T link)
Definition: PropertyLink.h:72
void addLink(T link)
Definition: PropertyLink.h:163
Definition: PropertyLinkSetBase.h:12
virtual uint64_t size()
Definition: Writer.h:80
void setEmpty()
Definition: PropertyLink.h:236
void restore(Base::AbstractXMLReader &reader, Base::PersistanceVersion &version) override
This method is used to restore properties from an XML document.
Definition: PropertyLink.h:276
boost::unordered_set< Core::DocObject * > _linkSet
Definition: PropertyLinkSetBase.h:51
virtual void restore(Base::AbstractXMLReader &reader, Base::PersistanceVersion &version) override
This method is used to restore properties from an XML document.
Core::DocObject * getValue() const
Definition: Variant.h:163
void setValue(T value)
Definition: PropertyLink.h:38
virtual void addLinks(const boost::unordered_set< Core::DocObject * > &linkset)
static const Type badType(void)
Definition: Type.h:103
Definition: Property.h:81
Core::Object_Hnd hObject
Definition: PropertyLinkBase.h:47
bool isEmpty() const
Definition: PropertyLink.h:131
void copyValue(Core::Property *p) override
Definition: PropertyLink.h:225
void removeLink(T link)
Definition: PropertyLink.h:173
DECLARE_PROPERTY_FACTORY(PropertyAxis1_Factory, Core::PropertyAxis1)
Definition: DocObject.h:28
virtual void setValue(const boost::unordered_set< Core::DocObject * > &set)