- Create the cache directly from the schema (installed) file.
[platform/upstream/libzypp.git] / zypp / ResTraits.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/ResTraits.h
10  *
11 */
12 #ifndef ZYPP_RESTRAITS_H
13 #define ZYPP_RESTRAITS_H
14
15 #include "zypp/base/PtrTypes.h"
16 #include "zypp/base/KindOf.h"
17
18 ///////////////////////////////////////////////////////////////////
19 namespace zypp
20 { /////////////////////////////////////////////////////////////////
21
22   class Resolvable;
23   class ResObject;
24
25   class Atom;
26   class Package;
27   class SrcPackage;
28   class Selection;
29   class Pattern;
30   class Product;
31   class Patch;
32   class Script;
33   class Message;
34   class Language;
35
36   class SystemResObject;
37
38   /** Base of ResTraits. Defines the Resolvable::Kind type. */
39   struct ResolvableTraits
40   {
41     typedef KindOf<Resolvable>  KindType;
42   };
43
44   /** ResTraits. Defines common types and the Kind value. */
45   template<typename _Res>
46     struct ResTraits : public ResolvableTraits
47     {
48       typedef intrusive_ptr<_Res>       PtrType;
49       typedef intrusive_ptr<const _Res> constPtrType;
50
51       static const KindType kind;
52     };
53
54   /** ResTraits specialisation for Resolvable.
55    * Resolvable is common base and has no Kind value.
56   */
57   template<>
58     struct ResTraits<Resolvable> : public ResolvableTraits
59     {
60       typedef intrusive_ptr<Resolvable>       PtrType;
61       typedef intrusive_ptr<const Resolvable> constPtrType;
62     };
63
64   /** ResTraits specialisation for ResObject.
65    * ResObject is common base and has no Kind value.
66   */
67   template<>
68     struct ResTraits<ResObject> : public ResolvableTraits
69     {
70       typedef intrusive_ptr<ResObject>       PtrType;
71       typedef intrusive_ptr<const ResObject> constPtrType;
72     };
73
74   /////////////////////////////////////////////////////////////////
75 } // namespace zypp
76 ///////////////////////////////////////////////////////////////////
77 #endif // ZYPP_RESTRAITS_H