32 #define YUILogComponent "ui"
35 #include "YUIException.h"
41 std::string YCodeLocation::asString()
const
43 std::string str( _file );
44 str +=
"(" + _func +
"):";
46 char formatted_number[ 20 ];
47 sprintf( formatted_number,
"%u", _line );
49 str += formatted_number;
56 operator<<( std::ostream & str,
const YCodeLocation & obj )
58 return str << obj.asString();
62 YUIException::YUIException()
67 YUIException::YUIException(
const std::string & msg_r )
74 YUIException::~YUIException() throw()
81 YUIException::asString()
const
83 std::ostringstream str;
90 YUIException::dumpOn( std::ostream & str )
const
97 YUIException::dumpError( std::ostream & str )
const
99 return dumpOn( str << _where <<
": " );
104 operator<<( std::ostream & str,
const YUIException & obj )
106 return obj.dumpError( str );
111 YUIException::strErrno(
int errno_r )
113 return strerror( errno_r );
118 YUIException::strErrno(
int errno_r,
const std::string & msg )
120 std::string ret( msg );
122 return ret += strErrno( errno_r );
127 YUIException::log(
const YUIException & exception,
128 const YCodeLocation & location,
129 const char *
const prefix )
131 YUILog::warning( YUILogComponent,
132 location.file().c_str(),
134 location.func().c_str() )
135 <<
"\t" << prefix <<
" " << exception.asString() << std::endl;
140 YUIUnknownPropertyException::dumpOn( std::ostream & str )
const
144 return str << widget()->widgetClass()
145 <<
" has no property named \""
152 return str <<
"Unknown property name \""
161 YUIPropertyTypeMismatchException::dumpOn( std::ostream & str )
const
163 std::string widgetClass;
166 widgetClass = std::string( widget()->widgetClass() ) +
"::";
168 return str <<
"Property type mismatch: "
172 << property().typeAsStr()
180 YUISetReadOnlyPropertyException::dumpOn( std::ostream & str )
const
182 std::string widgetClass;
185 widgetClass = std::string( widget()->widgetClass() ) +
"::";
187 return str <<
"Property "
196 YUIBadPropertyArgException::dumpOn( std::ostream & str )
const
198 std::string widgetClass;
201 widgetClass = std::string( widget()->widgetClass() ) +
"::";
203 return str <<
"Bad argument for property "
std::string typeAsStr() const
Returns the type of this property as string.