2 #pragma warning(disable : 4251) 13 #include <unordered_set> 21 static const char*
Get() {
return typeid(T).
name(); }
44 cDebug(
"ERROR: Trying to fill PropertyLink with object of wrong type!");
73 const std::unordered_set<T>&
getValue()
const {
return *(
const std::unordered_set<T>*)(&
_linkSet); }
100 virtual bool setValueFromVariant(
const Core::Variant& value)
override;
105 virtual void setEmpty()
override;
110 virtual bool isEqual(
const Property* p)
const override;
118 template <
typename T>
144 template <
typename T>
150 template <
typename T>
153 return std::find(_linkList.begin(), _linkList.end(), link) != _linkList.end();
156 template <
typename T>
160 return _linkList == other->_linkList;
165 template <
typename T>
175 _linkList.push_back(link);
179 template <
typename T>
191 _linkList.remove(link);
196 template <
typename T>
218 template <
typename T>
226 if (o && !dynamic_cast<T>(o))
228 cDebug(
"ERROR: Cannot set Core::PropertyTypedLinkList value");
236 cDebug(
"ERROR: Cannot set Core::PropertyTypedLinkList value");
240 template <
typename T>
243 assert(p->
getTypeId() == getTypeId() &&
"Wrong property type!");
251 template <
typename T>
266 template <
typename T>
270 std::vector<Core::DocObject*> toSave;
276 toSave.push_back(obj);
278 else if (obj && (!obj->isTemporary() || obj->mustbeSaved()))
280 toSave.push_back(obj);
284 writer <<
"<Link size=\"" << toSave.
size() <<
"\"/>";
288 writer <<
"<Link value=\"" << (link ? link->getId() : std::string()) <<
"\"/>";
292 template <
typename T>
300 for (
int i = 0; i < size; i++)
309 T link = dynamic_cast<T>(cd->getObjectById(
id));
314 _linkList.push_back(link);
318 cDebug(
"Error: Core::PropertyLinkList::restore ExecObject: %s not found!",
id.c_str());
T getValue() const
Definition: PropertyLink.h:36
void setValue(const std::list< T > &aList)
Definition: PropertyLink.h:197
Definition: PropertyLink.h:19
const std::list< T > & getValue() const
Definition: PropertyLink.h:127
bool isEqual(const Property *) const override
compare properties
Definition: PropertyLink.h:157
std::list< Core::DocObject * > _linkList
Definition: PropertyLinkListBase.h:46
Definition: PropertyLink.h:119
LX_BASE_EXPORT Base::LogClass cDebug()
void onAddLinks(PropertyLinkBaseBase *p, Core::DocObject *from, const std::list< Core::DocObject * > &linkList)
void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version) override
This method is used to restore properties from an XML document.
Definition: PropertyLink.h:293
Definition: Persistence.h:14
virtual Base::String getAttribute(const char *AttrName) const =0
bool hasLink(T link) const
Definition: PropertyLink.h:151
Definition: PropertyLink.h:29
bool setValueFromVariant(const Core::Variant &value) override
Definition: PropertyLink.h:219
Definition: Object_Hnd.h:16
Definition: PropertyLink.h:91
bool removeLink(T link)
Definition: PropertyLink.h:180
virtual long getAttributeAsInteger(const char *AttrName) const =0
virtual void readElement(const char *ElementName=0)=0
Core::PropertyText name
Definition: CoreDocument.h:167
Definition: PropertyLinkListBase.h:12
virtual Type getTypeId(void) const
virtual bool addLink(Core::DocObject *link)
bool canConvert(Variant::Type t) const
Definition: PropertyLink.h:66
const std::unordered_set< T > & getValue() const
Definition: PropertyLink.h:73
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:23
LX_CORE_EXPORT Version & version
size_t getSize() const
Definition: PropertyLink.h:136
Definition: CoreDocument.h:210
virtual void setValue(Core::DocObject *o)
std::list< Core::DocObject * > toLinkList(bool *ok=nullptr) const
#define UNUSED(expr)
Definition: Enums.h:12
Definition: AbstractXMLReader.h:7
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:267
Definition: PropertyLinkBase.h:15
std::unordered_set< Core::DocObject * > _linkSet
Definition: PropertyLinkSetBase.h:52
static const char * Get()
Definition: PropertyLink.h:21
static const Type createType(const Type parent, const char *name, instantiationMethod method=0)
void onRemoveLinks(PropertyLinkBaseBase *p, Core::DocObject *from, const std::list< Core::DocObject * > &linkList)
bool removeLink(T link)
Definition: PropertyLink.h:76
bool addLink(T link)
Definition: PropertyLink.h:75
void addLink(T link)
Definition: PropertyLink.h:166
Definition: PropertyLinkSetBase.h:11
virtual void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version) override
This method is used to restore properties from an XML document.
Definition: PropertyLink.h:38
virtual bool removeLink(Core::DocObject *link) override
virtual uint64_t size()
Definition: Writer.h:69
void setEmpty()
Definition: PropertyLink.h:252
virtual void setValue(const std::unordered_set< Core::DocObject * > &set)
void onAddLink(PropertyLinkBaseBase *p, Core::DocObject *from, Core::DocObject *o)
void addLinks(const std::unordered_set< T > &linkset)
Definition: PropertyLink.h:78
virtual void addLinks(const std::unordered_set< Core::DocObject * > &linkset)
Core::DocObject * getValue() const
Definition: Variant.h:161
void setValue(T value)
Definition: PropertyLink.h:35
static const Type badType(void)
Definition: Type.h:99
Definition: Property.h:77
Core::Object_Hnd hObject
Definition: PropertyLinkBase.h:51
bool isEmpty() const
Definition: PropertyLink.h:134
void onRemoveLink(PropertyLinkBaseBase *p, Core::DocObject *from, Core::DocObject *o)
void copyValue(Core::Property *p) override
Definition: PropertyLink.h:241
virtual bool removeLink(DocObject *o) override
Definition: PropertyLink.h:48
void setValue(const std::unordered_set< T > &linkset)
Definition: PropertyLink.h:72
virtual void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version) override
This method is used to restore properties from an XML document.
DECLARE_PROPERTY_FACTORY(PropertyAxis1_Factory, Core::PropertyAxis1)
Definition: DocObject.h:51