1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // doxygen_xml2qbk Example
3 
4 // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 
6 // Use, modification and distribution is subject to the Boost Software License,
7 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
9 
10 
11 #ifndef FRUIT_HPP
12 #define FRUIT_HPP
13 
14 
15 #include <iostream>
16 #include <string>
17 
18 /*!
19 \defgroup fruit fruit: Fruit group
20 */
21 
22 namespace fruit
23 {
24 
25 /*!
26 \brief Enumeration to select color
27 \ingroup fruit
28 */
29 enum fruit_color
30 {
31     /// A yellow or yellowish color
32     yellow = 1,
33     /// A green or greeny color
34     green = 2,
35     /// An orange color
36     orange = 3
37 };
38 
39 
40 /*!
41 \brief Any metafunction (with type)
42 \ingroup fruit
43 */
44 struct fruit_type
45 {
46     /// the type
47     typedef int type;
48 };
49 
50 /*!
51 \brief Any metafunction (with value)
52 \ingroup fruit
53 */
54 struct fruit_value
55 {
56     /// the value
57     static const fruit_color value = yellow;
58 };
59 
60 
61 
62 /// Rose (Rosaceae)
63 class rose {};
64 
65 /*!
66 \brief An apple
67 \details The apple is the pomaceous fruit of the apple tree,
68     species Malus domestica in the rose family (Rosaceae)
69 \tparam String the string-type (string,wstring,utf8-string,etc)
70 
71 \qbk{before.synopsis,
72 [heading Model of]
73 Fruit Concept
74 }
75 */
76 template <typename String = std::string>
77 class apple : public rose
78 {
79     String sort;
80 
81 public :
82     /// constructor
apple(String const & s)83     apple(String const& s) : sort(s) {}
84 
85     /// Get the name
86     // (more doxygen e.g. @return, etc)
name() const87     String const& name() const { return sort; }
88 };
89 
90 
91 /*!
92 \brief Eat it
93 \ingroup fruit
94 \details Eat the fruit
95 \param fruit the fruit
96 \tparam T the fruit type
97 
98 \qbk{
99 [heading Example]
100 [apple]
101 [apple_output]
102 }
103 */
104 template <typename T>
eat(T const & fruit)105 void eat(T const& fruit)
106 {
107     std::cout << fruit.name() << std::endl;
108 }
109 
110 }
111 
112 
113 #endif
114