84#define YUI_EXCEPTION_CODE_LOCATION YCodeLocation(__FILE__,__FUNCTION__,__LINE__)
90#define YUI_THROW( EXCEPTION ) \
91 _YUI_THROW( ( EXCEPTION ), YUI_EXCEPTION_CODE_LOCATION )
96#define YUI_CAUGHT( EXCEPTION ) \
97 _YUI_CAUGHT( ( EXCEPTION ), YUI_EXCEPTION_CODE_LOCATION )
103#define YUI_RETHROW( EXCEPTION ) \
104 _YUI_RETHROW( ( EXCEPTION ), YUI_EXCEPTION_CODE_LOCATION )
110#define YUI_THROW_MSG( EXCEPTION_TYPE, MSG ) \
111 YUI_THROW( EXCEPTION_TYPE( MSG ) )
117#define YUI_THROW_ERRNO( EXCEPTION_TYPE ) \
118 YUI_THROW( EXCEPTION_TYPE( YUIException::strErrno( errno ) ) )
123#define YUI_THROW_ERRNO1( EXCEPTION_TYPE, ERRNO ) \
124 YUI_THROW( EXCEPTION_TYPE( YUIException::strErrno( ERRNO ) ) )
129#define YUI_THROW_ERRNO_MSG( EXCEPTION_TYPE, MSG) \
130 YUI_THROW( EXCEPTION_TYPE( YUIException::strErrno( errno, MSG ) ) )
135#define YUI_THROW_ERRNO_MSG1( EXCEPTION_TYPE, ERRNO,MSG ) \
136 YUI_THROW( EXCEPTION_TYPE( YUIException::strErrno( ERRNO, MSG ) ) )
147#define YUI_CHECK_NEW( PTR ) \
152 YUI_THROW( YUIOutOfMemoryException() ); \
162#define YUI_CHECK_PTR( PTR ) \
167 YUI_THROW( YUINullPointerException() ); \
191#define YUI_CHECK_WIDGET( WIDGET ) \
194 if ( ! ( static_cast<bool> (WIDGET) ) || \
195 ! (WIDGET)->isValid() ) \
197 YUI_THROW( YUIInvalidWidgetException() ); \
208#define YUI_CHECK_INDEX_MSG( INDEX, VALID_MIN, VALID_MAX, MSG ) \
211 if ( (INDEX) < (VALID_MIN) || \
212 (INDEX) > (VALID_MAX) ) \
214 YUI_THROW( YUIIndexOutOfRangeException( (INDEX), (VALID_MIN), (VALID_MAX), (MSG) ) ); \
219#define YUI_CHECK_INDEX( INDEX, VALID_MIN, VALID_MAX ) \
220 YUI_CHECK_INDEX_MSG( (INDEX), (VALID_MIN), (VALID_MAX), "")
237 const std::string & func_r,
254 std::string
file()
const {
return _file; }
259 std::string
func()
const {
return _func; }
264 int line()
const {
return _line; }
287std::ostream & operator<<( std::ostream & str,
const YCodeLocation & obj );
327 { _where = newLocation; }
334 const std::string &
msg()
const
351 static std::string
strErrno(
int errno_r );
356 static std::string
strErrno(
int errno_r,
const std::string &
msg );
364 const char *
const prefix );
370 virtual const char *
what()
const throw()
371 {
return _msg.c_str(); }
378 virtual std::ostream &
dumpOn( std::ostream & str )
const;
392 std::ostream & dumpError( std::ostream & str )
const;
400std::ostream & operator<<( std::ostream & str,
const YUIException & obj );
410 YUINullPointerException()
414 virtual ~YUINullPointerException()
throw()
426 YUIOutOfMemoryException()
430 virtual ~YUIOutOfMemoryException()
throw()
443 YUIInvalidWidgetException()
447 virtual ~YUIInvalidWidgetException()
throw()
458 YUIWidgetNotFoundException(
const std::string & idString )
459 :
YUIException( std::string(
"No widget with ID " ) + idString )
462 virtual ~YUIWidgetNotFoundException()
throw()
470 YUINoDialogException()
474 virtual ~YUINoDialogException()
throw()
482 YUIDialogStackingOrderException()
486 virtual ~YUIDialogStackingOrderException()
throw()
494 YUISyntaxErrorException(
const std::string &
msg )
498 virtual ~YUISyntaxErrorException()
throw()
509 YUIPropertyException(
const YProperty & prop,
516 virtual ~YUIPropertyException()
throw()
541 virtual std::ostream &
dumpOn( std::ostream & str )
const = 0;
553class YUIUnknownPropertyException:
public YUIPropertyException
556 YUIUnknownPropertyException(
const std::string & propertyName,
558 : YUIPropertyException(
YProperty( propertyName, YUnknownPropertyType ),
widget )
561 virtual ~YUIUnknownPropertyException()
throw()
570 virtual std::ostream &
dumpOn( std::ostream & str )
const;
578class YUIPropertyTypeMismatchException:
public YUIPropertyException
589 virtual ~YUIPropertyTypeMismatchException()
throw()
595 YPropertyType
type()
const {
return _type; }
603 virtual std::ostream &
dumpOn( std::ostream & str )
const;
613class YUISetReadOnlyPropertyException:
public YUIPropertyException
622 virtual ~YUISetReadOnlyPropertyException()
throw()
631 virtual std::ostream &
dumpOn( std::ostream & str )
const;
635class YUIBadPropertyArgException:
public YUIPropertyException
641 const std::string & message =
"" )
645 virtual ~YUIBadPropertyArgException()
throw()
654 virtual std::ostream &
dumpOn( std::ostream & str )
const;
663template<
class YW
idget>
class YUITooManyChildrenException:
public YUIException
672 virtual ~YUITooManyChildrenException()
throw()
686 virtual std::ostream &
dumpOn( std::ostream & str )
const
688 std::string widgetClass =
692 return str <<
"Too many children for "
712template<
class YW
idget>
class YUIInvalidChildException:
public YUIException
723 virtual ~YUIInvalidChildException()
throw()
742 virtual std::ostream &
dumpOn( std::ostream & str )
const
744 std::string containerWidgetClass =
748 std::string childWidgetClass =
752 return str << childWidgetClass
753 <<
" is not a child of "
754 << containerWidgetClass
779 YUIUnsupportedWidgetException(
const std::string & widgetType )
780 :
YUIException( std::string(
"Unsupported optional widget type: " ) + widgetType )
783 virtual ~YUIUnsupportedWidgetException()
throw()
795 YUIInvalidDimensionException()
796 :
YUIException(
"Invalid dimension (neither YD_HORIZ nor YD_VERT)" )
799 virtual ~YUIInvalidDimensionException()
throw()
821 const std::string &
msg =
"" )
852 virtual std::ostream &
dumpOn( std::ostream & str )
const
854 std::string prefix =
msg();
856 if ( prefix.empty() )
857 prefix =
"Index out of range";
859 return str << prefix <<
": " << _invalidIndex
860 <<
" valid: " << _validMin <<
" .. " << _validMax
878 YUIPluginException(
const std::string & pluginName )
879 :
YUIException( std::string(
"Couldn't load plug-in " ) + pluginName )
882 virtual ~YUIPluginException()
throw()
893 YUICantLoadAnyUIException()
897 virtual ~YUICantLoadAnyUIException()
throw()
909 YUIButtonRoleMismatchException(
const std::string &
msg )
913 virtual ~YUIButtonRoleMismatchException()
throw()
926template<
class _Exception>
927void _YUI_THROW(
const _Exception & exception_r,
const YCodeLocation & where_r )
929 exception_r.relocate( where_r );
931 throw( exception_r );
938template<
class _Exception>
939void _YUI_CAUGHT(
const _Exception & exception_r,
const YCodeLocation & where_r )
948template<
class _Exception>
949void _YUI_RETHROW(
const _Exception & exception_r,
const YCodeLocation & where_r )
952 exception_r.relocate( where_r );
Definition YUIException.h:230
std::string asString() const
Definition YUIException.cc:42
std::string func() const
Definition YUIException.h:259
std::string file() const
Definition YUIException.h:254
friend std::ostream & operator<<(std::ostream &str, const YCodeLocation &obj)
int line() const
Definition YUIException.h:264
YCodeLocation(const std::string &file_r, const std::string &func_r, int line_r)
Definition YUIException.h:236
YCodeLocation()
Definition YUIException.h:247
Definition YProperty.h:52
virtual std::ostream & dumpOn(std::ostream &str) const
Definition YUIException.cc:197
Definition YUIException.h:298
const YCodeLocation & where() const
Definition YUIException.h:320
static std::string strErrno(int errno_r, const std::string &msg)
static std::string strErrno(int errno_r)
Definition YUIException.cc:112
void relocate(const YCodeLocation &newLocation) const
Definition YUIException.h:326
virtual ~YUIException()
Definition YUIException.cc:75
std::string asString() const
Definition YUIException.cc:82
virtual const char * what() const
Definition YUIException.h:370
virtual std::ostream & dumpOn(std::ostream &str) const
Definition YUIException.cc:91
void setMsg(const std::string &msg)
Definition YUIException.h:340
const std::string & msg() const
Definition YUIException.h:334
YUIException(const std::string &msg_r)
friend std::ostream & operator<<(std::ostream &str, const YUIException &obj)
YUIException()
Definition YUIException.cc:63
static void log(const YUIException &exception, const YCodeLocation &location, const char *const prefix)
Definition YUIException.cc:128
Definition YUIException.h:808
int validMin() const
Definition YUIException.h:839
virtual std::ostream & dumpOn(std::ostream &str) const
Definition YUIException.h:852
int validMax() const
Definition YUIException.h:844
int invalidIndex() const
Definition YUIException.h:834
YUIIndexOutOfRangeException(int invalidIndex, int validMin, int validMax, const std::string &msg="")
Definition YUIException.h:818
YWidget * container() const
Definition YUIException.h:729
YWidget * child() const
Definition YUIException.h:734
virtual std::ostream & dumpOn(std::ostream &str) const
Definition YUIException.h:742
YProperty property() const
Definition YUIException.h:523
void setWidget(YWidget *w)
Definition YUIException.h:533
virtual std::ostream & dumpOn(std::ostream &str) const =0
YWidget * widget() const
Definition YUIException.h:528
YPropertyType type() const
Definition YUIException.h:595
virtual std::ostream & dumpOn(std::ostream &str) const
Definition YUIException.cc:162
virtual std::ostream & dumpOn(std::ostream &str) const
Definition YUIException.cc:181
virtual std::ostream & dumpOn(std::ostream &str) const
Definition YUIException.h:686
YWidget * container() const
Definition YUIException.h:678
virtual std::ostream & dumpOn(std::ostream &str) const
Definition YUIException.cc:141