Merge lp:~thomas-voss/properties-cpp/adjust-namespace-to-core into lp:properties-cpp
- adjust-namespace-to-core
- Merge into trunk
Proposed by
Thomas Voß
Status: | Merged |
---|---|
Merged at revision: | 5 |
Proposed branch: | lp:~thomas-voss/properties-cpp/adjust-namespace-to-core |
Merge into: | lp:properties-cpp |
Diff against target: |
319 lines (+36/-46) 8 files modified
README.md (+2/-2) debian/libproperties-cpp-dev.install (+1/-1) include/CMakeLists.txt (+2/-2) include/core/connection.h (+1/-5) include/core/property.h (+5/-8) include/core/signal.h (+2/-5) tests/properties_test.cpp (+15/-15) tests/signals_test.cpp (+8/-8) |
To merge this branch: | bzr merge lp:~thomas-voss/properties-cpp/adjust-namespace-to-core |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jussi Pakkanen (community) | Approve | ||
Review via email:
|
Commit message
Adjust namespace to core.
Description of the change
Adjust namespace to core.
To post a comment you must log in.
- 6. By Thomas Voß
-
Adjust namespaces in documentation.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'README.md' | |||
2 | --- README.md 2013-11-27 08:44:49 +0000 | |||
3 | +++ README.md 2013-11-28 07:42:04 +0000 | |||
4 | @@ -23,7 +23,7 @@ | |||
5 | 23 | cursor_position.set(new_position); | 23 | cursor_position.set(new_position); |
6 | 24 | } | 24 | } |
7 | 25 | 25 | ||
9 | 26 | com::ubuntu::Property<int> cursor_position; | 26 | core::Property<int> cursor_position; |
10 | 27 | }; | 27 | }; |
11 | 28 | } | 28 | } |
12 | 29 | 29 | ||
13 | @@ -101,7 +101,7 @@ | |||
14 | 101 | std::thread::id dispatcher_thread_id = dispatcher_thread.get_id(); | 101 | std::thread::id dispatcher_thread_id = dispatcher_thread.get_id(); |
15 | 102 | 102 | ||
16 | 103 | // The signal that we want to dispatch via the event loop. | 103 | // The signal that we want to dispatch via the event loop. |
18 | 104 | com::ubuntu::Signal<int, double> s; | 104 | core::Signal<int, double> s; |
19 | 105 | 105 | ||
20 | 106 | static const int expected_invocation_count = 10000; | 106 | static const int expected_invocation_count = 10000; |
21 | 107 | 107 | ||
22 | 108 | 108 | ||
23 | === modified file 'debian/libproperties-cpp-dev.install' | |||
24 | --- debian/libproperties-cpp-dev.install 2013-11-13 09:54:29 +0000 | |||
25 | +++ debian/libproperties-cpp-dev.install 2013-11-28 07:42:04 +0000 | |||
26 | @@ -1,3 +1,3 @@ | |||
28 | 1 | usr/include/properties-cpp/* | 1 | usr/include/core/* |
29 | 2 | usr/lib/*/pkgconfig/* | 2 | usr/lib/*/pkgconfig/* |
30 | 3 | 3 | ||
31 | 4 | 4 | ||
32 | === modified file 'include/CMakeLists.txt' | |||
33 | --- include/CMakeLists.txt 2013-11-13 09:19:50 +0000 | |||
34 | +++ include/CMakeLists.txt 2013-11-28 07:42:04 +0000 | |||
35 | @@ -15,6 +15,6 @@ | |||
36 | 15 | # Authored by: Thomas Voss <thomas.voss@canonical.com> | 15 | # Authored by: Thomas Voss <thomas.voss@canonical.com> |
37 | 16 | 16 | ||
38 | 17 | install( | 17 | install( |
41 | 18 | DIRECTORY com | 18 | DIRECTORY core |
42 | 19 | DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME} | 19 | DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ |
43 | 20 | ) | 20 | ) |
44 | 21 | 21 | ||
45 | === removed directory 'include/com' | |||
46 | === removed directory 'include/com/ubuntu' | |||
47 | === added directory 'include/core' | |||
48 | === renamed file 'include/com/ubuntu/connection.h' => 'include/core/connection.h' | |||
49 | --- include/com/ubuntu/connection.h 2013-11-27 08:44:49 +0000 | |||
50 | +++ include/core/connection.h 2013-11-28 07:42:04 +0000 | |||
51 | @@ -22,9 +22,7 @@ | |||
52 | 22 | #include <memory> | 22 | #include <memory> |
53 | 23 | #include <mutex> | 23 | #include <mutex> |
54 | 24 | 24 | ||
58 | 25 | namespace com | 25 | namespace core |
56 | 26 | { | ||
57 | 27 | namespace ubuntu | ||
59 | 28 | { | 26 | { |
60 | 29 | /** | 27 | /** |
61 | 30 | * @brief The Connection class models a signal-slot connection. | 28 | * @brief The Connection class models a signal-slot connection. |
62 | @@ -159,8 +157,6 @@ | |||
63 | 159 | private: | 157 | private: |
64 | 160 | Connection connection; | 158 | Connection connection; |
65 | 161 | }; | 159 | }; |
66 | 162 | |||
67 | 163 | } | ||
68 | 164 | } | 160 | } |
69 | 165 | 161 | ||
70 | 166 | #endif // COM_UBUNTU_CONNECTION_H_ | 162 | #endif // COM_UBUNTU_CONNECTION_H_ |
71 | 167 | 163 | ||
72 | === renamed file 'include/com/ubuntu/property.h' => 'include/core/property.h' | |||
73 | --- include/com/ubuntu/property.h 2013-11-27 08:44:49 +0000 | |||
74 | +++ include/core/property.h 2013-11-28 07:42:04 +0000 | |||
75 | @@ -15,16 +15,14 @@ | |||
76 | 15 | * | 15 | * |
77 | 16 | * Authored by: Thomas Voß <thomas.voss@canonical.com> | 16 | * Authored by: Thomas Voß <thomas.voss@canonical.com> |
78 | 17 | */ | 17 | */ |
81 | 18 | #ifndef COM_UBUNTU_PROPERTY_H_ | 18 | #ifndef CORE_PROPERTY_H_ |
82 | 19 | #define COM_UBUNTU_PROPERTY_H_ | 19 | #define CORE_PROPERTY_H_ |
83 | 20 | 20 | ||
85 | 21 | #include <com/ubuntu/signal.h> | 21 | #include <core/signal.h> |
86 | 22 | 22 | ||
87 | 23 | #include <iostream> | 23 | #include <iostream> |
88 | 24 | 24 | ||
92 | 25 | namespace com | 25 | namespace core |
90 | 26 | { | ||
91 | 27 | namespace ubuntu | ||
93 | 28 | { | 26 | { |
94 | 29 | /** | 27 | /** |
95 | 30 | * @brief A very simple, templated class that allows for uniform declaration of get-able/set-able/observable members. | 28 | * @brief A very simple, templated class that allows for uniform declaration of get-able/set-able/observable members. |
96 | @@ -179,6 +177,5 @@ | |||
97 | 179 | Signal<T> signal_changed; | 177 | Signal<T> signal_changed; |
98 | 180 | }; | 178 | }; |
99 | 181 | } | 179 | } |
100 | 182 | } | ||
101 | 183 | 180 | ||
103 | 184 | #endif // COM_UBUNTU_PROPERTY_H_ | 181 | #endif // CORE_PROPERTY_H_ |
104 | 185 | 182 | ||
105 | === renamed file 'include/com/ubuntu/signal.h' => 'include/core/signal.h' | |||
106 | --- include/com/ubuntu/signal.h 2013-11-27 08:44:49 +0000 | |||
107 | +++ include/core/signal.h 2013-11-28 07:42:04 +0000 | |||
108 | @@ -18,7 +18,7 @@ | |||
109 | 18 | #ifndef COM_UBUNTU_SIGNAL_H_ | 18 | #ifndef COM_UBUNTU_SIGNAL_H_ |
110 | 19 | #define COM_UBUNTU_SIGNAL_H_ | 19 | #define COM_UBUNTU_SIGNAL_H_ |
111 | 20 | 20 | ||
113 | 21 | #include <com/ubuntu/connection.h> | 21 | #include <core/connection.h> |
114 | 22 | 22 | ||
115 | 23 | #include <functional> | 23 | #include <functional> |
116 | 24 | #include <iostream> | 24 | #include <iostream> |
117 | @@ -26,9 +26,7 @@ | |||
118 | 26 | #include <mutex> | 26 | #include <mutex> |
119 | 27 | #include <set> | 27 | #include <set> |
120 | 28 | 28 | ||
124 | 29 | namespace com | 29 | namespace core |
122 | 30 | { | ||
123 | 31 | namespace ubuntu | ||
125 | 32 | { | 30 | { |
126 | 33 | /** | 31 | /** |
127 | 34 | * @brief A signal class that observers can subscribe to. | 32 | * @brief A signal class that observers can subscribe to. |
128 | @@ -295,6 +293,5 @@ | |||
129 | 295 | std::shared_ptr<Private> d; | 293 | std::shared_ptr<Private> d; |
130 | 296 | }; | 294 | }; |
131 | 297 | } | 295 | } |
132 | 298 | } | ||
133 | 299 | 296 | ||
134 | 300 | #endif // COM_UBUNTU_SIGNAL_H_ | 297 | #endif // COM_UBUNTU_SIGNAL_H_ |
135 | 301 | 298 | ||
136 | === modified file 'tests/properties_test.cpp' | |||
137 | --- tests/properties_test.cpp 2013-11-27 08:44:49 +0000 | |||
138 | +++ tests/properties_test.cpp 2013-11-28 07:42:04 +0000 | |||
139 | @@ -16,17 +16,17 @@ | |||
140 | 16 | * Authored by: Thomas Voß <thomas.voss@canonical.com> | 16 | * Authored by: Thomas Voß <thomas.voss@canonical.com> |
141 | 17 | */ | 17 | */ |
142 | 18 | 18 | ||
144 | 19 | #include <com/ubuntu/property.h> | 19 | #include <core/property.h> |
145 | 20 | 20 | ||
146 | 21 | #include <gtest/gtest.h> | 21 | #include <gtest/gtest.h> |
147 | 22 | 22 | ||
148 | 23 | TEST(Property, default_construction_yields_default_value) | 23 | TEST(Property, default_construction_yields_default_value) |
149 | 24 | { | 24 | { |
151 | 25 | com::ubuntu::Property<int> p1; | 25 | core::Property<int> p1; |
152 | 26 | EXPECT_EQ(int{}, p1.get()); | 26 | EXPECT_EQ(int{}, p1.get()); |
153 | 27 | 27 | ||
154 | 28 | static const int new_default_value = 42; | 28 | static const int new_default_value = 42; |
156 | 29 | com::ubuntu::Property<int> p2{new_default_value}; | 29 | core::Property<int> p2{new_default_value}; |
157 | 30 | 30 | ||
158 | 31 | EXPECT_EQ(new_default_value, p2.get()); | 31 | EXPECT_EQ(new_default_value, p2.get()); |
159 | 32 | } | 32 | } |
160 | @@ -34,8 +34,8 @@ | |||
161 | 34 | TEST(Property, copy_construction_yields_correct_value) | 34 | TEST(Property, copy_construction_yields_correct_value) |
162 | 35 | { | 35 | { |
163 | 36 | static const int default_value = 42; | 36 | static const int default_value = 42; |
166 | 37 | com::ubuntu::Property<int> p1{default_value}; | 37 | core::Property<int> p1{default_value}; |
167 | 38 | com::ubuntu::Property<int> p2{p1}; | 38 | core::Property<int> p2{p1}; |
168 | 39 | 39 | ||
169 | 40 | EXPECT_EQ(default_value, p2.get()); | 40 | EXPECT_EQ(default_value, p2.get()); |
170 | 41 | } | 41 | } |
171 | @@ -43,8 +43,8 @@ | |||
172 | 43 | TEST(Property, assignment_operator_for_properties_works) | 43 | TEST(Property, assignment_operator_for_properties_works) |
173 | 44 | { | 44 | { |
174 | 45 | static const int default_value = 42; | 45 | static const int default_value = 42; |
177 | 46 | com::ubuntu::Property<int> p1{default_value}; | 46 | core::Property<int> p1{default_value}; |
178 | 47 | com::ubuntu::Property<int> p2; | 47 | core::Property<int> p2; |
179 | 48 | p2 = p1; | 48 | p2 = p1; |
180 | 49 | 49 | ||
181 | 50 | EXPECT_EQ(default_value, p2.get()); | 50 | EXPECT_EQ(default_value, p2.get()); |
182 | @@ -53,7 +53,7 @@ | |||
183 | 53 | TEST(Property, assignment_operator_for_raw_values_works) | 53 | TEST(Property, assignment_operator_for_raw_values_works) |
184 | 54 | { | 54 | { |
185 | 55 | static const int default_value = 42; | 55 | static const int default_value = 42; |
187 | 56 | com::ubuntu::Property<int> p1; | 56 | core::Property<int> p1; |
188 | 57 | p1 = default_value; | 57 | p1 = default_value; |
189 | 58 | 58 | ||
190 | 59 | EXPECT_EQ(default_value, p1.get()); | 59 | EXPECT_EQ(default_value, p1.get()); |
191 | @@ -62,8 +62,8 @@ | |||
192 | 62 | TEST(Property, equality_operator_for_properties_works) | 62 | TEST(Property, equality_operator_for_properties_works) |
193 | 63 | { | 63 | { |
194 | 64 | static const int default_value = 42; | 64 | static const int default_value = 42; |
197 | 65 | com::ubuntu::Property<int> p1{default_value}; | 65 | core::Property<int> p1{default_value}; |
198 | 66 | com::ubuntu::Property<int> p2; | 66 | core::Property<int> p2; |
199 | 67 | p2 = p1; | 67 | p2 = p1; |
200 | 68 | 68 | ||
201 | 69 | EXPECT_EQ(p1, p2); | 69 | EXPECT_EQ(p1, p2); |
202 | @@ -72,7 +72,7 @@ | |||
203 | 72 | TEST(Property, equality_operator_for_raw_values_works) | 72 | TEST(Property, equality_operator_for_raw_values_works) |
204 | 73 | { | 73 | { |
205 | 74 | static const int default_value = 42; | 74 | static const int default_value = 42; |
207 | 75 | com::ubuntu::Property<int> p1{default_value}; | 75 | core::Property<int> p1{default_value}; |
208 | 76 | 76 | ||
209 | 77 | EXPECT_EQ(default_value, p1); | 77 | EXPECT_EQ(default_value, p1); |
210 | 78 | } | 78 | } |
211 | @@ -100,7 +100,7 @@ | |||
212 | 100 | TEST(Property, signal_changed_is_emitted_with_correct_value_for_set) | 100 | TEST(Property, signal_changed_is_emitted_with_correct_value_for_set) |
213 | 101 | { | 101 | { |
214 | 102 | static const int default_value = 42; | 102 | static const int default_value = 42; |
216 | 103 | com::ubuntu::Property<int> p1; | 103 | core::Property<int> p1; |
217 | 104 | Expectation<int> expectation{default_value}; | 104 | Expectation<int> expectation{default_value}; |
218 | 105 | 105 | ||
219 | 106 | p1.changed().connect([&expectation](int value) { expectation.triggered = true; expectation.current_value = value; }); | 106 | p1.changed().connect([&expectation](int value) { expectation.triggered = true; expectation.current_value = value; }); |
220 | @@ -113,7 +113,7 @@ | |||
221 | 113 | TEST(Property, signal_changed_is_emitted_with_correct_value_for_assignment) | 113 | TEST(Property, signal_changed_is_emitted_with_correct_value_for_assignment) |
222 | 114 | { | 114 | { |
223 | 115 | static const int default_value = 42; | 115 | static const int default_value = 42; |
225 | 116 | com::ubuntu::Property<int> p1; | 116 | core::Property<int> p1; |
226 | 117 | 117 | ||
227 | 118 | Expectation<int> expectation{42}; | 118 | Expectation<int> expectation{42}; |
228 | 119 | 119 | ||
229 | @@ -127,7 +127,7 @@ | |||
230 | 127 | TEST(Property, signal_changed_is_emitted_with_correct_value_for_update) | 127 | TEST(Property, signal_changed_is_emitted_with_correct_value_for_update) |
231 | 128 | { | 128 | { |
232 | 129 | static const int default_value = 42; | 129 | static const int default_value = 42; |
234 | 130 | com::ubuntu::Property<int> p1; | 130 | core::Property<int> p1; |
235 | 131 | 131 | ||
236 | 132 | Expectation<int> expectation{default_value}; | 132 | Expectation<int> expectation{default_value}; |
237 | 133 | 133 | ||
238 | @@ -146,7 +146,7 @@ | |||
239 | 146 | cursor_position.set(new_position); | 146 | cursor_position.set(new_position); |
240 | 147 | } | 147 | } |
241 | 148 | 148 | ||
243 | 149 | com::ubuntu::Property<int> cursor_position; | 149 | core::Property<int> cursor_position; |
244 | 150 | }; | 150 | }; |
245 | 151 | } | 151 | } |
246 | 152 | 152 | ||
247 | 153 | 153 | ||
248 | === modified file 'tests/signals_test.cpp' | |||
249 | --- tests/signals_test.cpp 2013-11-27 08:44:49 +0000 | |||
250 | +++ tests/signals_test.cpp 2013-11-28 07:42:04 +0000 | |||
251 | @@ -16,7 +16,7 @@ | |||
252 | 16 | * Authored by: Thomas Voß <thomas.voss@canonical.com> | 16 | * Authored by: Thomas Voß <thomas.voss@canonical.com> |
253 | 17 | */ | 17 | */ |
254 | 18 | 18 | ||
256 | 19 | #include <com/ubuntu/signal.h> | 19 | #include <core/signal.h> |
257 | 20 | 20 | ||
258 | 21 | #include <gtest/gtest.h> | 21 | #include <gtest/gtest.h> |
259 | 22 | 22 | ||
260 | @@ -49,7 +49,7 @@ | |||
261 | 49 | { | 49 | { |
262 | 50 | Expectation<int> expectation{42}; | 50 | Expectation<int> expectation{42}; |
263 | 51 | 51 | ||
265 | 52 | com::ubuntu::Signal<int> s; | 52 | core::Signal<int> s; |
266 | 53 | s.connect([&expectation](int value) { expectation.triggered = true; expectation.current_value = value; }); | 53 | s.connect([&expectation](int value) { expectation.triggered = true; expectation.current_value = value; }); |
267 | 54 | 54 | ||
268 | 55 | s(42); | 55 | s(42); |
269 | @@ -61,7 +61,7 @@ | |||
270 | 61 | { | 61 | { |
271 | 62 | Expectation<int> expectation{42}; | 62 | Expectation<int> expectation{42}; |
272 | 63 | 63 | ||
274 | 64 | com::ubuntu::Signal<int> s; | 64 | core::Signal<int> s; |
275 | 65 | auto connection = s.connect( | 65 | auto connection = s.connect( |
276 | 66 | [&expectation](int value) | 66 | [&expectation](int value) |
277 | 67 | { | 67 | { |
278 | @@ -78,7 +78,7 @@ | |||
279 | 78 | { | 78 | { |
280 | 79 | Expectation<int> expectation{42}; | 79 | Expectation<int> expectation{42}; |
281 | 80 | 80 | ||
283 | 81 | com::ubuntu::Signal<int> s; | 81 | core::Signal<int> s; |
284 | 82 | auto connection = s.connect( | 82 | auto connection = s.connect( |
285 | 83 | [&expectation](int value) | 83 | [&expectation](int value) |
286 | 84 | { | 84 | { |
287 | @@ -86,7 +86,7 @@ | |||
288 | 86 | expectation.current_value = value; | 86 | expectation.current_value = value; |
289 | 87 | }); | 87 | }); |
290 | 88 | { | 88 | { |
292 | 89 | com::ubuntu::ScopedConnection sc{connection}; | 89 | core::ScopedConnection sc{connection}; |
293 | 90 | } | 90 | } |
294 | 91 | s(42); | 91 | s(42); |
295 | 92 | 92 | ||
296 | @@ -95,13 +95,13 @@ | |||
297 | 95 | 95 | ||
298 | 96 | TEST(Signal, a_signal_going_out_of_scope_disconnects_from_slots) | 96 | TEST(Signal, a_signal_going_out_of_scope_disconnects_from_slots) |
299 | 97 | { | 97 | { |
301 | 98 | auto signal = std::make_shared<com::ubuntu::Signal<int>>(); | 98 | auto signal = std::make_shared<core::Signal<int>>(); |
302 | 99 | 99 | ||
303 | 100 | auto connection = signal->connect([](int value) { std::cout << value << std::endl; }); | 100 | auto connection = signal->connect([](int value) { std::cout << value << std::endl; }); |
304 | 101 | 101 | ||
305 | 102 | signal.reset(); | 102 | signal.reset(); |
306 | 103 | 103 | ||
308 | 104 | com::ubuntu::Connection::Dispatcher dispatcher{}; | 104 | core::Connection::Dispatcher dispatcher{}; |
309 | 105 | 105 | ||
310 | 106 | EXPECT_NO_THROW(connection.disconnect()); | 106 | EXPECT_NO_THROW(connection.disconnect()); |
311 | 107 | EXPECT_NO_THROW(connection.dispatch_via(dispatcher)); | 107 | EXPECT_NO_THROW(connection.dispatch_via(dispatcher)); |
312 | @@ -159,7 +159,7 @@ | |||
313 | 159 | std::thread::id dispatcher_thread_id = dispatcher_thread.get_id(); | 159 | std::thread::id dispatcher_thread_id = dispatcher_thread.get_id(); |
314 | 160 | 160 | ||
315 | 161 | // The signal that we want to dispatch via the event loop. | 161 | // The signal that we want to dispatch via the event loop. |
317 | 162 | com::ubuntu::Signal<int, double> s; | 162 | core::Signal<int, double> s; |
318 | 163 | 163 | ||
319 | 164 | static const int expected_invocation_count = 10000; | 164 | static const int expected_invocation_count = 10000; |
320 | 165 | 165 |
As per the irc discussion, let's go with this. We can change it later if a better name comes along.