All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
value.cc
Go to the documentation of this file.
1 #include <iostream>
2 
3 #include "value.h"
4 
5 void uscript::Value::Print() const {
6  switch (val) {
7  case uscript::VAL_BOOL: std::cout << (AS_BOOL(*this) ? "true" : "false"); break;
8  case uscript::VAL_NIL: std::cout << "nil"; break;
9  case uscript::VAL_NUMBER: std::cout << AS_NUMBER(*this); break;
10  case uscript::VAL_INTEGER: std::cout << AS_INTEGER(*this); break;
11  case uscript::VAL_OBJ_STRING: std::cout << AS_CSTRING(*this); break;
12  case uscript::VAL_OBJ_TINSTANCE: std::cout << "TInstance"; break;
13  }
14 }
15 
17  return IS_NIL(*this) || (IS_INTEGER(*this) && AS_INTEGER(*this) == 0) || (IS_BOOL(*this) && !AS_BOOL(*this));
18 }
19 
#define IS_INTEGER(value)
Definition: value.h:62
bool operator!() const
Definition: value.cc:16
#define AS_BOOL(value)
Definition: value.h:52
#define AS_NUMBER(value)
Definition: value.h:53
#define AS_CSTRING(value)
Definition: value.h:56
#define IS_BOOL(value)
Definition: value.h:60
ValueType val
Definition: value.h:30
#define IS_NIL(value)
Definition: value.h:59
#define AS_INTEGER(value)
Definition: value.h:54
void Print() const
Definition: value.cc:5
BEGIN_PROLOG could also be cout