-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScript.c++
47 lines (33 loc) · 1.06 KB
/
Script.c++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// Script.c++
// Tech1
//
// Created by Justin Hust on 12/22/13.
// Copyright (c) 2013 __MyCompanyName__. All rights reserved.
//
#include "Script.h"
#include "Token.h"
#include <iostream>
ScriptInstance::ScriptInstance(ScriptToken * tokCode, System &sys, std::ostream &os) : _sys(sys), _os(os) {
_tokCode = tokCode;
}
// ----------------------------------------------------
ScriptInstance::~ScriptInstance(void) {
// do NOT delete code token
}
// ----------------------------------------------------
void ScriptInstance::call(const std::string &sFuncName) {
_tokCode->call(sFuncName, _env, _sys, _os);
}
// ----------------------------------------------------
bool ScriptInstance::hasFunction(const std::string &sFuncName) {
return _tokCode->hasFunction(sFuncName);
}
// ----------------------------------------------------
void ScriptInstance::set(const std::string &sField, Variant &val) {
_env.set(sField, val);
}
// ----------------------------------------------------
Variant ScriptInstance::get(const std::string &sField) {
return _env.get(sField);
}