DUDS
Distributed Update of Data from Something
Page.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of the DUDS project. It is subject to the BSD-style
3  * license terms in the LICENSE file found in the top-level directory of this
4  * distribution and at https://github.com/jjackowski/duds/blob/master/LICENSE.
5  * No part of DUDS, including this file, may be copied, modified, propagated,
6  * or distributed except according to the terms contained in the LICENSE file.
7  *
8  * Copyright (C) 2019 Jeff Jackowski
9  */
10 #ifndef PAGE_HPP
11 #define PAGE_HPP
12 
13 #include <memory>
14 #include <string>
15 
16 namespace duds { namespace ui {
17 
24 class Page : public std::enable_shared_from_this<Page> {
28  std::string name;
29 protected:
34  void title(const std::string &t) {
35  name = t;
36  }
37 public:
41  Page() = default;
46  Page(const std::string &t) : name(t) { }
50  const std::string &title() const {
51  return name;
52  }
53 };
54 
58 typedef std::shared_ptr<Page> PageSptr;
59 
63 typedef std::weak_ptr<Page> PageWptr;
64 
65 } }
66 
67 #endif // #ifndef PAGE_HPP
Represents the notion of a page that may be visited, and helps allow a way to track the path of pages...
Definition: Page.hpp:24
std::string name
The page&#39;s name or title.
Definition: Page.hpp:28
Page()=default
Constructs a page with no name.
Page(const std::string &t)
Constructs a page with the given name.
Definition: Page.hpp:46
std::weak_ptr< Page > PageWptr
A weak pointer to a Page.
Definition: Page.hpp:63
void title(const std::string &t)
Changes the name of the page.
Definition: Page.hpp:34
std::shared_ptr< Page > PageSptr
A shared pointer to a Page.
Definition: Page.hpp:58
const std::string & title() const
Returns the name or title of the page.
Definition: Page.hpp:50