Paula Script
args.h
Go to the documentation of this file.
1 #pragma once
2 #include "defs.h"
3 #include "array.h"
4 #include "tree.h"
5 
6 using namespace paula::core;
7 
8 namespace paula
9 {
10  namespace core
11  {
12  class Engine;
13  }
17  class Var
18  {
19  public:
24  INT type() const;
30  bool match(INT tag) const;
36  bool getInt(INT& out) const;
42  bool getDouble(DOUBLE& out) const;
48  bool getBool(bool& out) const;
54  bool getOp(char& out) const;
60  bool getChars(char*&out) const;
65  bool isSubtree() const;
66 
67  friend class Args;
68  friend class core::Tree;
69  friend class core::TreeIterator;
70  private:
71  const INT* ptr; // pointer to a data tag in a tree. volatile, as data can change
72  Var(const INT*_ptr);
73  Var();
74  };
78  class Args
79  {
80  public:
85  INT count();
90  void returnInt(INT value);
95  void returnBool(bool value);
100  bool hasReturnValue();
106  Var get(INT dataIndex);
107 
108  friend class Engine;
109 
110  private:
111  Args(Tree&_tree);
112  void reset(INT numArgs);
113 
114  Array<INT> returnValue;
115 
116  Tree& tree;
117  INT numArgs;
118  core::TreeIterator it;
119 
120  Args() = delete;
121  static INT emptyData;
122 
123  friend class Var;
124  friend class core::Engine;
125 
126  };
127 
128  /*
129  class ArgDef
130  {
131  public:
132  ArgDef(INT size);
133 
134  bool match(Tree&);
135  bool match(TreeIterator&);
136 
137  Array<INT>types;
138 
139  private:
140 
141  ArgDef() = delete;
142  };
143  */
144 }
paula::Var
Access Paula script variable data.
Definition: args.h:17
paula::core
Definition: args.h:10
paula::get
Var get(const char *varName)
Get a variable by name. Return 'empty' if the variable is not found.
paula
Definition: paula.h:6
paula::Args
Access callback arguments (e.g. value of "a" in "f(a)"). Set return value of the callback function,...
Definition: args.h:78