PhoenixFileParser  1.0.0
Set of tools to ease file parsing
Loading...
Searching...
No Matches
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
22PLocation::PLocation(const PPath & fileName, size_t line, size_t column){
23 initialisationPLocation(fileName, line, column);
24}
25
27
30 copyPLocation(other);
31}
32
37
39
41void PLocation::setFileName(const PPath & fileName){
42 p_fileName = fileName;
43}
44
46
48void PLocation::setLine(size_t line){
49 p_line = line;
50}
51
53
55void PLocation::setColumn(size_t column){p_column = column;}
56
58
61 return p_fileName;
62}
63
65
67size_t PLocation::getLine() const{
68 return p_line;
69}
70
72
74size_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
106bool operator == (const PLocation & other1, const PLocation & other2){
107 return (other1.p_fileName == other2.p_fileName && other1.p_line == other2.p_line);
108}
109
111
115bool operator != (const PLocation & other1, const PLocation & other2){
116 return (other1.p_fileName != other2.p_fileName || other1.p_line != other2.p_line);
117}
118
120
124std::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
141void 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.
bool operator!=(const PLocation &other1, const PLocation &other2)
Définition de l'opérateur ami != de la classe PLocation.
std::ostream & operator<<(std::ostream &out, const PLocation &other)
Définition de l'opérateur ami << de la classe PLocation.
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.
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.
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