| 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 |
2/2✓ Branch 0 (3→4) taken 18 times.
✓ Branch 2 (4→5) taken 18 times.
|
18 | PClassConfig::PClassConfig(){ |
| 12 |
1/1✓ Branch 0 (8→9) taken 18 times.
|
18 | initialisationPClassConfig(); |
| 13 | 18 | } | |
| 14 | |||
| 15 | ///Copy constructor of PClassConfig | ||
| 16 | /** @param other : class to copy | ||
| 17 | */ | ||
| 18 |
2/2✓ Branch 0 (3→4) taken 35 times.
✓ Branch 2 (4→5) taken 35 times.
|
35 | PClassConfig::PClassConfig(const PClassConfig & other){ |
| 19 |
1/1✓ Branch 0 (8→9) taken 35 times.
|
35 | copyPClassConfig(other); |
| 20 | 35 | } | |
| 21 | |||
| 22 | ///Destructeur of PClassConfig | ||
| 23 | 53 | PClassConfig::~PClassConfig(){ | |
| 24 | |||
| 25 | 53 | } | |
| 26 | |||
| 27 | ///Definition of equal operator of PClassConfig | ||
| 28 | /** @param other : class to copy | ||
| 29 | * @return copied class | ||
| 30 | */ | ||
| 31 | 5 | PClassConfig & PClassConfig::operator = (const PClassConfig & other){ | |
| 32 | 5 | copyPClassConfig(other); | |
| 33 | 5 | return *this; | |
| 34 | } | ||
| 35 | |||
| 36 | ///Sets the class documentation | ||
| 37 | /** @param classDocumentation : class documentation | ||
| 38 | */ | ||
| 39 | 13 | void PClassConfig::setClassDocumentation(const PString & classDocumentation){ | |
| 40 | 13 | p_classDocumentation = classDocumentation; | |
| 41 | 13 | } | |
| 42 | |||
| 43 | ///Sets the class name | ||
| 44 | /** @param name : name of the class | ||
| 45 | */ | ||
| 46 | 13 | void PClassConfig::setName(const PString & name){ | |
| 47 | 13 | p_name = name; | |
| 48 | 13 | } | |
| 49 | |||
| 50 | ///Sets the namespace of the class | ||
| 51 | /** @param value : namespace of the class (e.g. "Space" for "Space::Class") | ||
| 52 | */ | ||
| 53 | 6 | void PClassConfig::setNamespace(const PString & value){ | |
| 54 | 6 | p_namespace = value; | |
| 55 | 6 | } | |
| 56 | |||
| 57 | ///Sets the list of attributes of the class | ||
| 58 | /** @param listAttribute : list of the attributes of the class | ||
| 59 | */ | ||
| 60 | ✗ | void PClassConfig::setListAttribute(const std::vector<PClassAttribute> & listAttribute){ | |
| 61 | ✗ | p_listAttribute = listAttribute; | |
| 62 | ✗ | } | |
| 63 | |||
| 64 | ///Sets the list of template of the class | ||
| 65 | /** @param listTemplate : list of the template of the class | ||
| 66 | */ | ||
| 67 | 6 | void PClassConfig::setListTemplate(const PVecString & listTemplate){ | |
| 68 | 6 | p_listTemplate = listTemplate; | |
| 69 | 6 | } | |
| 70 | |||
| 71 | ///Adds an attribute to the class | ||
| 72 | /** @param attribute : attribute to add to the class | ||
| 73 | */ | ||
| 74 | 27 | void PClassConfig::addAttribute(const PClassAttribute & attribute){ | |
| 75 | 27 | p_listAttribute.push_back(attribute); | |
| 76 | 27 | } | |
| 77 | |||
| 78 | ///Adds a list of attributes to the class | ||
| 79 | /** @param listAttribute : list of attributes to add to the class | ||
| 80 | */ | ||
| 81 | ✗ | void PClassConfig::addListAttribute(const std::vector<PClassAttribute> & listAttribute){ | |
| 82 | ✗ | for(std::vector<PClassAttribute>::const_iterator it(listAttribute.begin()); it != listAttribute.end(); ++it){ | |
| 83 | ✗ | addAttribute(*it); | |
| 84 | } | ||
| 85 | ✗ | } | |
| 86 | |||
| 87 | ///Add a parent class to the PClassConfig | ||
| 88 | /** @param parentClass : parent class we want to add in the PClassConfig | ||
| 89 | */ | ||
| 90 | ✗ | void PClassConfig::addParentClass(const PString & parentClass){ | |
| 91 | ✗ | p_listParentClass.push_back(parentClass); | |
| 92 | ✗ | } | |
| 93 | |||
| 94 | ///Add a parent classes to the PClassConfig | ||
| 95 | /** @param listParentClass : list of parent classes we want to add in the PClassConfig | ||
| 96 | */ | ||
| 97 | ✗ | void PClassConfig::addListParentClass(const PVecString & listParentClass){ | |
| 98 | ✗ | for(PVecString::const_iterator it(listParentClass.begin()); it != listParentClass.end(); ++it){ | |
| 99 | ✗ | addParentClass(*it); | |
| 100 | } | ||
| 101 | ✗ | } | |
| 102 | |||
| 103 | ///Add a template to the PClassConfig | ||
| 104 | /** @param defTemplate : template we want to add in the PClassConfig | ||
| 105 | */ | ||
| 106 | ✗ | void PClassConfig::addTemplate(const PString & defTemplate){ | |
| 107 | ✗ | p_listTemplate.push_back(defTemplate); | |
| 108 | ✗ | } | |
| 109 | |||
| 110 | ///Add a template to the PClassConfig | ||
| 111 | /** @param listTemplate : list of templates we want to add in the PClassConfig | ||
| 112 | */ | ||
| 113 | ✗ | void PClassConfig::addListTemplate(const PVecString & listTemplate){ | |
| 114 | ✗ | for(PVecString::const_iterator it(listTemplate.begin()); it != listTemplate.end(); ++it){ | |
| 115 | ✗ | addTemplate(*it); | |
| 116 | } | ||
| 117 | ✗ | } | |
| 118 | |||
| 119 | ///Set if the current PClassConfig is an enum | ||
| 120 | /** @param isEnum : true if the current PClassConfig is an enum | ||
| 121 | */ | ||
| 122 | 3 | void PClassConfig::setIsEnum(bool isEnum){ | |
| 123 | 3 | p_isEnum = isEnum; | |
| 124 | 3 | } | |
| 125 | |||
| 126 | ///Returns the class name | ||
| 127 | /** @return class name | ||
| 128 | */ | ||
| 129 | 440 | const PString & PClassConfig::getName() const{return p_name;} | |
| 130 | |||
| 131 | ///Returns the class name | ||
| 132 | /** @return class name | ||
| 133 | */ | ||
| 134 | ✗ | PString & PClassConfig::getName(){return p_name;} | |
| 135 | |||
| 136 | ///Returns the namespace of the class | ||
| 137 | /** @return namespace of the class | ||
| 138 | */ | ||
| 139 | 20 | const PString & PClassConfig::getNamespace() const{return p_namespace;} | |
| 140 | |||
| 141 | ///Returns the namespace of the class | ||
| 142 | /** @return namespace of the class | ||
| 143 | */ | ||
| 144 | ✗ | PString & PClassConfig::getNamespace(){return p_namespace;} | |
| 145 | |||
| 146 | ///Returns the full name of the class including the namespace | ||
| 147 | /** @return full name (e.g. "Space::Class" or just "Class" if no namespace) | ||
| 148 | */ | ||
| 149 | 30 | PString PClassConfig::getFullName() const{ | |
| 150 |
1/2✓ Branch 0 (3→4) taken 30 times.
✗ Branch 1 (3→5) not taken.
|
30 | if(p_namespace == "") return p_name; |
| 151 | ✗ | return p_namespace + "::" + p_name; | |
| 152 | } | ||
| 153 | |||
| 154 | ///Returns the class documentation | ||
| 155 | /** @return class documentation | ||
| 156 | */ | ||
| 157 | 24 | const PString & PClassConfig::getClassDocumentation() const{return p_classDocumentation;} | |
| 158 | |||
| 159 | ///Returns the class documentation | ||
| 160 | /** @return class documentation | ||
| 161 | */ | ||
| 162 | ✗ | PString & PClassConfig::getClassDocumentation(){return p_classDocumentation;} | |
| 163 | |||
| 164 | ///Returns the list of attributes of the class | ||
| 165 | /** @return list of attributes of the class | ||
| 166 | */ | ||
| 167 | 137 | const std::vector<PClassAttribute> & PClassConfig::getListAttribute() const{return p_listAttribute;} | |
| 168 | |||
| 169 | ///Returns the list of attributes of the class | ||
| 170 | /** @return list of attributes of the class | ||
| 171 | */ | ||
| 172 | ✗ | std::vector<PClassAttribute> & PClassConfig::getListAttribute(){return p_listAttribute;} | |
| 173 | |||
| 174 | ///Returns the list of the parents of the class | ||
| 175 | /** @return list of the parents of the class | ||
| 176 | */ | ||
| 177 | 14 | const PVecString & PClassConfig::getListParentClass() const{return p_listParentClass;} | |
| 178 | |||
| 179 | ///Returns the list of the parents of the class | ||
| 180 | /** @return list of the parents of the class | ||
| 181 | */ | ||
| 182 | ✗ | PVecString & PClassConfig::getListParentClass(){return p_listParentClass;} | |
| 183 | |||
| 184 | ///Returns the list of the template of the class | ||
| 185 | /** @return list of the template of the class | ||
| 186 | */ | ||
| 187 | 52 | const PVecString & PClassConfig::getListTemplate() const{return p_listTemplate;} | |
| 188 | |||
| 189 | ///Returns the list of the template of the class | ||
| 190 | /** @return list of the template of the class | ||
| 191 | */ | ||
| 192 | ✗ | PVecString & PClassConfig::getListTemplate(){return p_listTemplate;} | |
| 193 | |||
| 194 | ///Say if the current PClassConfig is an enum | ||
| 195 | /** @return true if the current PClassConfig is an enum, false otherwise | ||
| 196 | */ | ||
| 197 | 234 | bool PClassConfig::getIsEnum() const{return p_isEnum;} | |
| 198 | |||
| 199 | ///Copy function of PClassConfig | ||
| 200 | /** @param other : class to copy | ||
| 201 | */ | ||
| 202 | 40 | void PClassConfig::copyPClassConfig(const PClassConfig & other){ | |
| 203 | 40 | p_listAttribute = other.p_listAttribute; | |
| 204 | 40 | p_name = other.p_name; | |
| 205 | 40 | p_classDocumentation = other.p_classDocumentation; | |
| 206 | 40 | p_listParentClass = other.p_listParentClass; | |
| 207 | 40 | p_listTemplate = other.p_listTemplate; | |
| 208 | 40 | p_isEnum = other.p_isEnum; | |
| 209 | 40 | p_namespace = other.p_namespace; | |
| 210 | 40 | } | |
| 211 | |||
| 212 | ///Initialisation function of the class PClassConfig | ||
| 213 | 18 | void PClassConfig::initialisationPClassConfig(){ | |
| 214 | 18 | p_isEnum = false; | |
| 215 | 18 | p_namespace = ""; | |
| 216 | 18 | } | |
| 217 |