Skip to content

Commit 3c7ffb8

Browse files
committed
update examples
1 parent d1ce6fe commit 3c7ffb8

File tree

5 files changed

+30
-52
lines changed

5 files changed

+30
-52
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
33
# ---- Project ----
44

55
project(LarsEvent
6-
VERSION 1.0
6+
VERSION 2.0
77
LANGUAGES CXX
88
)
99

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
[![Build Status](https://travis-ci.com/TheLartians/Event.svg?branch=master)](https://travis-ci.com/TheLartians/Event)
22

3-
# lars::event
3+
# lars::Event
44

5-
A c++11 event-listener system template. See [Examples](https://github.com/TheLartians/Event/tree/master/examples) for usage.
5+
A thread-safe C++11 event-listener template.
6+
7+
# Example
8+
9+
10+
11+
# Installation and usage
12+
13+
With [CPM](https://github.com/TheLartians/CPM), lars::Event can be added to your project by adding the following to your projects' `CMakeLists.txt`.
14+
15+
```cmake
16+
CPMAddPackage(
17+
NAME LarsEvent
18+
VERSION 2.0
19+
GIT_REPOSITORY https://github.com/TheLartians/Event.git
20+
)
21+
22+
target_link_libraries(myProject LarsEvent)
23+
```
24+
25+
Alternatively, download the repository include it via `add_subdirectory`. Installing lars::Event will make it findable in CMake's `find_package`.

examples/mouse_events.cpp

Lines changed: 0 additions & 49 deletions
This file was deleted.

include/lars/observable_value.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ namespace lars {
2525
value = T(std::forward<Args>(args)...);
2626
onChange.emit(value);
2727
}
28+
29+
template <typename ... Args> void setSilently(Args ... args){
30+
value = T(std::forward<Args>(args)...);
31+
}
2832

2933
const T & get()const{
3034
return value;

tests/observable_value.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ TEST_CASE("Dependent Observable Value") {
4343
REQUIRE(*prod == 15);
4444
c.set(2);
4545
REQUIRE(*prod == 10);
46+
47+
c.setSilently(3);
48+
REQUIRE(*prod == 10);
4649
}
4750

4851
TEST_CASE("Operators") {

0 commit comments

Comments
 (0)