Directory: | ./ |
---|---|
File: | src/PClassConfig.cpp |
Date: | 2025-04-25 19:10:50 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 58 | 66 | 87.9% |
Branches: | 10 | 14 | 71.4% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /*************************************** | ||
2 | Auteur : Pierre Aubert | ||
3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
4 | Licence : CeCILL-C | ||
5 | ****************************************/ | ||
6 | |||
7 | |||
8 | #include "PClassConfig.h" | ||
9 | |||
10 | ///Default constructeur of PClassConfig | ||
11 |
1/1✓ Branch 2 taken 39 times.
|
39 | PClassConfig::PClassConfig(){ |
12 |
1/1✓ Branch 1 taken 39 times.
|
39 | initialisationPClassConfig(); |
13 | 39 | } | |
14 | |||
15 | ///Copy constructor of PClassConfig | ||
16 | /** @param other : class to copy | ||
17 | */ | ||
18 |
1/1✓ Branch 2 taken 40 times.
|
40 | PClassConfig::PClassConfig(const PClassConfig & other){ |
19 |
1/1✓ Branch 1 taken 40 times.
|
40 | copyPClassConfig(other); |
20 | 40 | } | |
21 | |||
22 | ///Destructeur of PClassConfig | ||
23 | 158 | PClassConfig::~PClassConfig(){ | |
24 | |||
25 | } | ||
26 | |||
27 | ///Definition of equal operator of PClassConfig | ||
28 | /** @param other : class to copy | ||
29 | * @return copied class | ||
30 | */ | ||
31 | 7 | PClassConfig & PClassConfig::operator = (const PClassConfig & other){ | |
32 | 7 | copyPClassConfig(other); | |
33 | 7 | return *this; | |
34 | } | ||
35 | |||
36 | ///Sets the class documentation | ||
37 | /** @param classDocumentation : class documentation | ||
38 | */ | ||
39 | 32 | void PClassConfig::setClassDocumentation(const PString & classDocumentation){ | |
40 | 32 | p_classDocumentation = classDocumentation; | |
41 | 32 | } | |
42 | |||
43 | ///Sets the class name | ||
44 | /** @param name : name of the class | ||
45 | */ | ||
46 | 32 | void PClassConfig::setName(const PString & name){ | |
47 | 32 | p_name = name; | |
48 | 32 | } | |
49 | |||
50 | ///Sets the list of attributes of the class | ||
51 | /** @param listAttribute : list of the attributes of the class | ||
52 | */ | ||
53 | 3 | void PClassConfig::setListAttribute(const std::vector<PClassAttribute> & listAttribute){ | |
54 | 3 | p_listAttribute = listAttribute; | |
55 | 3 | } | |
56 | |||
57 | ///Sets the list of template of the class | ||
58 | /** @param listTemplate : list of the template of the class | ||
59 | */ | ||
60 | 27 | void PClassConfig::setListTemplate(const PVecString & listTemplate){ | |
61 | 27 | p_listTemplate = listTemplate; | |
62 | 27 | } | |
63 | |||
64 | ///Adds an attribute to the class | ||
65 | /** @param attribute : attribute to add to the class | ||
66 | */ | ||
67 | 76 | void PClassConfig::addAttribute(const PClassAttribute & attribute){ | |
68 | 76 | p_listAttribute.push_back(attribute); | |
69 | 76 | } | |
70 | |||
71 | ///Adds a list of attributes to the class | ||
72 | /** @param listAttribute : list of attributes to add to the class | ||
73 | */ | ||
74 | 3 | void PClassConfig::addListAttribute(const std::vector<PClassAttribute> & listAttribute){ | |
75 |
2/2✓ Branch 4 taken 3 times.
✓ Branch 5 taken 3 times.
|
6 | for(std::vector<PClassAttribute>::const_iterator it(listAttribute.begin()); it != listAttribute.end(); ++it){ |
76 |
1/1✓ Branch 2 taken 3 times.
|
3 | addAttribute(*it); |
77 | } | ||
78 | 3 | } | |
79 | |||
80 | ///Add a parent class to the PClassConfig | ||
81 | /** @param parentClass : parent class we want to add in the PClassConfig | ||
82 | */ | ||
83 | 3 | void PClassConfig::addParentClass(const PString & parentClass){ | |
84 | 3 | p_listParentClass.push_back(parentClass); | |
85 | 3 | } | |
86 | |||
87 | ///Add a parent classes to the PClassConfig | ||
88 | /** @param listParentClass : list of parent classes we want to add in the PClassConfig | ||
89 | */ | ||
90 | 1 | void PClassConfig::addListParentClass(const PVecString & listParentClass){ | |
91 |
2/2✓ Branch 4 taken 2 times.
✓ Branch 5 taken 1 times.
|
3 | for(PVecString::const_iterator it(listParentClass.begin()); it != listParentClass.end(); ++it){ |
92 |
1/1✓ Branch 2 taken 2 times.
|
2 | addParentClass(*it); |
93 | } | ||
94 | 1 | } | |
95 | |||
96 | ///Add a template to the PClassConfig | ||
97 | /** @param defTemplate : template we want to add in the PClassConfig | ||
98 | */ | ||
99 | ✗ | void PClassConfig::addTemplate(const PString & defTemplate){ | |
100 | ✗ | p_listTemplate.push_back(defTemplate); | |
101 | } | ||
102 | |||
103 | ///Add a template to the PClassConfig | ||
104 | /** @param listTemplate : list of templates we want to add in the PClassConfig | ||
105 | */ | ||
106 | ✗ | void PClassConfig::addListTemplate(const PVecString & listTemplate){ | |
107 | ✗ | for(PVecString::const_iterator it(listTemplate.begin()); it != listTemplate.end(); ++it){ | |
108 | ✗ | addTemplate(*it); | |
109 | } | ||
110 | } | ||
111 | |||
112 | ///Set if the current PClassConfig is an enum | ||
113 | /** @param isEnum : true if the current PClassConfig is an enum | ||
114 | */ | ||
115 | 2 | void PClassConfig::setIsEnum(bool isEnum){ | |
116 | 2 | p_isEnum = isEnum; | |
117 | 2 | } | |
118 | |||
119 | ///Returns the class name | ||
120 | /** @return class name | ||
121 | */ | ||
122 | 1064 | const PString & PClassConfig::getName() const{return p_name;} | |
123 | |||
124 | ///Returns the class name | ||
125 | /** @return class name | ||
126 | */ | ||
127 | 3 | PString & PClassConfig::getName(){return p_name;} | |
128 | |||
129 | ///Returns the class documentation | ||
130 | /** @return class documentation | ||
131 | */ | ||
132 | 62 | const PString & PClassConfig::getClassDocumentation() const{return p_classDocumentation;} | |
133 | |||
134 | ///Returns the class documentation | ||
135 | /** @return class documentation | ||
136 | */ | ||
137 | ✗ | PString & PClassConfig::getClassDocumentation(){return p_classDocumentation;} | |
138 | |||
139 | ///Returns the list of attributes of the class | ||
140 | /** @return list of attributes of the class | ||
141 | */ | ||
142 | 308 | const std::vector<PClassAttribute> & PClassConfig::getListAttribute() const{return p_listAttribute;} | |
143 | |||
144 | ///Returns the list of attributes of the class | ||
145 | /** @return list of attributes of the class | ||
146 | */ | ||
147 | 8 | std::vector<PClassAttribute> & PClassConfig::getListAttribute(){return p_listAttribute;} | |
148 | |||
149 | ///Returns the list of the parents of the class | ||
150 | /** @return list of the parents of the class | ||
151 | */ | ||
152 | 60 | const PVecString & PClassConfig::getListParentClass() const{return p_listParentClass;} | |
153 | |||
154 | ///Returns the list of the parents of the class | ||
155 | /** @return list of the parents of the class | ||
156 | */ | ||
157 | ✗ | PVecString & PClassConfig::getListParentClass(){return p_listParentClass;} | |
158 | |||
159 | ///Returns the list of the template of the class | ||
160 | /** @return list of the template of the class | ||
161 | */ | ||
162 | 65 | const PVecString & PClassConfig::getListTemplate() const{return p_listTemplate;} | |
163 | |||
164 | ///Returns the list of the template of the class | ||
165 | /** @return list of the template of the class | ||
166 | */ | ||
167 | ✗ | PVecString & PClassConfig::getListTemplate(){return p_listTemplate;} | |
168 | |||
169 | ///Say if the current PClassConfig is an enum | ||
170 | /** @return true if the current PClassConfig is an enum, false otherwise | ||
171 | */ | ||
172 | 109 | bool PClassConfig::getIsEnum() const{return p_isEnum;} | |
173 | |||
174 | ///Copy function of PClassConfig | ||
175 | /** @param other : class to copy | ||
176 | */ | ||
177 | 47 | void PClassConfig::copyPClassConfig(const PClassConfig & other){ | |
178 | 47 | p_listAttribute = other.p_listAttribute; | |
179 | 47 | p_name = other.p_name; | |
180 | 47 | p_classDocumentation = other.p_classDocumentation; | |
181 | 47 | p_listParentClass = other.p_listParentClass; | |
182 | 47 | p_listTemplate = other.p_listTemplate; | |
183 | 47 | p_isEnum = other.p_isEnum; | |
184 | 47 | } | |
185 | |||
186 | ///Initialisation function of the class PClassConfig | ||
187 | 39 | void PClassConfig::initialisationPClassConfig(){ | |
188 | 39 | p_isEnum = false; | |
189 | 39 | } | |
190 | |||
191 | |||
192 | |||
193 | |||
194 | |||
195 |