Read about our upcoming Code of Conduct on this issue

UBasePropCreator.h 5.02 KB
Newer Older
1
2
#ifndef UBASEPROPCREATOR_H
#define UBASEPROPCREATOR_H
3

4
5
#include "UBasePropCreatorTempl.h"

6
namespace RDK {
7

8
//        
9
class UBasePropCreator: public UBasePropCreatorTempl
10
{
11

12
public:
13
    //        (  Storage)
14
15
16
17
    static bool BaseCrPropMock(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet);

    //         () 
    template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
18
    static void CreateProperty(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet, unsigned int ptype);
19
20
21

    //        ,   
    template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
22
    static bool CreateSimpleTypeProperty(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet, unsigned int ptype);
23
24
};

25
26
27

//         () 
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
28
void UBasePropCreator::CreateProperty(RDK::USerStorageXML* serstorage, RDK::UMockUNet* mock_unet, unsigned int ptype)
29
30
31
32
33
{
    std::string type = serstorage->GetNodeAttribute("Type");

    //        
    //   -   
34
    if(CreateSimpleTypeProperty<PropType, TypeInt>(serstorage,mock_unet, ptype))
35
36
37
38
39
        return;

    // 
    if(type == "std::string")
    {
40
        CreatorProperty<PropType, TypeInt, std::string>::CreatePropertyByType(serstorage,mock_unet, ptype);
41
        return;
42
	}
43
44
45
46

    //UBMColorModel
    if(type == "UBMColorModel")
    {
47
        CreatorProperty<PropType, TypeInt, UBMColorModel>::CreatePropertyByType(serstorage,mock_unet, ptype);
48
49
50
51
52
53
        return;
    }

    // UColorT
    if(type == "UColorT")
    {
54
        CreatorProperty<PropType, TypeInt, UColorT>::CreatePropertyByType(serstorage,mock_unet, ptype);
55
56
57
58
59
60
        return;
    }

    // UBitmap
    if(type == "UBitmap")
    {
61
        CreatorProperty<PropType, TypeInt, UBitmap>::CreatePropertyByType(serstorage,mock_unet, ptype);
62
63
64
65
66
67
        return;
    }

    // UBRect
    if(type == "UBRect")
    {
68
        CreatorProperty<PropType, TypeInt, UBRect>::CreatePropertyByType(serstorage,mock_unet, ptype);
69
70
71
72
73
74
        return;
    }

    // UBPoint
    if(type == "UBPoint")
    {
75
        CreatorProperty<PropType, TypeInt, UBPoint>::CreatePropertyByType(serstorage,mock_unet, ptype);
76
77
78
        return;
    }

vlad_burin's avatar
vlad_burin committed
79
80

    // pointer
81
82
    if(type == "pointer")
    {
83
        CreatorProperty<PropType, TypeInt, void*>::CreatePropertyByType(serstorage, mock_unet, ptype);
84
85
        return;
    }
vlad_burin's avatar
vlad_burin committed
86

87
88
89
90
91

}

//        ,   
template <template<typename, typename, unsigned int> class PropType, unsigned int TypeInt>
92
bool UBasePropCreator::CreateSimpleTypeProperty(RDK::USerStorageXML* serstorage, RDK::UMockUNet * mock_unet, unsigned int ptype)
93
94
95
96
97
98
99
{
    std::string type = serstorage->GetNodeAttribute("Type");
    std::string prop_name = serstorage->GetNodeName();

    //  
    if(type == typeid(bool).name())
    {
100
        CreatorProperty<PropType, TypeInt, bool>::CreatePropertyByType(serstorage, mock_unet, ptype);
101
102
103
104
        return true;
    }
    if(type == typeid(unsigned char).name())
    {
105
        CreatorProperty<PropType, TypeInt, unsigned char>::CreatePropertyByType(serstorage, mock_unet, ptype);
106
107
        return true;
    }
108
    if(type == typeid(unsigned int).name())
109
    {
110
        CreatorProperty<PropType, TypeInt, unsigned int>::CreatePropertyByType(serstorage, mock_unet, ptype);
111
112
113
114
        return true;
    }
    if(type == typeid(int).name())
    {
115
        CreatorProperty<PropType, TypeInt, unsigned int>::CreatePropertyByType(serstorage, mock_unet, ptype);
116
117
118
119
        return true;
    }
    if(type == typeid(long).name())
    {
120
        CreatorProperty<PropType, TypeInt, long>::CreatePropertyByType(serstorage, mock_unet, ptype);
121
122
123
124
        return true;
    }
    if(type == typeid(unsigned long).name())
    {
125
        CreatorProperty<PropType, TypeInt, unsigned long>::CreatePropertyByType(serstorage, mock_unet, ptype);
126
127
128
129
        return true;
    }
    if(type == typeid(long long).name())
    {
130
        CreatorProperty<PropType, TypeInt, long long>::CreatePropertyByType(serstorage, mock_unet, ptype);
131
132
133
134
        return true;
    }
    if(type == typeid(unsigned long long).name())
    {
135
        CreatorProperty<PropType, TypeInt, unsigned long long>::CreatePropertyByType(serstorage, mock_unet, ptype);
136
137
138
139
        return true;
    }
    if(type == typeid(float).name())
    {
140
        CreatorProperty<PropType, TypeInt, float>::CreatePropertyByType(serstorage, mock_unet, ptype);
141
142
143
144
        return true;
    }
    if(type == typeid(double).name())
    {
145
        CreatorProperty<PropType, TypeInt, double>::CreatePropertyByType(serstorage, mock_unet, ptype);
146
147
148
149
150
151
152
        return true;
    }
    //throw ParseException("can't handle simple type: " + type);
    return false;

}

153
}
154
#endif // UBASEPROPCREATOR_H