iodata.h
/*
Copyright (c) 2015-2023 by Jakob Schröter <js@camaya.net>
This file is part of the gloox library. http://camaya.net/gloox
This software is distributed under a license. The full license
agreement can be found in the file LICENSE in this distribution.
This software may not be copied, modified, sold or distributed
other than expressed in the named license agreement.
This software is distributed without any warranty.
*/
#ifndef IODATA_H__
#define IODATA_H__
#include "adhocplugin.h"
#include "gloox.h"
#include "tag.h"
#include <string>
namespace gloox
{
class GLOOX_API IOData : public AdhocPlugin
{
public:
enum Type
{
TypeIoSchemataGet,
TypeInput,
TypeGetStatus,
TypeGetOutput,
TypeIoSchemataResult,
TypeOutput,
TypeError,
TypeStatus,
TypeInvalid
};
struct Status
{
int elapsed;
int remaining;
int percentage;
std::string info;
};
IOData( Type type );
IOData( const Tag* tag );
virtual ~IOData();
Type type() const { return m_type; }
const Tag* in() const { return m_in; }
void setIn( Tag* in );
const Tag* out() const { return m_out; }
void setOut( Tag* out );
const Tag* error() const { return m_error; }
void setError( Tag* error );
void setDesc( const std::string& desc ) { m_desc = desc; }
const std::string& desc() const { return m_desc; }
void setStatus( Status status ) { m_status = status; }
Status status() const { return m_status; }
// reimplemented from AdhocPlugin/StanzaExtension
virtual Tag* tag() const;
// reimplemented from AdhocPlugin/StanzaExtension
virtual IOData* clone() const;
// reimplemented from AdhocPlugin/StanzaExtension
virtual const std::string& filterString() const { return EmptyString; }
// reimplemented from AdhocPlugin/StanzaExtension
virtual StanzaExtension* newInstance( const Tag* /*tag*/ ) const { return 0; }
operator bool() const { return m_type != TypeInvalid; }
private:
Tag* m_in;
Tag* m_out;
Tag* m_error;
std::string m_desc;
Status m_status;
Type m_type;
};
}
#endif // IODATA_H__
gloox::AdhocPlugin::AdhocPlugin
AdhocPlugin(int type)
Definition adhocplugin.h:47
gloox::IOData
This is an abstraction of the IO Data specification XEP-0244.
Definition iodata.h:37
gloox::IOData::error
const Tag * error() const
Definition iodata.h:125
gloox::IOData::Type
Type
Definition iodata.h:43
gloox::IOData::TypeStatus
@ TypeStatus
Definition iodata.h:51
gloox::IOData::TypeGetStatus
@ TypeGetStatus
Definition iodata.h:46
gloox::IOData::TypeInput
@ TypeInput
Definition iodata.h:45
gloox::IOData::TypeInvalid
@ TypeInvalid
Definition iodata.h:52
gloox::IOData::TypeOutput
@ TypeOutput
Definition iodata.h:49
gloox::IOData::TypeError
@ TypeError
Definition iodata.h:50
gloox::IOData::TypeIoSchemataResult
@ TypeIoSchemataResult
Definition iodata.h:48
gloox::IOData::TypeGetOutput
@ TypeGetOutput
Definition iodata.h:47
gloox::IOData::desc
const std::string & desc() const
Definition iodata.h:146
gloox::IOData::IOData
IOData(Type type)
Definition iodata.cpp:37
gloox::IOData::filterString
virtual const std::string & filterString() const
Definition iodata.h:167
gloox::IOData::newInstance
virtual StanzaExtension * newInstance(const Tag *) const
Definition iodata.h:170
gloox::IOData::setStatus
void setStatus(Status status)
Definition iodata.h:152
gloox::IOData::setDesc
void setDesc(const std::string &desc)
Definition iodata.h:140
gloox::IOData::in
const Tag * in() const
Definition iodata.h:93
gloox::IOData::out
const Tag * out() const
Definition iodata.h:109
gloox::IOData::status
Status status() const
Definition iodata.h:158
gloox::IOData::type
Type type() const
Definition iodata.h:86
gloox::StanzaExtension
This class abstracts a stanza extension, which is usually an XML child element in a specific namespac...
Definition stanzaextension.h:204
gloox::Tag
This is an abstraction of an XML element.
Definition tag.h:47
gloox
The namespace for the gloox library.
Definition adhoc.cpp:28
gloox::EmptyString
const std::string EmptyString
Definition gloox.cpp:124