57 lines
1.2 KiB
C++
57 lines
1.2 KiB
C++
|
|
#include <string>
|
||
|
|
#include <map>
|
||
|
|
|
||
|
|
#include "error.h"
|
||
|
|
#include "klammer_base.h"
|
||
|
|
#include "show.h"
|
||
|
|
|
||
|
|
std::string Klammer_base::get(std::string name)
|
||
|
|
{
|
||
|
|
//std::cout << "GET " << name << "\n";
|
||
|
|
std::string result = m_machine.m_state.value(name);
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
|
||
|
|
std::string Klammer_base::get(const char* name)
|
||
|
|
{
|
||
|
|
// msg() << "GETc " << name << "\n";
|
||
|
|
std::string sname { name };
|
||
|
|
std::string result = m_machine.m_state.value(name);
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
std::string Klammer_base::html()
|
||
|
|
{
|
||
|
|
return "[html target undefined]";
|
||
|
|
}
|
||
|
|
|
||
|
|
std::string Klammer_base::tex()
|
||
|
|
{
|
||
|
|
return "[tex target undefined]";
|
||
|
|
}
|
||
|
|
|
||
|
|
std::string Klammer_base::txt()
|
||
|
|
{
|
||
|
|
return "[txt target undefined]";
|
||
|
|
}
|
||
|
|
|
||
|
|
std::string Klammer_base::result()
|
||
|
|
{
|
||
|
|
std::string target = get("K_target");
|
||
|
|
if (target == "html")
|
||
|
|
return html();
|
||
|
|
else if (target == "tex" or target == "pdf")
|
||
|
|
return tex();
|
||
|
|
else if (target == "txt")
|
||
|
|
return txt();
|
||
|
|
else
|
||
|
|
throw Target_error("Unknown target: " + target);
|
||
|
|
}
|
||
|
|
|
||
|
|
void Klammer_base::show(std::string klammer_name)
|
||
|
|
{
|
||
|
|
std::cout << "Arguments of klammer \"" << klammer_name << "\"\n"
|
||
|
|
<< m_machine.m_state.describe() << "\n";
|
||
|
|
}
|