MyGUI_Exception.cpp
Go to the documentation of this file.
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#include "MyGUI_Precompiled.h"
#include "MyGUI_Exception.h"
#include "MyGUI_StringUtility.h"
#include <utility>
namespace MyGUI
{
Exception::Exception(std::string _description, std::string _source, std::string _file, long _line) :
mDescription(std::move(_description)),
mSource(std::move(_source)),
mFile(std::move(_file)),
mLine(_line)
{
}
const std::string& Exception::getFullDescription() const
{
if (mFullDesc.empty())
{
if (mLine > 0)
{
mFullDesc = utility::toString(
"MyGUI EXCEPTION : ",
mDescription,
" in ",
mSource,
" at ",
mFile,
" (line ",
mLine,
")");
}
else
{
mFullDesc = utility::toString("MyGUI EXCEPTION : ", mDescription, " in ", mSource);
}
}
return mFullDesc;
}
const std::string& Exception::getSource() const
{
return mSource;
}
const std::string& Exception::getFile() const
{
return mFile;
}
long Exception::getLine() const
{
return mLine;
}
const std::string& Exception::getDescription() const
{
return mDescription;
}
// Override std::exception::what
const char* Exception::what() const noexcept
{
return getFullDescription().c_str();
}
} // namespace MyGUI
MyGUI_Exception.h
MyGUI_Precompiled.h
MyGUI_StringUtility.h
MyGUI::Exception::Exception
Exception(std::string _description, std::string _source, std::string _file, long _line)
Definition MyGUI_Exception.cpp:16
MyGUI::Exception::mFullDesc
std::string mFullDesc
Definition MyGUI_Exception.h:45
MyGUI::Exception::getLine
virtual long getLine() const
Definition MyGUI_Exception.cpp:60
MyGUI::Exception::mSource
std::string mSource
Definition MyGUI_Exception.h:42
MyGUI::Exception::getSource
virtual const std::string & getSource() const
Definition MyGUI_Exception.cpp:50
MyGUI::Exception::what
const char * what() const noexcept override
Definition MyGUI_Exception.cpp:71
MyGUI::Exception::mDescription
std::string mDescription
Definition MyGUI_Exception.h:41
MyGUI::Exception::getFullDescription
virtual const std::string & getFullDescription() const
Definition MyGUI_Exception.cpp:24
MyGUI::Exception::getFile
virtual const std::string & getFile() const
Definition MyGUI_Exception.cpp:55
MyGUI::Exception::getDescription
virtual const std::string & getDescription() const
Definition MyGUI_Exception.cpp:65
MyGUI::Exception::mFile
std::string mFile
Definition MyGUI_Exception.h:43
MyGUI::Exception::mLine
long mLine
Definition MyGUI_Exception.h:44
MyGUI::utility::toString
std::string toString(T _value)
Definition MyGUI_StringUtility.h:26
MyGUI
Definition MyGUI_ActionController.h:15