| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*************************************** | ||
| 2 | Auteur : Pierre Aubert | ||
| 3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
| 4 | Licence : CeCILL-C | ||
| 5 | ****************************************/ | ||
| 6 | |||
| 7 | #include "PLocation.h" | ||
| 8 | |||
| 9 | |||
| 10 | //////////////////////////////////////////////////// | ||
| 11 | // // | ||
| 12 | // Fonctions publiques de la classe PLocation // | ||
| 13 | // // | ||
| 14 | //////////////////////////////////////////////////// | ||
| 15 | |||
| 16 | |||
| 17 | ///Constructeur par défaut de PLocation | ||
| 18 | /** @param fileName : fichier vers lequel le PLocation pointe | ||
| 19 | * @param line : ligne du fichier vers lequel le PLocation pointe | ||
| 20 | * @param column : colonne du fichier vers lequel le PLocation pointe | ||
| 21 | */ | ||
| 22 | 116 | PLocation::PLocation(const PPath & fileName, size_t line, size_t column){ | |
| 23 |
1/1✓ Branch 0 (3→4) taken 116 times.
|
116 | initialisationPLocation(fileName, line, column); |
| 24 | 116 | } | |
| 25 | |||
| 26 | ///Constructeur de copier de PLocation | ||
| 27 | /** @param other : PLocation à copier | ||
| 28 | */ | ||
| 29 | 8 | PLocation::PLocation(const PLocation & other){ | |
| 30 |
1/1✓ Branch 0 (3→4) taken 8 times.
|
8 | copyPLocation(other); |
| 31 | 8 | } | |
| 32 | |||
| 33 | ///Destructeur de PLocation | ||
| 34 | 124 | PLocation::~PLocation(){ | |
| 35 | |||
| 36 | 124 | } | |
| 37 | |||
| 38 | ///fonction qui permet d'initialiser la ligne du PLocation | ||
| 39 | /** @param fileName : fichier du PLocation | ||
| 40 | */ | ||
| 41 | 9 | void PLocation::setFileName(const PPath & fileName){ | |
| 42 | 9 | p_fileName = fileName; | |
| 43 | 9 | } | |
| 44 | |||
| 45 | ///fonction qui permet d'initialiser la ligne du PLocation | ||
| 46 | /** @param line : ligne du PLocation | ||
| 47 | */ | ||
| 48 | 28 | void PLocation::setLine(size_t line){ | |
| 49 | 28 | p_line = line; | |
| 50 | 28 | } | |
| 51 | |||
| 52 | ///fonction qui permet d'initialiser la colonne du PLocation | ||
| 53 | /** @param column : colonne du PLocation | ||
| 54 | */ | ||
| 55 | 28 | void PLocation::setColumn(size_t column){p_column = column;} | |
| 56 | |||
| 57 | ///renvoie le fichier du PLocation | ||
| 58 | /** @return fichier du PLocation | ||
| 59 | */ | ||
| 60 | 28 | const PPath & PLocation::getFileName() const{ | |
| 61 | 28 | return p_fileName; | |
| 62 | } | ||
| 63 | |||
| 64 | ///renvoie la ligne du PLocation | ||
| 65 | /** @return ligne du PLocation | ||
| 66 | */ | ||
| 67 | 81 | size_t PLocation::getLine() const{ | |
| 68 | 81 | return p_line; | |
| 69 | } | ||
| 70 | |||
| 71 | ///renvoie la colonne du PLocation | ||
| 72 | /** @return colonne du PLocation | ||
| 73 | */ | ||
| 74 | 57 | size_t PLocation::getColumn() const{ | |
| 75 | 57 | return p_column; | |
| 76 | } | ||
| 77 | |||
| 78 | //////////////////////////////////////////////// | ||
| 79 | // // | ||
| 80 | // Les opérateurs de la classe PLocation // | ||
| 81 | // // | ||
| 82 | //////////////////////////////////////////////// | ||
| 83 | |||
| 84 | |||
| 85 | ///Définition de l'opérateur = de PLocation | ||
| 86 | /** @param other : PLocation à copier | ||
| 87 | * @return PLocation copiée | ||
| 88 | */ | ||
| 89 | 1 | PLocation & PLocation::operator = (const PLocation & other){ | |
| 90 | 1 | copyPLocation(other); | |
| 91 | 1 | return *this; | |
| 92 | } | ||
| 93 | |||
| 94 | ///////////////////////////////////////////////////// | ||
| 95 | // // | ||
| 96 | // Les opérateurs amis de la classe PLocation // | ||
| 97 | // // | ||
| 98 | ///////////////////////////////////////////////////// | ||
| 99 | |||
| 100 | |||
| 101 | ///Définition de l'opérateur ami == de la classe PLocation | ||
| 102 | /** @param other1 : PLocation | ||
| 103 | * @param other2 : PLocation | ||
| 104 | * @return true si other1 et other2 sont égaux, false sinonPLocation | ||
| 105 | */ | ||
| 106 | 7 | bool operator == (const PLocation & other1, const PLocation & other2){ | |
| 107 |
3/6✓ Branch 0 (3→4) taken 7 times.
✗ Branch 1 (3→7) not taken.
✓ Branch 2 (4→5) taken 7 times.
✗ Branch 3 (4→7) not taken.
✓ Branch 4 (5→6) taken 7 times.
✗ Branch 5 (5→7) not taken.
|
7 | return (other1.p_fileName == other2.p_fileName && other1.p_line == other2.p_line && other1.p_column == other2.p_column); |
| 108 | } | ||
| 109 | |||
| 110 | ///Définition de l'opérateur ami != de la classe PLocation | ||
| 111 | /** @param other1 : PLocation | ||
| 112 | * @param other2 : PLocation | ||
| 113 | * @return false si other1 et other2 sont égaux, true sinon | ||
| 114 | */ | ||
| 115 | 3 | bool operator != (const PLocation & other1, const PLocation & other2){ | |
| 116 |
3/6✓ Branch 0 (3→4) taken 3 times.
✗ Branch 1 (3→6) not taken.
✓ Branch 2 (4→5) taken 3 times.
✗ Branch 3 (4→6) not taken.
✗ Branch 4 (5→6) not taken.
✓ Branch 5 (5→7) taken 3 times.
|
3 | return (other1.p_fileName != other2.p_fileName || other1.p_line != other2.p_line || other1.p_column != other2.p_column); |
| 117 | } | ||
| 118 | |||
| 119 | ///Définition de l'opérateur ami << de la classe PLocation | ||
| 120 | /** @param out : sortie standart de la console (cout) | ||
| 121 | * @param other : PLocation à affiche dans la console | ||
| 122 | * @return sortie standart de la console (cout) | ||
| 123 | */ | ||
| 124 | 21 | std::ostream & operator << (std::ostream & out, const PLocation & other){ | |
| 125 | 21 | out << "'" << other.p_fileName << "':" << other.p_line << ":" << other.p_column; | |
| 126 | 21 | return out; | |
| 127 | } | ||
| 128 | |||
| 129 | ////////////////////////////////////////////////// | ||
| 130 | // // | ||
| 131 | // Fonctions private de la classe PLocation // | ||
| 132 | // // | ||
| 133 | ////////////////////////////////////////////////// | ||
| 134 | |||
| 135 | |||
| 136 | ///Fonction d'initialisation de la classe PLocation | ||
| 137 | /** @param fileName : fichier vers lequel le PLocation pointe | ||
| 138 | * @param line : ligne du fichier vers lequel le PLocation pointe | ||
| 139 | * @param column : colonne du fichier vers lequel le PLocation pointe | ||
| 140 | */ | ||
| 141 | 116 | void PLocation::initialisationPLocation(const PPath & fileName, size_t line, size_t column){ | |
| 142 | 116 | p_fileName = fileName; | |
| 143 | 116 | p_line = line; | |
| 144 | 116 | p_column = column; | |
| 145 | 116 | } | |
| 146 | |||
| 147 | ///Fonction de copie de la classe PLocation | ||
| 148 | /** @param other : PLocation à copier | ||
| 149 | */ | ||
| 150 | 9 | void PLocation::copyPLocation(const PLocation & other){ | |
| 151 | 9 | p_fileName = other.p_fileName; | |
| 152 | 9 | p_line = other.p_line; | |
| 153 | 9 | p_column = other.p_column; | |
| 154 | 9 | } | |
| 155 | |||
| 156 |