21 static const char* ioTypes[] = {
32 static inline IOData::Type ioType(
const std::string& type )
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() );
103 t = m->findChild(
"percentage" );
105 m_status.percentage = atoi( t->cdata().c_str() );
107 t = m->findChild(
"information" );
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" );
bool setXmlns(const std::string &xmlns, const std::string &prefix=EmptyString)
virtual Tag * tag() const
void setError(Tag *error)
void addChild(Tag *child)
This is an abstraction of the IO Data specification XEP-0244.
The namespace for the gloox library.
const std::string & xmlns() const
const std::string & findAttribute(const std::string &name) const
const std::string XMLNS_IODATA
bool hasAttribute(const std::string &name, const std::string &value=EmptyString) const
const std::string cdata() const
bool addAttribute(Attribute *attr)
virtual IOData * clone() const
const std::string & name() const
Tag * findChild(const std::string &name) const
const std::string EmptyString
This is an abstraction of an XML element.
A base class for Adhoc Command plugins (DataForm, IO Data, ...).