Move to_local8bit_failure class to docstring.cpp and restore std::bad_cast inheritance.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21307 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-10-31 08:05:37 +00:00
parent 13a85fe0c0
commit 036a507c6d
2 changed files with 10 additions and 13 deletions

View File

@ -109,10 +109,16 @@ docstring const from_local8bit(std::string const & s)
}
const char* to_local8bit_failure::what() const throw()
{
return "A string could not be converted from unicode to the local 8 bit encoding.";
}
/// Exception thrown by to_local8bit if the string could not be converted
class to_local8bit_failure : public std::bad_cast {
public:
to_local8bit_failure() throw() : std::bad_cast() {}
virtual ~to_local8bit_failure() throw() {}
virtual const char* what() const throw()
{
return "A string could not be converted from unicode to the local 8 bit encoding.";
}
};
std::string const to_local8bit(docstring const & s)

View File

@ -16,7 +16,6 @@
#include "support/types.h"
#include <string>
//#include <typeinfo>
namespace lyx {
@ -41,14 +40,6 @@ std::string const to_utf8(docstring const &);
/// convert \p s from the encoding of the locale to ucs4.
docstring const from_local8bit(std::string const & s);
/// Exception thrown by to_local8bit if the string could not be converted
class to_local8bit_failure /*: public std::bad_cast*/ {
public:
to_local8bit_failure() throw() /*: std::bad_cast()*/ {}
virtual ~to_local8bit_failure() throw() {}
virtual const char* what() const throw();
};
/**
* Convert \p s from ucs4 to the encoding of the locale.
* This may fail and throw an exception, the caller is expected to act