PhoenixPresentation  2.0.0
Set of cmake function to automate presentation generation
PLocation.cpp
Go to the documentation of this file.
1 /***************************************
2  Auteur : Pierre Aubert
3  Mail : pierre.aubert@lapp.in2p3.fr
4  Licence : CeCILL-C
5 ****************************************/
6 
7 #include "PLocation.h"
8 
9 
11 // //
12 // Fonctions publiques de la classe PLocation //
13 // //
15 
16 
18 
22 PLocation::PLocation(const PPath & fileName, size_t line, size_t column){
23  initialisationPLocation(fileName, line, column);
24 }
25 
27 
30  copyPLocation(other);
31 }
32 
35 
36 }
37 
39 
41 void PLocation::setFileName(const PPath & fileName){
42  p_fileName = fileName;
43 }
44 
46 
48 void PLocation::setLine(size_t line){
49  p_line = line;
50 }
51 
53 
55 void PLocation::setColumn(size_t column){p_column = column;}
56 
58 
61  return p_fileName;
62 }
63 
65 
67 size_t PLocation::getLine() const{
68  return p_line;
69 }
70 
72 
74 size_t PLocation::getColumn() const{
75  return p_column;
76 }
77 
79 // //
80 // Les opérateurs de la classe PLocation //
81 // //
83 
84 
86 
90  copyPLocation(other);
91  return *this;
92 }
93 
95 // //
96 // Les opérateurs amis de la classe PLocation //
97 // //
99 
100 
102 
106 bool operator == (const PLocation & other1, const PLocation & other2){
107  return (other1.p_fileName == other2.p_fileName && other1.p_line == other2.p_line);
108 }
109 
111 
115 bool operator != (const PLocation & other1, const PLocation & other2){
116  return (other1.p_fileName != other2.p_fileName || other1.p_line != other2.p_line);
117 }
118 
120 
124 std::ostream & operator << (std::ostream & out, const PLocation & other){
125  out << "'" << other.p_fileName << "':" << other.p_line << ":" << other.p_column;
126  return out;
127 }
128 
130 // //
131 // Fonctions private de la classe PLocation //
132 // //
134 
135 
137 
141 void PLocation::initialisationPLocation(const PPath & fileName, size_t line, size_t column){
142  p_fileName = fileName;
143  p_line = line;
144  p_column = column;
145 }
146 
148 
151  p_fileName = other.p_fileName;
152  p_line = other.p_line;
153  p_column = other.p_column;
154 }
155 
bool operator==(const PLocation &other1, const PLocation &other2)
Définition de l'opérateur ami == de la classe PLocation.
Definition: PLocation.cpp:106
bool operator!=(const PLocation &other1, const PLocation &other2)
Définition de l'opérateur ami != de la classe PLocation.
Definition: PLocation.cpp:115
std::ostream & operator<<(std::ostream &out, const PLocation &other)
Définition de l'opérateur ami << de la classe PLocation.
Definition: PLocation.cpp:124
Classe qui permet de décrire une localisation, avec un nom de fichier et une ligne.
Definition: PLocation.h:15
size_t p_column
COlonne du fichier vers laquelle le PLocation pointe.
Definition: PLocation.h:44
PLocation(const PPath &fileName=PPath(), size_t line=0lu, size_t column=0lu)
Constructeur par défaut de PLocation.
Definition: PLocation.cpp:22
PPath p_fileName
fichier vers lequel le PLocation pointe
Definition: PLocation.h:40
void setFileName(const PPath &fileName)
fonction qui permet d'initialiser la ligne du PLocation
Definition: PLocation.cpp:41
size_t getLine() const
renvoie la ligne du PLocation
Definition: PLocation.cpp:67
void initialisationPLocation(const PPath &fileName, size_t line, size_t column)
Fonction d'initialisation de la classe PLocation.
Definition: PLocation.cpp:141
void setLine(size_t line)
fonction qui permet d'initialiser la ligne du PLocation
Definition: PLocation.cpp:48
PLocation & operator=(const PLocation &other)
Définition de l'opérateur = de PLocation.
Definition: PLocation.cpp:89
virtual ~PLocation()
Destructeur de PLocation.
Definition: PLocation.cpp:34
PPath getFileName() const
renvoie le fichier du PLocation
Definition: PLocation.cpp:60
size_t getColumn() const
renvoie la colonne du PLocation
Definition: PLocation.cpp:74
void copyPLocation(const PLocation &other)
Fonction de copie de la classe PLocation.
Definition: PLocation.cpp:150
size_t p_line
ligne du fichier vers lequel le PLocation pointe
Definition: PLocation.h:42
void setColumn(size_t column)
fonction qui permet d'initialiser la colonne du PLocation
Definition: PLocation.cpp:55
Path of a directory or a file.
Definition: PPath.h:17