Provide sixtyfps::Window by reference in the generated C++ API

This commit is contained in:
Simon Hausmann 2021-07-26 18:05:58 +02:00 committed by Simon Hausmann
parent 29f5853332
commit 341387c8d0
4 changed files with 34 additions and 30 deletions

View file

@ -276,14 +276,8 @@ public:
/// Internal function used by the generated code to construct a new instance of this
/// public API wrapper.
explicit Window(const private_api::WindowRc &windowrc) : inner(windowrc) { }
/// Copy-constructs a new window from \a other. Window instances are explicitly
/// shared and reference counted. Creating a copy will not create a second window
/// on the screen.
Window(const Window &other) = default;
/// Copy-constructs the window \a other to this and returns a reference to this.
/// Window instances are explicitly shared and reference counted. Creating a copy
/// will not create a second window on the screen.
Window &operator=(const Window &other) = default;
Window(const Window &other) = delete;
Window &operator=(const Window &other) = delete;
Window(Window &&other) = delete;
Window &operator=(Window &&other) = delete;
/// Destroys this window. Window instances are explicitly shared and reference counted.
@ -296,6 +290,11 @@ public:
/// De-registers the window from the windowing system, therefore hiding it.
void hide() const { inner.hide(); }
/// \private
private_api::WindowRc &window_handle() { return inner; }
/// \private
const private_api::WindowRc &window_handle() const { return inner; }
private:
private_api::WindowRc inner;
};