play around with Exception handling in eflpp. I think I\'ll use it in more parts of eflpp in future...

SVN revision: 37580
This commit is contained in:
Andreas Volz 2008-11-10 22:45:13 +00:00
parent c3228f58cf
commit 385507cbd1
2 changed files with 20 additions and 1 deletions

View File

@ -9,6 +9,15 @@ using std::endl;
namespace efl {
const char* PartNotExistingException::what () const throw ()
{
static std::string s;
s = "EvasEdje loaded with not existing part '";
s += txt;
s += "'.";
return static_cast <const char*> (s.c_str ());
}
//===============================================================================================
// EvasEdje
//===============================================================================================
@ -102,7 +111,7 @@ EdjePart* EvasEdje::part( const char* partname )
_parts[partname] = ep;
return ep;
}
DoutFatal( dc::fatal, *this << " EvasEdje::part() '%s' not existing" );
throw PartNotExistingException (partname);
}
void EvasEdje::connect( const char* emission, const char* source, const EdjeSignalSlot& slot )

View File

@ -32,6 +32,16 @@ typedef std::map<const char*, EdjePart*> EdjePartMap;
typedef sigc::signal<void, const char*, const char*> EdjeSignalSignal;
typedef sigc::slot2<void, const char*, const char*> EdjeSignalSlot;
class PartNotExistingException : public std::exception
{
public:
PartNotExistingException (const char *partname) : txt (partname) {}
const char* what () const throw ();
private:
const char *txt;
};
//===============================================================================================
// Edje
//===============================================================================================