PIPropertyStorage: add return values and documentation in some functions

This commit is contained in:
2020-11-25 12:39:15 +03:00
parent 65d2f6b6e4
commit e0e8266b59
3 changed files with 76 additions and 29 deletions

View File

@@ -110,24 +110,49 @@ public:
PIVector<Property> & properties() {return props;}
const PIVector<Property> & properties() const {return props;}
const PIPropertyStorage & propertyStorage() const {return *this;}
/**
* @brief Check if property with \a name exists
* @return "true" if property exists
*/
bool isPropertyExists(const PIString & _name) const;
/**
* @brief Remove all properties
*/
void clearProperties() {props.clear();}
/**
* @brief Add property if name isn't present in storage, otherwrise update existing property with same name.
*
* @return "true" if new property added, else if update existing property return "false"
* @param p to copy in storage
*/
void addProperty(const Property & p);
void addProperty(Property && p);
bool addProperty(const Property & p);
bool addProperty(Property && p);
/**
* @brief First of all construct Property with method params. After then add property if name isn't present
* in storage, otherwrise update existing property with same name.
* @return "true" if new property added, else if update existing property return "false"
*/
bool addProperty(const PIString & _name, const PIVariant & _def_value, const PIString & _comment = PIString(), int _flags = 0);
/**
* @brief Remove property with \a name
* @return "true" if property exists and removed
*/
bool removeProperty(const PIString & _name);
/**
* @brief Remove properties wich has \a flag set
* @return removed properties count
*/
int removePropertiesByFlag(int flag);
/**
* @brief Merge other \a properties_ into this
* @param flag_ignore - properties wich has this flag set will be ignored in merge
*/
void addProperty(const PIString & _name, const PIVariant & _def_value, const PIString & _comment = PIString(), int _flags = 0) {addProperty(Property(_name, _comment, _def_value, _flags));}
void removeProperty(const PIString & _name);
void removePropertiesByFlag(int flag);
void updateProperties(const PIVector<Property> & properties_, int flag_ignore = 0);
/**
@@ -151,24 +176,27 @@ public:
*
* @param name of property to set value
* @param value to set
* @return "true" if property exists and updated
*/
void setPropertyValue(const PIString & name, const PIVariant & value);
bool setPropertyValue(const PIString & name, const PIVariant & value);
/**
* @brief Set comment of property with specific name if name is present in storage.
*
* @param name of property to set comment
* @param comment to set
* @return "true" if property exists and updated
*/
void setPropertyComment(const PIString & name, const PIString & comment);
bool setPropertyComment(const PIString & name, const PIString & comment);
/**
* @brief Set flags of property with specific name if name is present in storage.
*
* @param name of property to set flags
* @param flags to set
* @return "true" if property exists and updated
*/
void setPropertyFlags(const PIString & name, int flags);
bool setPropertyFlags(const PIString & name, int flags);
PIPropertyStorage & operator <<(const PIPropertyStorage::Property & p) {props << p; return *this;}
PIPropertyStorage & operator <<(const PIVector<Property> & p) {props << p; return *this;}