Const modifier to table get and some array operations
This commit is contained in:
parent
0d63830c1a
commit
41c1402d15
|
|
@ -99,6 +99,25 @@ public:
|
||||||
*/
|
*/
|
||||||
const Field &get(uint8_t index);
|
const Field &get(uint8_t index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get number of elements on this array
|
||||||
|
*
|
||||||
|
* @return array size
|
||||||
|
*/
|
||||||
|
uint32_t count() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove last element from array
|
||||||
|
*/
|
||||||
|
void pop_back();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add field to end of array
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
|
void push_back(const Field &value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a field
|
* Get a field
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ public:
|
||||||
* @param name field name
|
* @param name field name
|
||||||
* @return the field value
|
* @return the field value
|
||||||
*/
|
*/
|
||||||
const Field &get(const std::string &name);
|
const Field &get(const std::string &name) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a field
|
* Get a field
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,21 @@ const Field &Array::get(uint8_t index)
|
||||||
return *_fields[index];
|
return *_fields[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t Array::count() const
|
||||||
|
{
|
||||||
|
return _fields.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Array::pop_back()
|
||||||
|
{
|
||||||
|
_fields.pop_back();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Array::push_back(const Field& value)
|
||||||
|
{
|
||||||
|
_fields.push_back(std::shared_ptr<Field>(value.clone()));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the size this field will take when
|
* Get the size this field will take when
|
||||||
* encoded in the AMQP wire-frame format
|
* encoded in the AMQP wire-frame format
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ Table &Table::operator=(Table &&table)
|
||||||
* @param name field name
|
* @param name field name
|
||||||
* @return the field value
|
* @return the field value
|
||||||
*/
|
*/
|
||||||
const Field &Table::get(const std::string &name)
|
const Field &Table::get(const std::string &name) const
|
||||||
{
|
{
|
||||||
// we need an empty string
|
// we need an empty string
|
||||||
static ShortString empty;
|
static ShortString empty;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue