21 static const char* ioTypes[] = {
32 static inline IOData::Type ioType(
const std::string& type )
34 return static_cast<IOData::Type>( util::lookup( type, ioTypes ) );
39 m_in( 0 ), m_out( 0 ), m_error( 0 ),
42 m_status.elapsed = -1;
43 m_status.remaining = -1;
44 m_status.percentage = -1;
49 m_in( 0 ), m_out( 0 ), m_error( 0 ),
55 m_status.elapsed = -1;
56 m_status.remaining = -1;
57 m_status.percentage = -1;
97 m_status.elapsed = atoi( t->
cdata().c_str() );
101 m_status.remaining = atoi( t->
cdata().c_str() );
105 m_status.percentage = atoi( t->
cdata().c_str() );
109 m_status.info = t->
cdata();
112 case TypeIoSchemataGet:
133 Tag* i =
new Tag(
"iodata" );
135 i->
addAttribute(
"type", util::lookup( m_type, ioTypes ) );
146 new Tag( i,
"desc", m_desc );
155 t =
new Tag( i,
"status" );
156 if( m_status.elapsed >= 0 )
157 new Tag( t,
"elapsed", util::int2string( m_status.elapsed ) );
158 if( m_status.remaining >= 0 )
159 new Tag( t,
"remaining", util::int2string( m_status.remaining ) );
160 if( m_status.percentage >= 0 )
161 new Tag( t,
"percentage", util::int2string( m_status.percentage ) );
162 if( m_status.info.length() )
163 new Tag( t,
"information", m_status.info );
165 case TypeIoSchemataGet:
178 i->m_status = m_status;
182 i->m_in = m_in->
clone();
184 i->m_out = m_out->
clone();
186 i->m_error = m_error->
clone();
202 m_in =
new Tag(
"in" );
218 m_out =
new Tag(
"out" );
234 m_error =
new Tag(
"error" );
A base class for Adhoc Command plugins (DataForm, IO Data, ...).
This is an abstraction of the IO Data specification XEP-0244.
const Tag * error() const
void setError(Tag *error)
virtual IOData * clone() const
virtual Tag * tag() const
This is an abstraction of an XML element.
Tag * findChild(const std::string &name) const
const std::string xmlns() const
bool addAttribute(Attribute *attr)
void addChild(Tag *child)
bool hasAttribute(const std::string &name, const std::string &value=EmptyString) const
const std::string cdata() const
const std::string & findAttribute(const std::string &name) const
const std::string & name() const
bool setXmlns(const std::string &xmlns, const std::string &prefix=EmptyString)
The namespace for the gloox library.
const std::string EmptyString
const std::string XMLNS_IODATA