added more parameter-types to set properties in the envelope
This commit is contained in:
parent
1c08399ab0
commit
ee6ed20430
|
|
@ -230,7 +230,6 @@ public:
|
|||
|
||||
/**
|
||||
* Set the various supported fields using r-value references
|
||||
*
|
||||
* @param value moveable value
|
||||
*/
|
||||
void setExpiration (std::string &&value) { _expiration = std::move(value); _bools1.set(0,true); }
|
||||
|
|
@ -245,6 +244,37 @@ public:
|
|||
void setTypeName (std::string &&value) { _typeName = std::move(value); _bools2.set(5,true); }
|
||||
void setMessageID (std::string &&value) { _messageID = std::move(value); _bools2.set(7,true); }
|
||||
|
||||
/**
|
||||
* Set the various supported fields using data buffers
|
||||
* @param value data buffer
|
||||
* @param size size of the buffer
|
||||
*/
|
||||
void setExpiration (const char *value, size_t size) { _expiration.assign(value, size); _bools1.set(0,true); }
|
||||
void setReplyTo (const char *value, size_t size) { _replyTo.assign(value, size); _bools1.set(1,true); }
|
||||
void setCorrelationID (const char *value, size_t size) { _correlationID.assign(value, size); _bools1.set(2,true); }
|
||||
void setContentEncoding (const char *value, size_t size) { _contentEncoding.assign(value, size); _bools1.set(6,true); }
|
||||
void setContentType (const char *value, size_t size) { _contentType.assign(value, size); _bools1.set(7,true); }
|
||||
void setClusterID (const char *value, size_t size) { _clusterID.assign(value, size); _bools2.set(2,true); }
|
||||
void setAppID (const char *value, size_t size) { _appID.assign(value, size); _bools2.set(3,true); }
|
||||
void setUserID (const char *value, size_t size) { _userID.assign(value, size); _bools2.set(4,true); }
|
||||
void setTypeName (const char *value, size_t size) { _typeName.assign(value, size); _bools2.set(5,true); }
|
||||
void setMessageID (const char *value, size_t size) { _messageID.assign(value, size); _bools2.set(7,true); }
|
||||
|
||||
/**
|
||||
* Set the various supported fields using c strings
|
||||
* @param value data buffer
|
||||
*/
|
||||
void setExpiration (const char *value) { _expiration.assign(value); _bools1.set(0,true); }
|
||||
void setReplyTo (const char *value) { _replyTo.assign(value); _bools1.set(1,true); }
|
||||
void setCorrelationID (const char *value) { _correlationID.assign(value); _bools1.set(2,true); }
|
||||
void setContentEncoding (const char *value) { _contentEncoding.assign(value); _bools1.set(6,true); }
|
||||
void setContentType (const char *value) { _contentType.assign(value); _bools1.set(7,true); }
|
||||
void setClusterID (const char *value) { _clusterID.assign(value); _bools2.set(2,true); }
|
||||
void setAppID (const char *value) { _appID.assign(value); _bools2.set(3,true); }
|
||||
void setUserID (const char *value) { _userID.assign(value); _bools2.set(4,true); }
|
||||
void setTypeName (const char *value) { _typeName.assign(value); _bools2.set(5,true); }
|
||||
void setMessageID (const char *value) { _messageID.assign(value); _bools2.set(7,true); }
|
||||
|
||||
/**
|
||||
* Retrieve the fields
|
||||
* @return string
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* String field types for amqp
|
||||
*
|
||||
* @copyright 2014 Copernica BV
|
||||
* @copyright 2014 - 2020 Copernica BV
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
@ -43,17 +43,28 @@ public:
|
|||
|
||||
/**
|
||||
* Construct based on a std::string
|
||||
*
|
||||
* @param value string value
|
||||
*/
|
||||
StringField(const std::string &value) : _data(value) {}
|
||||
|
||||
/**
|
||||
* Construct based on a std::string
|
||||
*
|
||||
* @param value string value
|
||||
*/
|
||||
StringField(std::string &&value) : _data(std::move(value)) {}
|
||||
|
||||
/**
|
||||
* Construct based on a buffer
|
||||
* @param buffer buffer value
|
||||
* @param size size of the buffer
|
||||
*/
|
||||
StringField(const char *buffer, size_t size) : _data(buffer, size) {}
|
||||
|
||||
/**
|
||||
* Construct based on a c-string
|
||||
* @param buffer buffer value
|
||||
*/
|
||||
StringField(const char *buffer) : _data(buffer) {}
|
||||
|
||||
/**
|
||||
* Construct based on received data
|
||||
|
|
@ -85,7 +96,6 @@ public:
|
|||
|
||||
/**
|
||||
* Assign a new value
|
||||
*
|
||||
* @param value new value
|
||||
*/
|
||||
StringField& operator=(const std::string &value)
|
||||
|
|
@ -99,7 +109,6 @@ public:
|
|||
|
||||
/**
|
||||
* Assign a new value
|
||||
*
|
||||
* @param value new value
|
||||
*/
|
||||
StringField& operator=(std::string &&value)
|
||||
|
|
@ -111,6 +120,75 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign a new value
|
||||
* @param value new value
|
||||
*/
|
||||
StringField& operator=(const char *value)
|
||||
{
|
||||
// overwrite data
|
||||
_data.assign(value);
|
||||
|
||||
// allow chaining
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign a new value
|
||||
* @param value
|
||||
* @return StringField
|
||||
*/
|
||||
StringField& assign(const std::string &value)
|
||||
{
|
||||
// overwrite data
|
||||
_data = value;
|
||||
|
||||
// allow chaining
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign a new value
|
||||
* @param value new value
|
||||
* @return StringField
|
||||
*/
|
||||
StringField& assign(std::string &&value)
|
||||
{
|
||||
// overwrite data
|
||||
_data = std::move(value);
|
||||
|
||||
// allow chaining
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign a new value
|
||||
* @param value new value
|
||||
* @return StringField
|
||||
*/
|
||||
StringField& assign(const char *value)
|
||||
{
|
||||
// overwrite data
|
||||
_data.assign(value);
|
||||
|
||||
// allow chaining
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign a new value
|
||||
* @param value new value
|
||||
* @return StringField
|
||||
*/
|
||||
StringField& assign(const char *value, size_t size)
|
||||
{
|
||||
// overwrite data
|
||||
_data.assign(value, size);
|
||||
|
||||
// allow chaining
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size this field will take when
|
||||
* encoded in the AMQP wire-frame format
|
||||
|
|
|
|||
Loading…
Reference in New Issue