Files
Upsilon/apps/code/script_template.h
Émilie Feral 79740e72b0 [code] Avoid dynamic allocation and useless string copy by keeping the
importation status flag in the areaBuffer
2018-09-11 17:03:04 +02:00

25 lines
728 B
C++

#ifndef CODE_SCRIPT_TEMPLATE_H
#define CODE_SCRIPT_TEMPLATE_H
namespace Code {
class ScriptTemplate {
public:
constexpr ScriptTemplate(const char * name, const char * value) : m_name(name), m_value(value) {}
static const ScriptTemplate * Empty();
static const ScriptTemplate * Factorial();
static const ScriptTemplate * Fibonacci();
static const ScriptTemplate * Mandelbrot();
static const ScriptTemplate * Polynomial();
const char * name() const { return m_name; }
const char * content() const { return m_value+1; }
const char * value() const { return m_value; }
private:
const char * m_name;
const char * m_value; // hold the 'importation status' flag concatenate with the script content
};
}
#endif