DALi Version 2.2.21
[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) 2021 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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
21 // EXTERNAL INCLUDES
22 #include <list>
23 #include <string>
24
25 // INTERNAL INCLUDES
26 #include <dali/public-api/core/actors/actor.h>
27
28 namespace Dali
29 {
30 // Forward declarations for the Dali namespace
31 class XXXX;
32
33 namespace Internal
34 {
35 // Forward declarations for the Dali::Internal namespace
36 class YYYY;
37
38 /**
39  * TODO - Rewrite this comment, to explain the purpose of your class
40  */
41 class ExampleClass : public ExampleBaseClass
42 {
43 public: // Types
44   typedef std::list<XXXX> ExampleContainer;
45
46   enum ExampleEnum
47   {
48     FirstValue  = 0, ///< First value description
49     SecondValue = 1  ///< Second value description
50   };
51
52 public: // Construction
53   /**
54    * Create an ExampleClass.
55    */
56   ExampleClass();
57
58   /**
59    * Create an ExampleClass with a name.
60    * @param[in] The name of the example class.
61    */
62   ExampleClass(const std::string& name);
63
64   /**
65    * Virtual destructor; ExampleClass is intended as a base class.
66    */
67   virtual ~ExampleClass();
68
69 public: // Public members
70   /**
71    * Set the name of an ExampleClass.
72    * @pre TODO - Edit this example comment.
73    * @param[in] The new name.
74    * @post TODO - Edit this example comment.
75    */
76   void SetName();
77
78   /**
79    * Retreive the name of an ExampleClass.
80    * @pre TODO - Edit this example comment.
81    * @return The name of the example class.
82    * @post TODO - Edit this example comment.
83    */
84   std::string GetName() const
85   {
86     return mName;
87   }
88
89 protected: // Protected members
90   /**
91    * Example helper method, which is accessible by derived classes.
92    * @param [in] exampleParam An an example parameter.
93    */
94   void HelperMember(ExampleEnum exampleParam);
95
96 private: // Private members
97   /**
98    * Undefined copy constructor; declaring this prevents accidental copying.
99    * @param[in] A reference to the ExampleClass to copy.
100    */
101   ExampleClass(const ExampleClass&);
102
103   /**
104    * Undefined assignment operator; declaring this prevents accidental copying.
105    * @param[in] A reference to the ExampleClass to copy.
106    * @return A reference to the copied ExampleClass.
107    */
108   ExampleClass& operator=(const ExampleClass& rhs);
109
110   /**
111    * Example pure virtual member.
112    * The intention here is to avoid making the public SetName() virtual.
113    * When the name changes, derived classes receive this notification.
114    */
115   virtual void OnNameSet() = 0;
116
117 protected: // Protected data
118   ExampleContainer mContainer;
119
120 private: // Private data
121   std::string mName;
122 };
123
124 } // namespace Internal
125
126 // Helpers for public-api forwarding methods
127
128 inline Internal::ExampleClass& GetImplementation(Dali::ExampleClass& example)
129 {
130   DALI_ASSERT(example);
131
132   BaseObject& handle = example.GetBaseObject();
133
134   return static_cast<Internal::ExampleClass&>(handle);
135 }
136
137 inline const Internal::ExampleClass& GetImplementation(const Dali::ExampleClass& example)
138 {
139   DALI_ASSERT(example);
140
141   const BaseObject& handle = example.GetBaseObject();
142
143   return static_cast<const Internal::ExampleClass&>(handle);
144 }
145
146 } // namespace Dali
147
148 #endif // DALI_INTERNAL_EXAMPLE_CLASS_H