/usr/include/gloox/error.h is in libgloox-dev 1.0.11-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | /*
Copyright (c) 2007-2014 by Jakob Schroeter <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 ERROR_H__
#define ERROR_H__
#include "gloox.h"
#include "stanzaextension.h"
#include <string>
#include <map>
namespace gloox
{
class Tag;
/**
* @brief A stanza error abstraction implemented as a StanzaExtension.
*
* @author Vincent Thomasset
* @author Jakob Schroeter <js@camaya.net>
* @since 1.0
*/
class GLOOX_API Error : public StanzaExtension
{
public:
// Error()
// : StanzaExtension( ExtError ), m_type( StanzaErrorTypeUndefined ),
// m_error( StanzaErrorUndefined ), m_appError( 0 )
// {}
/**
* Creates a new Error object from the given Tag.
* @param tag The Tag to parse.
*/
Error( const Tag* tag = 0 );
/**
* Creates a new Error object.
* @param type The error type.
* @param error The actual stanza error.
* @param appError An optional application-specific error.
*/
Error( StanzaErrorType type, StanzaError error, Tag* appError = 0 )
: StanzaExtension( ExtError ), m_type( type ),
m_error( error ), m_appError( appError )
{}
/**
* Virtual destructor.
*/
virtual ~Error();
/**
* Returns the error type.
* @return The error type.
*/
StanzaErrorType type() const { return m_type; }
/**
* Return the stanza error.
* @return The actual error.
*/
StanzaError error() const { return m_error; }
/**
* This function can be used to retrieve the application-specific error
* condition of a stanza error.
* @return The application-specific error element of a stanza error.
* 0 if no respective element was found or no error occured.
*/
const Tag* appError() const { return m_appError; }
/**
* Returns the text of a error stanza for the given language if available.
* If the requested language is not available, the default text (without
* a xml:lang attribute) will be returned.
* @param lang The language identifier for the desired language. It must
* conform to section 2.12 of the XML specification and RFC 3066. If
* empty, the default text will be returned, if any.
* @return The text of an error stanza.
*/
const std::string& text( const std::string& lang = EmptyString ) const;
/**
* Sets the text of a error stanza for the given language.
* @param text The error text to set.
* @param lang The language identifier for the desired language. It must
* conform to section 2.12 of the XML specification and RFC 3066. If
* empty, the default text will be set.
*/
void setText( const std::string& text, const std::string& lang = EmptyString )
{
m_text[lang] = text;
}
// reimplemented from StanzaExtension
virtual const std::string& filterString() const;
// reimplemented from StanzaExtension
virtual StanzaExtension* newInstance( const Tag* tag ) const
{
return new Error( tag );
}
// reimplemented from StanzaExtension
virtual Tag* tag() const;
// reimplemented from StanzaExtension
virtual StanzaExtension* clone() const
{
return new Error( *this );
}
private:
Error( const Error& error );
void setValues( const Tag* tag );
StanzaErrorType m_type;
StanzaError m_error;
Tag* m_appError;
StringMap m_text;
};
}
#endif /* ERROR_H__ */
|