aboutsummaryrefslogtreecommitdiff
path: root/src/functionwrite.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-06-03 07:18:23 +0000
committerMike Buland <eichlan@xagasoft.com>2011-06-03 07:18:23 +0000
commitf16f239688b632fc54684c3e0e1430fd89a67db5 (patch)
tree6a6d4f3b5d5f4974af4c3cc47c7892e46c5ef201 /src/functionwrite.cpp
parent4f1e5849d4a48eb674d81164ba4baba4ad51a89f (diff)
downloadbuild-f16f239688b632fc54684c3e0e1430fd89a67db5.tar.gz
build-f16f239688b632fc54684c3e0e1430fd89a67db5.tar.bz2
build-f16f239688b632fc54684c3e0e1430fd89a67db5.tar.xz
build-f16f239688b632fc54684c3e0e1430fd89a67db5.zip
I added basic support for "opaque" type variables. I think there's one more
tweak to it that I would like to make, but it's fine for now. I also added open, close, read, and write functions. They work just fine, but I'll also add a readLine function, and maybe even a readToken function later.
Diffstat (limited to '')
-rw-r--r--src/functionwrite.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/functionwrite.cpp b/src/functionwrite.cpp
new file mode 100644
index 0000000..7abb661
--- /dev/null
+++ b/src/functionwrite.cpp
@@ -0,0 +1,34 @@
1#include "functionwrite.h"
2#include "filemgr.h"
3
4#include <bu/plugger.h>
5PluginInterface3( pluginFunctionWrite, write, FunctionWrite, Function,
6 "Mike Buland", 0, 1 );
7
8FunctionWrite::FunctionWrite()
9{
10}
11
12FunctionWrite::~FunctionWrite()
13{
14}
15
16Bu::String FunctionWrite::getName() const
17{
18 return "write";
19}
20
21Variable FunctionWrite::call( Variable &input, VarList lParams )
22{
23 if( lParams.getSize() != 1 )
24 {
25 throw Bu::ExceptionBase(
26 "write takes one parameter, the string to write."
27 );
28 }
29 FileMgr::getInstance().get( (int)input.getOpaque() ).write(
30 lParams.first().toString()
31 );
32 return Variable();
33}
34