Go to the documentation of this file.
17 static const char*
Get() {
return typeid(T).name(); }
40 cDebug(
"ERROR: Trying to fill PropertyLink with object of wrong type!");
75 const std::unordered_set<T>&
getValue()
const {
return *(
const std::unordered_set<T>*)(&
_linkSet); }
101 void setValue(
const std::list<Core::DocObject*>& list)
override;
120 template <
typename T>
126 void setValue(
const std::list<T>& aList);
146 template <
typename T>
152 template <
typename T>
155 return std::find(_linkList.begin(), _linkList.end(), link) != _linkList.end();
158 template <
typename T>
162 return _linkList == other->_linkList;
167 template <
typename T>
177 _linkList.push_back(link);
182 template <
typename T>
193 _linkList.remove(link);
200 template <
typename T>
210 onRemoveLinks(_linkList);
211 _linkList = *(
const std::list<Core::DocObject*>*)(&list);
212 onAddLinks(_linkList);
222 template <
typename T>
227 std::list<Core::DocObject*> linkList = value.
toLinkList();
230 if (o && !
dynamic_cast<T
>(o))
232 cDebug(
"ERROR: Cannot set Core::PropertyTypedLinkList value");
236 setValue(*(
const std::list<T>*)(&linkList));
240 cDebug(
"ERROR: Cannot set Core::PropertyTypedLinkList value");
244 template <
typename T>
247 assert(p->
getTypeId() == getTypeId() &&
"Wrong property type!");
255 template <
typename T>
265 onRemoveLinks(_linkList);
270 template <
typename T>
273 std::vector<Core::DocObject*> toSave;
279 toSave.push_back(obj);
281 else if (obj && (!obj->isTemporary() || obj->mustbeSaved()))
283 toSave.push_back(obj);
287 writer <<
"<Link size=\"" << toSave.
size() <<
"\"/>";
291 writer <<
"<Link value=\"" << (link ? link->getId() : std::string()) <<
"\"/>";
295 template <
typename T>
302 for (
int i = 0; i < size; i++)
316 _linkList.push_back(link);
320 cDebug(
"Error: Core::PropertyLinkList::restore ExecObject: %s not found!",
id.c_str());
void save(Base::AbstractWriter &writer, Base::PersistenceVersion &version) override
This method is used to save properties or very small amounts of data to an XML document.
Definition: PropertyLink.h:271
static const Type badType(void)
Definition: Type.h:97
Definition: CoreDocument.h:269
virtual bool addLink(Core::DocObject *link) override
Definition: PropertyLinkSetBase.h:10
void setValue(const std::unordered_set< T > &linkset)
Definition: PropertyLink.h:74
bool removeLink(T link)
Definition: PropertyLink.h:78
void setEmpty()
Definition: PropertyLink.h:256
Definition: PropertyLink.h:69
bool addLink(Core::DocObject *o) override
Core::Variant getVariant() const override
virtual void addLinks(const std::unordered_set< Core::DocObject * > &linkset)
LX_BASE_EXPORT Base::LogClass cDebug()
bool isEmpty() const
Definition: PropertyLink.h:136
Definition: PropertyLinkBase.h:15
void copyValue(Core::Property *p) override
Definition: PropertyLink.h:245
Definition: PropertyLinkListBase.h:10
virtual bool removeLink(Core::DocObject *link) override
bool canConvert(Variant::Type t) const
static const Type createType(const Type parent, const char *name, instantiationMethod method=0)
virtual uint64_t size()
Definition: Writer.h:63
Core::DocObject * getValue() const
Definition: DocObject.h:54
virtual long getAttributeAsInteger(const char *AttrName) const =0
Definition: Persistence.h:13
void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &lversion) override
This method is used to restore properties from an XML document.
Definition: PropertyLink.h:34
bool addLink(T link)
Definition: PropertyLink.h:168
bool removeLink(Core::DocObject *o) override
Core::Object_Hnd hObject
Definition: PropertyLinkBase.h:50
void setValue(const std::list< T > &aList)
Definition: PropertyLink.h:201
const std::list< T > & getValue() const
Definition: PropertyLink.h:129
std::list< Core::DocObject * > toLinkList(bool *ok=nullptr) const
bool addLink(DocObject *o) override
Definition: PropertyLink.h:50
bool isEqual(const Property *) const override
compare properties
Definition: PropertyLink.h:159
Definition: AbstractXMLReader.h:7
void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version) override
This method is used to restore properties from an XML document.
Definition: PropertyLink.h:296
void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version) override
This method is used to restore properties from an XML document.
bool removeLink(DocObject *) override
Definition: PropertyLink.h:44
const std::unordered_set< T > & getValue() const
Definition: PropertyLink.h:75
virtual Core::DocObject * getObjectById(const DocObject::IdType &id) const
Returns the object with this id.
bool removeLink(T link)
Definition: PropertyLink.h:183
Definition: PropertyLink.h:26
@ Valid
Definition: Object_Hnd.h:16
void setValue(const std::list< Core::DocObject * > &list) override
virtual Base::String getAttribute(const char *AttrName) const =0
bool hasLink(T link) const
Definition: PropertyLink.h:153
bool setValueFromVariant(const Core::Variant &value) override
Definition: PropertyLink.h:223
void setValue(T value)
Definition: PropertyLink.h:31
void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version) override
This method is used to restore properties from an XML document.
void copyValue(Core::Property *p) override
LX_CORE_EXPORT Version & version
static const char * Get()
Definition: PropertyLink.h:17
Definition: Property.h:72
virtual ~PropertyLinkList()=default
size_t getSize() const
Definition: PropertyLink.h:138
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:18
bool isEqual(const Property *p) const override
compare properties
bool addLink(T link)
Definition: PropertyLink.h:77
void addLinks(const std::unordered_set< T > &linkset)
Definition: PropertyLink.h:80
PropertyLinkList()=default
virtual Type getTypeId(void) const
Definition: PropertyLink.h:122
#define TYPESYSTEM_HEADER()
define for subclassing Base::BaseClass
Definition: Base.h:12
DECLARE_PROPERTY_FACTORY(PropertyAxis1_Factory, Core::PropertyAxis1)
virtual void setValue(const std::unordered_set< Core::DocObject * > &set)
bool setValueFromVariant(const Core::Variant &value) override
Definition: PropertyLink.h:94
std::list< Core::DocObject * > _linkList
Definition: PropertyLinkListBase.h:41
virtual void setValue(Core::DocObject *o)
T getValue() const
Definition: PropertyLink.h:32
std::unordered_set< Core::DocObject * > _linkSet
Definition: PropertyLinkSetBase.h:48
Definition: PropertyLink.h:16
virtual void readElement(const char *ElementName=0)=0
@ LinkList
Definition: Variant.h:152