Brain  1.0.0
A fast esoteric language!
ArgsOptions.h
1 /* This is the source code of Brain Programming Language.
2  * It is licensed under GNU GPL v. 3 or later.
3  * You should have received a copy of the license in this archive (see LICENSE).
4  *
5  * Copyright Brain, 2016.
6  */
7 
8 
9 #ifndef ARGS_OPTIONS_H
10 #define ARGS_OPTIONS_H
11 
15 typedef enum
16 {
17  BO_NONE = 0,
18  BO_IS_EMITTING_LLVM = 1,
19  BO_IS_EMITTING_AST = 2,
20  BO_IS_EMITTING_CODE = 4,
21  BO_IS_VERBOSE = 8,
22  BO_IS_OPTIMIZING_O0 = 16,
23  BO_IS_OPTIMIZING_O1 = 32,
24 } BrainOption;
25 
33 {
34 private:
35  ArgsOptions() : _options(BO_NONE) {}
37  static ArgsOptions *_instance;
39  int _options;
41  int _k_cells_size;
42 public:
43  ArgsOptions(ArgsOptions const&) = delete;
44  ArgsOptions& operator=(ArgsOptions const&) = delete;
48  static ArgsOptions* instance();
54  void add_option(BrainOption option);
60  bool has_option(BrainOption option);
66  void set_cells_size(int cells_size);
72  int get_cells_size();
77  BrainOption get_optimization();
78 };
79 
80 #endif // ARGS_OPTIONS_H
BrainOption get_optimization()
Returns the optimization level to compile Brain files.
Definition: ArgsOptions.cpp:33
static ArgsOptions * instance()
Returns the ArgsOptions instance.
Definition: ArgsOptions.cpp:13
void set_cells_size(int cells_size)
set_cells_size Sets the size of Brain's cells.
Definition: ArgsOptions.cpp:48
int get_cells_size()
get_cells_size
Definition: ArgsOptions.cpp:53
This class handles all the options passed as arguments to Brain. It does so by using an enum of all o...
Definition: ArgsOptions.h:32
bool has_option(BrainOption option)
Verifies and returns true if an option is present (being used) at the moment of execution, otherwise it returns false.
Definition: ArgsOptions.cpp:28
void add_option(BrainOption option)
Add an option to be used by Brain, it does a bitwise OR on the value to add it to an integer...
Definition: ArgsOptions.cpp:23