Started implementing SAS to ASP translator.
This commit is contained in:
37
include/plasp/sas/TranslatorASP.h
Normal file
37
include/plasp/sas/TranslatorASP.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef __SAS__TRANSLATOR_ASP_H
|
||||
#define __SAS__TRANSLATOR_ASP_H
|
||||
|
||||
#include <plasp/sas/Description.h>
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
namespace sas
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TranslatorASP
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class TranslatorASP
|
||||
{
|
||||
public:
|
||||
explicit TranslatorASP(const Description &description);
|
||||
|
||||
void translate(std::ostream &ostream) const;
|
||||
|
||||
private:
|
||||
void checkSupport() const;
|
||||
|
||||
const Description &m_description;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
56
include/plasp/sas/TranslatorException.h
Normal file
56
include/plasp/sas/TranslatorException.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#ifndef __SAS__TRANSLATOR_EXCEPTION_H
|
||||
#define __SAS__TRANSLATOR_EXCEPTION_H
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
namespace plasp
|
||||
{
|
||||
namespace sas
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TranslatorException
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class TranslatorException: public std::exception
|
||||
{
|
||||
public:
|
||||
explicit TranslatorException()
|
||||
{
|
||||
}
|
||||
|
||||
explicit TranslatorException(const char *message)
|
||||
: m_message(message)
|
||||
{
|
||||
}
|
||||
|
||||
explicit TranslatorException(const std::string &message)
|
||||
: m_message(message)
|
||||
{
|
||||
}
|
||||
|
||||
~TranslatorException() throw()
|
||||
{
|
||||
}
|
||||
|
||||
const char *what() const throw()
|
||||
{
|
||||
if (m_message.empty())
|
||||
return "Unspecified error while translating SAS description";
|
||||
|
||||
return m_message.c_str();
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_message;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user