Files
Upsilon/apps/code/script.cpp
Léa Saviot 35520fb3d4 [code] Scripts can be automatically imported when the console is opened.
Editing, renaming, deleting or changing the auto-importation of a script
triggers the reloading of the console (the history is cleared, Python
restarted and the scripts re-imported).

Change-Id: If8b933cc077ecd36cab09214b5e7a181aa3ae030
2017-11-17 11:59:50 +01:00

37 lines
770 B
C++

#include "script.h"
namespace Code {
Script::Script(const char * marker, const char * name, size_t nameBufferSize, const char * content, size_t contentBufferSize) :
m_marker(marker),
m_name(name),
m_nameBufferSize(nameBufferSize),
m_content(content),
m_contentBufferSize(contentBufferSize)
{
}
bool Script::isNull() const {
if (m_marker == nullptr) {
assert(m_name == nullptr);
assert(m_nameBufferSize == 0);
assert(m_content == nullptr);
assert(m_contentBufferSize == 0);
return true;
}
return false;
}
bool Script::autoImport() const {
assert(!isNull());
assert(m_marker != nullptr);
if (m_marker[0] == AutoImportationMarker) {
return true;
}
assert (m_marker[0] == NoAutoImportationMarker);
return false;
}
}