diff --git a/include/amqpcpp/libev.h b/include/amqpcpp/libev.h index fce14bf1..06a60c7b 100644 --- a/include/amqpcpp/libev.h +++ b/include/amqpcpp/libev.h @@ -8,7 +8,7 @@ * Compile with: "g++ -std=c++11 libev.cpp -lamqpcpp -lev -lpthread" * * @author Emiel Bruijntjes - * @copyright 2015 - 2018 Copernica BV + * @copyright 2015 - 2023 Copernica BV */ /** diff --git a/include/amqpcpp/metadata.h b/include/amqpcpp/metadata.h index 4a92d532..c2d5c0fb 100644 --- a/include/amqpcpp/metadata.h +++ b/include/amqpcpp/metadata.h @@ -273,6 +273,24 @@ class MetaData void setTypeName (const char *value) { _typeName.assign(value); _bools2.set(5,true); } void setMessageID (const char *value) { _messageID.assign(value); _bools2.set(7,true); } + /** + * Methods to remove properties from the header + */ + void removeExpiration () { _expiration .clear(); _bools1.set(0,false); } + void removeReplyTo () { _replyTo .clear(); _bools1.set(1,false); } + void removeCorrelationID () { _correlationID .clear(); _bools1.set(2,false); } + void removePriority () { _priority .clear(); _bools1.set(3,false); } + void removeDeliveryMode () { _deliveryMode .clear(); _bools1.set(4,false); } + void removeHeaders () { _headers .clear(); _bools1.set(5,false); } + void removeContentEncoding () { _contentEncoding.clear(); _bools1.set(6,false); } + void removeContentType () { _contentType .clear(); _bools1.set(7,false); } + void removeClusterID () { _clusterID .clear(); _bools2.set(2,false); } + void removeAppID () { _appID .clear(); _bools2.set(3,false); } + void removeUserID () { _userID .clear(); _bools2.set(4,false); } + void removeTypeName () { _typeName .clear(); _bools2.set(5,false); } + void removeTimestamp () { _timestamp .clear(); _bools2.set(6,false); } + void removeMessageID () { _messageID .clear(); _bools2.set(7,false); } + /** * Retrieve the fields * @return string diff --git a/include/amqpcpp/numericfield.h b/include/amqpcpp/numericfield.h index 6038f98b..1bbc5e70 100644 --- a/include/amqpcpp/numericfield.h +++ b/include/amqpcpp/numericfield.h @@ -1,7 +1,7 @@ /** * Numeric field types for AMQP * - * @copyright 2014 - 2020 Copernica BV + * @copyright 2014 - 2023 Copernica BV */ /** @@ -112,6 +112,16 @@ class NumericField : public Field _value = value; return *this; }; + + /** + * Clear the field + * @return NumericField + */ + NumericField& clear() + { + _value = 0; + return *this; + } /** * Get the value diff --git a/include/amqpcpp/stringfield.h b/include/amqpcpp/stringfield.h index e5a5234e..4f76fcc3 100644 --- a/include/amqpcpp/stringfield.h +++ b/include/amqpcpp/stringfield.h @@ -194,6 +194,19 @@ class StringField : public Field // allow chaining return *this; } + + /** + * Make the field empty + * @return StringField + */ + StringField &clear() + { + // clear internal dta + _data.clear(); + + // allow chaining + return *this; + } /** * Get the size this field will take when diff --git a/include/amqpcpp/table.h b/include/amqpcpp/table.h index db6768a4..7e669cd8 100644 --- a/include/amqpcpp/table.h +++ b/include/amqpcpp/table.h @@ -1,7 +1,7 @@ /** * AMQP field table * - * @copyright 2014 - 2020 Copernica BV + * @copyright 2014 - 2023 Copernica BV */ /** @@ -141,6 +141,16 @@ class Table : public Field Table &set(const std::string &name, const char *value) { return set(name, LongString(std::string(value))); } Table &set(const std::string &name, std::nullptr_t) { return set(name, VoidField()); } + /** + * Clear the entire table + * @return Table + */ + Table &clear() + { + _fields.clear(); + return *this; + } + /** * Is a certain field set in the table * @param name