Merge branch 'devel/master (1.2.0)' into tizen
[platform/core/uifw/dali-core.git] / dali / internal / event / resources / resource-type-path.h
1 #ifndef __DALI_INTERNAL_RESOURCE_TYPE_PATH_H__
2 #define __DALI_INTERNAL_RESOURCE_TYPE_PATH_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 <memory>
23 // INTERNAL INCLUDES
24 #include <dali/integration-api/resource-types.h>
25
26 namespace Dali
27 {
28
29 namespace Internal
30 {
31
32 /**
33  * A resource Type & Path pair. This is used by ResourceManager when creating tickets.
34  * A new ticket will only be needed, if the same resource Type & Path has not already been requested.
35  */
36 class ResourceTypePath
37 {
38 public:
39
40   /**
41    * Create a resource Type and Path pair.
42    * @param[in] requestType The type of resource.
43    * @param[in] requestPath The path of the resource.
44    */
45   ResourceTypePath(const Integration::ResourceType& requestType,
46                    const std::string& requestPath)
47   : type(requestType.Clone()),
48     path(requestPath)
49   {
50   }
51
52   /**
53    * Copy constructor.
54    * @param[in] typePath The Type & Path to copy.
55    */
56   ResourceTypePath(const ResourceTypePath& typePath)
57   : type(typePath.type->Clone()),
58     path(typePath.path)
59   {
60   }
61
62   ~ResourceTypePath()
63   {
64     delete type;
65   }
66
67   /**
68    * Less than operator.
69    * @param[in] rhs The request to compare with.
70    */
71   bool operator<(const ResourceTypePath& rhs) const;
72
73 private:
74
75   /**
76    * Undefined assignment operator.
77    * @param[in] rhs The resource request to copy.
78    */
79   ResourceTypePath& operator=(const ResourceTypePath& rhs);
80
81 public:
82
83   const Integration::ResourceType* type;
84   const std::string path;
85 };
86
87 } // namespace Internal
88
89 } // namespace Dali
90
91 #endif // __DALI_INTERNAL_RESOURCE_TYPE_PATH_H__