commit
2e49fd1220
|
|
@ -55,6 +55,7 @@
|
||||||
#include "amqpcpp/fieldproxy.h"
|
#include "amqpcpp/fieldproxy.h"
|
||||||
#include "amqpcpp/table.h"
|
#include "amqpcpp/table.h"
|
||||||
#include "amqpcpp/array.h"
|
#include "amqpcpp/array.h"
|
||||||
|
#include "amqpcpp/voidfield.h"
|
||||||
|
|
||||||
// envelope for publishing and consuming
|
// envelope for publishing and consuming
|
||||||
#include "amqpcpp/metadata.h"
|
#include "amqpcpp/metadata.h"
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@ public:
|
||||||
virtual bool isTable() const { return false; }
|
virtual bool isTable() const { return false; }
|
||||||
virtual bool isBoolean() const { return false; }
|
virtual bool isBoolean() const { return false; }
|
||||||
virtual bool isString() const { return false; }
|
virtual bool isString() const { return false; }
|
||||||
|
virtual bool isVoid() const { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
#include "booleanset.h"
|
#include "booleanset.h"
|
||||||
#include "decimalfield.h"
|
#include "decimalfield.h"
|
||||||
#include "numericfield.h"
|
#include "numericfield.h"
|
||||||
|
#include "voidfield.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up namespace
|
* Set up namespace
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,7 @@ public:
|
||||||
Table &set(const std::string &name, int64_t value) { return set(name, LongLong(value)); }
|
Table &set(const std::string &name, int64_t value) { return set(name, LongLong(value)); }
|
||||||
Table &set(const std::string &name, const std::string &value) { return set(name, LongString(value)); }
|
Table &set(const std::string &name, const std::string &value) { return set(name, LongString(value)); }
|
||||||
Table &set(const std::string &name, const char *value) { return set(name, LongString(std::string(value))); }
|
Table &set(const std::string &name, const char *value) { return set(name, LongString(std::string(value))); }
|
||||||
|
Table &set(const std::string &name, nullptr_t) { return set(name, VoidField()); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is a certain field set in the table
|
* Is a certain field set in the table
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
/**
|
||||||
|
* Void field type for AMQP
|
||||||
|
*
|
||||||
|
* @copyright
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Include guard
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dependencies
|
||||||
|
*/
|
||||||
|
#include <memory>
|
||||||
|
#include "receivedframe.h"
|
||||||
|
#include "outbuffer.h"
|
||||||
|
#include "field.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up namespace
|
||||||
|
*/
|
||||||
|
namespace AMQP
|
||||||
|
{
|
||||||
|
class VoidField : public Field
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* Field have no value
|
||||||
|
*/
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Default constructor
|
||||||
|
*/
|
||||||
|
VoidField() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse based on incoming buffer
|
||||||
|
* @param frame
|
||||||
|
*/
|
||||||
|
VoidField(ReceivedFrame &frame)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor
|
||||||
|
*/
|
||||||
|
virtual ~VoidField() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new instance of this object
|
||||||
|
* @return Field*
|
||||||
|
*/
|
||||||
|
virtual std::shared_ptr<Field> clone() const override
|
||||||
|
{
|
||||||
|
// create a new copy of ourselves and return it
|
||||||
|
return std::make_shared<VoidField>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
virtual void fill(OutBuffer &buffer) const override
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
@ -41,6 +41,7 @@ Field *Field::decode(InBuffer &frame)
|
||||||
case 'A': return new Array(frame);
|
case 'A': return new Array(frame);
|
||||||
case 'T': return new Timestamp(frame);
|
case 'T': return new Timestamp(frame);
|
||||||
case 'F': return new Table(frame);
|
case 'F': return new Table(frame);
|
||||||
|
case 'V': return new VoidField(frame);
|
||||||
default: return nullptr;
|
default: return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@
|
||||||
#include "amqpcpp/decimalfield.h"
|
#include "amqpcpp/decimalfield.h"
|
||||||
#include "amqpcpp/stringfield.h"
|
#include "amqpcpp/stringfield.h"
|
||||||
#include "amqpcpp/booleanset.h"
|
#include "amqpcpp/booleanset.h"
|
||||||
|
#include "amqpcpp/voidfield.h"
|
||||||
#include "amqpcpp/fieldproxy.h"
|
#include "amqpcpp/fieldproxy.h"
|
||||||
#include "amqpcpp/table.h"
|
#include "amqpcpp/table.h"
|
||||||
#include "amqpcpp/array.h"
|
#include "amqpcpp/array.h"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue