[SRUK] Initial copy from Tizen 2.2 version
[platform/core/uifw/dali-core.git] / docs / templates / example-class-internal.h
1 #ifndef __DALI_INTERNAL_EXAMPLE_CLASS_H__
2 #define __DALI_INTERNAL_EXAMPLE_CLASS_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.0 (the License);
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //     http://floralicense.org/license/
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an AS IS BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19
20 // EXTERNAL INCLUDES
21 #include <list>
22 #include <string>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/core/actors/actor.h>
26
27 namespace Dali
28 {
29
30 // Forward declarations for the Dali namespace
31 class XXXX;
32
33 namespace Internal
34 {
35
36 // Forward declarations for the Dali::Internal namespace
37 class YYYY;
38
39 /**
40  * TODO - Rewrite this comment, to explain the purpose of your class
41  */
42 class ExampleClass : public ExampleBaseClass
43 {
44 public: // Types
45
46   typedef std::list<XXXX> ExampleContainer;
47
48   enum ExampleEnum
49   {
50     FirstValue  = 0, ///< First value description
51     SecondValue = 1  ///< Second value description
52   };
53
54 public: // Construction
55
56   /**
57    * Create an ExampleClass.
58    */
59   ExampleClass();
60
61   /**
62    * Create an ExampleClass with a name.
63    * @param[in] The name of the example class.
64    */
65   ExampleClass(const std::string& name);
66
67   /**
68    * Virtual destructor; ExampleClass is intended as a base class.
69    */
70   virtual ~ExampleClass();
71
72 public: // Public members
73
74   /**
75    * Set the name of an ExampleClass.
76    * @pre TODO - Edit this example comment.
77    * @param[in] The new name.
78    * @post TODO - Edit this example comment.
79    */
80   void SetName();
81
82   /**
83    * Retreive the name of an ExampleClass.
84    * @pre TODO - Edit this example comment.
85    * @return The name of the example class.
86    * @post TODO - Edit this example comment.
87    */
88   std::string GetName() const { return mName; }
89
90 protected: // Protected members
91
92   /**
93    * Example helper method, which is accessible by derived classes.
94    * @param [in] exampleParam An an example parameter.
95    */
96   void HelperMember(ExampleEnum exampleParam);
97
98 private: // Private members
99
100   /**
101    * Undefined copy constructor; declaring this prevents accidental copying.
102    * @param[in] A reference to the ExampleClass to copy.
103    */
104   ExampleClass(const ExampleClass&);
105
106   /**
107    * Undefined assignment operator; declaring this prevents accidental copying.
108    * @param[in] A reference to the ExampleClass to copy.
109    * @return A reference to the copied ExampleClass.
110    */
111   ExampleClass& operator=(const ExampleClass& rhs);
112
113   /**
114    * Example pure virtual member.
115    * The intention here is to avoid making the public SetName() virtual.
116    * When the name changes, derived classes receive this notification.
117    */
118   virtual void OnNameSet() = 0;
119
120 protected: // Protected data
121
122   ExampleContainer mContainer;
123
124 private: // Private data
125
126   std::string mName;
127 };
128
129 } // namespace Internal
130
131 // Helpers for public-api forwarding methods
132
133 inline Internal::ExampleClass& GetImplementation(Dali::ExampleClass& example)
134 {
135   DALI_ASSERT(example);
136
137   BaseObject& handle = example.GetBaseObject();
138
139   return static_cast<Internal::ExampleClass&>(handle);
140 }
141
142 inline const Internal::ExampleClass& GetImplementation(const Dali::ExampleClass& example)
143 {
144   DALI_ASSERT(example);
145
146   const BaseObject& handle = example.GetBaseObject();
147
148   return static_cast<const Internal::ExampleClass&>(handle);
149 }
150
151 } // namespace Dali
152
153 #endif // __DALI_INTERNAL_EXAMPLE_CLASS_H__
154