aboutsummaryrefslogtreecommitdiff
path: root/src/doc/feature/proxy.dox
blob: 66bbd2fe645c90d08752004007bba1e083b8b165 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// vim:ft=doxygen
namespace crepe {
/**

\defgroup feature_proxy Proxy utility
\ingroup feature
\brief Use ValueBroker as if it were a regular variable

Proxy provides operators that allow you to use a ValueBroker instance as if it
were a regular variable. Proxy implements a constructor that allows it to be
used as a substitute return type for any function that returns ValueBroker.

\see ValueBroker
\see Proxy

\par Example

```cpp
#include <crepe/util/Proxy.h>
#include <crepe/ValueBroker.h>

int calculation(int value) {
	return 3 * value;
}

void anywhere() {
	crepe::ValueBroker<int> foo_handle;
	crepe::Proxy foo = foo_handle;

	// implicitly calls .set()
	foo += 10;

	// implicitly calls .get()
	int out = calculation(foo);

	// explicitly cast (also calls .get())
	int casted = int(foo);
}

```

*/
}