C++ docs update

This commit is contained in:
Olivier Goffart 2020-11-10 19:33:23 +01:00
parent d6a440aa4a
commit 3886ed329f
2 changed files with 15 additions and 13 deletions

View file

@ -153,11 +153,13 @@ struct TodoItem {
struct MainWindow { struct MainWindow {
public: public:
inline auto get_todo_model () -> std::shared_ptr<sixtyfps::Model<TodoItem>>; inline auto create () -> sixtyfps::ComponentHandle<MainWindow>;
inline void set_todo_model (const std::shared_ptr<sixtyfps::Model<TodoItem>> &value);
inline void emit_todo_added (sixtyfps::SharedString arg_0); inline auto get_todo_model () const -> std::shared_ptr<sixtyfps::Model<TodoItem>>;
template<typename Functor> inline void on_todo_added (Functor && signal_handler); inline void set_todo_model (const std::shared_ptr<sixtyfps::Model<TodoItem>> &value) const;
inline void emit_todo_added (sixtyfps::SharedString arg_0) const;
template<typename Functor> inline void on_todo_added (Functor && signal_handler) const;
//... //...
} }
@ -171,7 +173,7 @@ We can then use this from out .cpp file
int main() { int main() {
// Let's instantiate our window // Let's instantiate our window
auto todo_app = std::make_unique<MainWindow>(); auto todo_app = MainWindow::create();
// let's create a model: // let's create a model:
auto todo_model = std::make_shared<sixtyfps::VectorModel<TodoItem>>(std::vector { auto todo_model = std::make_shared<sixtyfps::VectorModel<TodoItem>>(std::vector {

View file

@ -42,27 +42,27 @@ This will generate a header with the following contents (edited for documentatio
class SampleComponent { class SampleComponent {
public: public:
/// Contructor /// Contructor
inline SampleComponent (); inline auto create () -> sixtyfps::ComponentHandle<MainWindow>;
/// Destructor /// Destructor
inline ~SampleComponent (); inline ~SampleComponent ();
/// Show this component, and runs the event loop /// Show this component, and runs the event loop
inline void run (); inline void run () const;
/// Getter for the `counter` property /// Getter for the `counter` property
inline int get_counter () -> int; inline int get_counter () const -> int;
/// Setter for the `counter` property /// Setter for the `counter` property
inline void set_counter (const int &value); inline void set_counter (const int &value) const;
/// Getter for the `user_name` property /// Getter for the `user_name` property
inline sixtyfps::SharedString get_user_name (); inline sixtyfps::SharedString get_user_name () const;
/// Setter for the `user_name` property /// Setter for the `user_name` property
inline void set_user_name (const sixtyfps::SharedString &value); inline void set_user_name (const sixtyfps::SharedString &value) const;
/// Call this function to emit the `hello` signal /// Call this function to emit the `hello` signal
inline void emit_hello (); inline void emit_hello () const;
/// Sets the signal handler for the `hello` signal. /// Sets the signal handler for the `hello` signal.
template<typename Functor> inline void on_hello (Functor && signal_handler); template<typename Functor> inline void on_hello (Functor && signal_handler) const;
private: private:
/// private fields omitted /// private fields omitted