File indexing completed on 2024-04-28 16:30:32
0001 /*************************************************************************** 0002 * SPDX-FileCopyrightText: 2022 S. MANKOWSKI stephane@mankowski.fr 0003 * SPDX-FileCopyrightText: 2022 G. DE BURE support@mankowski.fr 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 ***************************************************************************/ 0006 #ifndef SKGPROPERTYOBJECT_H 0007 #define SKGPROPERTYOBJECT_H 0008 /** @file 0009 * This file defines classes SKGPropertyObject. 0010 * 0011 * @author Stephane MANKOWSKI / Guillaume DE BURE 0012 */ 0013 0014 #include "skgdefine.h" 0015 #include "skgnamedobject.h" 0016 0017 class SKGDocument; 0018 /** 0019 * This class manages properties on objects 0020 */ 0021 class SKGBASEMODELER_EXPORT SKGPropertyObject final : public SKGNamedObject 0022 { 0023 /** 0024 * Value of the property 0025 */ 0026 Q_PROPERTY(QString value READ getValue WRITE setValue) // clazy:exclude=qproperty-without-notify 0027 /** 0028 * Parent identifier of the property 0029 */ 0030 Q_PROPERTY(QString parentId READ getParentId WRITE setParentId) // clazy:exclude=qproperty-without-notify 0031 public: 0032 /** 0033 * Default constructor 0034 */ 0035 explicit SKGPropertyObject(); 0036 0037 /** 0038 * Constructor 0039 * @param iDocument the document containing the object 0040 * @param iID the identifier in @p iTable of the object 0041 */ 0042 explicit SKGPropertyObject(SKGDocument* iDocument, int iID = 0); 0043 0044 /** 0045 * Copy constructor 0046 * @param iObject the object to copy 0047 */ 0048 SKGPropertyObject(const SKGPropertyObject& iObject); 0049 0050 /** 0051 * Copy constructor 0052 * @param iObject the object to copy 0053 */ 0054 explicit SKGPropertyObject(const SKGObjectBase& iObject); 0055 0056 /** 0057 * Operator affectation 0058 * @param iObject the object to copy 0059 */ 0060 SKGPropertyObject& operator= (const SKGObjectBase& iObject); 0061 0062 /** 0063 * Operator affectation 0064 * @param iObject the object to copy 0065 */ 0066 SKGPropertyObject& operator= (const SKGPropertyObject& iObject); 0067 0068 /** 0069 * Destructor 0070 */ 0071 virtual ~SKGPropertyObject(); 0072 0073 /** 0074 * Set the value of the property 0075 * @param iValue the value of the property 0076 * @return an object managing the error. 0077 * @see SKGError 0078 */ 0079 SKGError setValue(const QString& iValue); 0080 0081 /** 0082 * Get the value of the property 0083 * @return the value of the property 0084 */ 0085 QString getValue() const; 0086 0087 /** 0088 * Set the parent identifier 0089 * @param iParentId the parent identifier 0090 * @return an object managing the error. 0091 * @see SKGError 0092 */ 0093 SKGError setParentId(const QString& iParentId); 0094 0095 /** 0096 * Get the parent identifier 0097 * @return the parent identifier 0098 */ 0099 QString getParentId() const; 0100 0101 /** 0102 * Get the url of the property 0103 * @param iBuildTemporaryFile to build the temporary file if needed 0104 * @return the url of the property 0105 */ 0106 QUrl getUrl(bool iBuildTemporaryFile = false) const; 0107 0108 protected: 0109 /** 0110 * Get where clause needed to identify objects. 0111 * For this class, the whereclause is based on name + t_uuid_parent 0112 * @return the where clause 0113 */ 0114 QString getWhereclauseId() const override; 0115 }; 0116 /** 0117 * Declare the class 0118 */ 0119 Q_DECLARE_TYPEINFO(SKGPropertyObject, Q_MOVABLE_TYPE); 0120 #endif