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