AMQP-CPP/include/amqpcpp/voidfield.h

104 lines
1.8 KiB
C
Raw Normal View History

2020-07-29 21:21:28 +08:00
/**
* Void field type for AMQP
*
* @copyright
*/
/**
* Include guard
*/
#pragma once
/**
* Dependencies
*/
#include <memory>
#include "outbuffer.h"
#include "field.h"
/**
* Set up namespace
*/
namespace AMQP
{
class VoidField : public Field
{
public:
/**
* Default constructor
*/
2020-10-15 15:41:59 +08:00
VoidField() = default;
2020-07-29 21:21:28 +08:00
/**
2020-10-15 15:41:59 +08:00
* Construct based on incoming data
2020-07-29 21:21:28 +08:00
* @param frame
*/
2020-10-15 15:41:59 +08:00
VoidField(InBuffer &frame) {}
2020-07-29 21:21:28 +08:00
/**
2020-10-15 15:41:59 +08:00
* Destructor
*/
virtual ~VoidField() = default;
2020-07-29 21:21:28 +08:00
/**
* Create a new instance of this object
* @return unique_ptr
2020-07-29 21:21:28 +08:00
*/
virtual std::unique_ptr<Field> clone() const override
2020-07-29 21:21:28 +08:00
{
// create a new copy of ourselves and return it
return std::unique_ptr<Field>(new VoidField);
2020-07-29 21:21:28 +08:00
}
/**
* Get the size this field will take when
* encoded in the AMQP wire-frame format
* @return size_t
*/
virtual size_t size() const override
{
// numeric types have no extra storage requirements
return 0;
}
/**
* Write encoded payload to the given buffer.
* @param buffer OutBuffer to write to
*/
2020-10-15 15:41:59 +08:00
virtual void fill(OutBuffer &buffer) const override {}
2020-07-29 21:21:28 +08:00
/**
* Get the type ID that is used to identify this type of
* field in a field table
*/
virtual char typeID() const override
{
return 'V';
}
/**
* Output the object to a stream
* @param std::ostream
*/
virtual void output(std::ostream &stream) const override
{
// show
stream << "void()";
}
/**
* We are an void field
*
* @return true, because we are an void
*/
bool isVoid() const override
{
return true;
}
};
/**
* end namespace
*/
}