Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SharedOptions.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 //namespace inexor { // we need to do it in global scope atm otherwise any cubescript declaration is broken TODO
4 //namespace rpc {
5 
7 {
8 public:
9  friend SharedOption& operator|(SharedOption& first, const SharedOption& second) { return first; }
10 };
11 
14 template<typename S>
15 class fu_cast
16 {
17 public:
18  fu_cast(const char *input) {}
19  operator S() { return 0; }
20 };
21 
22 class Range : public SharedOption
23 {
24 public:
26  // TODO add warning into gluegen
29  Range(int min = 0, int max = fu_cast<int>("{{index}}")) {}
30  Range(float min = 0.0f, float max = fu_cast<float>("{{index}}")) {}
31 
32  const char *dummy_key1 = "dummy_value. min = {{min}} max = {{max}}";
33  const char *dummy_key2 = "dummy_value";
34  const char *dummy_key3 = "dummy_value";
35 };
36 
37 // CustomXY are the hardest atm, since we need to override the build-tools behaviour (or we need to set the build tools defaults when customxy is missing)
38 // both ugly non-generic hacks.
39 class CustomPath : public SharedOption
40 {
41 public:
43  // TODO add warning into gluegen
44  CustomPath(const char *path = "{{path}}") {}
45 
46  const char *proto_template = "(path)=\"{{path}}\"";
47  const char *cpp_init_check_template = "send(path";
48  const char *cpp_receive_template = "da";
49  const char *cpp_send_template = "da";
50 };
51 
52 class NoSync : public SharedOption
53 {
54 public:
55  NoSync() {}
56 
57  const char *cpp_receive_template = "return;";
58  const char *cpp_send_template = "return;";
59 };
60 
61 // TODO respect default initializer ispersistent = false
62 class Persistent : public SharedOption
63 {
64 public:
65  Persistent(bool ispersistent) {}
66 
67  const char *proto_template = "da";
68  const char *cpp_receive_template = "da";
69  const char *cpp_send_template = "da";
70 };
71 
72 //class Function : public SharedOption
73 //{
74 //public:
75 // Function(std::function<void> predicate) {}
76 //
77 // const char *cpp_receive_template = "da";
78 //};
79 
Persistent(bool ispersistent)
Definition: SharedOptions.hpp:65
NoSync()
Definition: SharedOptions.hpp:55
const T & max(const inexor::rpc::SharedVar< T > &a, const T &b)
Definition: SharedVar.hpp:224
const char * proto_template
Definition: SharedOptions.hpp:46
const char * dummy_key2
Definition: SharedOptions.hpp:33
Range(int min=0, int max=fu_cast< int >("{{index}}"))
!!! WARNING: both constructor args need to be named the same!!
Definition: SharedOptions.hpp:29
Range(float min=0.0f, float max=fu_cast< float >("{{index}}"))
Definition: SharedOptions.hpp:30
Definition: SharedOptions.hpp:22
const char * cpp_send_template
Definition: SharedOptions.hpp:58
const char * cpp_receive_template
Definition: SharedOptions.hpp:57
Definition: SharedOptions.hpp:52
const char * proto_template
Definition: SharedOptions.hpp:67
ICOMMAND * f(float *a, float *b), floatret(*a **b)
const char * dummy_key1
Definition: SharedOptions.hpp:32
const char * cpp_receive_template
Definition: SharedOptions.hpp:68
const T & min(const inexor::rpc::SharedVar< T > &a, const T &b)
Definition: SharedVar.hpp:210
CustomPath(const char *path="{{path}}")
!!! WARNING: either every or no arg can have a default value!!
Definition: SharedOptions.hpp:44
char * path(char *s)
Modifies the input string to only contain slashes in the direction the platform allows.
Definition: stream.cpp:63
friend SharedOption & operator|(SharedOption &first, const SharedOption &second)
Definition: SharedOptions.hpp:9
fu_cast(const char *input)
Definition: SharedOptions.hpp:18
Definition: SharedOptions.hpp:62
const char * cpp_send_template
Definition: SharedOptions.hpp:49
The fuck you cast does nothing expect silencing warnings when doing forbidden casts.
Definition: SharedOptions.hpp:15
Definition: SharedOptions.hpp:39
const char * cpp_receive_template
Definition: SharedOptions.hpp:48
const char * dummy_key3
Definition: SharedOptions.hpp:34
const char * cpp_send_template
Definition: SharedOptions.hpp:69
Definition: SharedOptions.hpp:6
const char * cpp_init_check_template
Definition: SharedOptions.hpp:47