initialCommit 4 ans en retard
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#include "CreneauHoraire.h"
|
||||
namespace modellib {
|
||||
CreneauHoraire::CreneauHoraire(const CreneauHoraire &creneau) : m_debut(creneau.getDebutC()),
|
||||
m_fin(creneau.getFinC()) {
|
||||
}
|
||||
|
||||
CreneauHoraire::CreneauHoraire(const SolverDate &pdebut, const SolverDate &pfin)
|
||||
: m_debut(pdebut), m_fin(pfin) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
nlohmann::json CreneauHoraire::to_json(bool format) const {
|
||||
nlohmann::json creneau = nlohmann::json::object();
|
||||
if (format) {
|
||||
creneau["debut"] = m_debut.to_json(true);
|
||||
creneau["fin"] = m_fin.to_json(true);
|
||||
} else {
|
||||
creneau["debut"] = m_debut.to_json();
|
||||
creneau["fin"] = m_fin.to_json();
|
||||
}
|
||||
return creneau;
|
||||
}
|
||||
|
||||
CreneauHoraire CreneauHoraire::from_json(nlohmann::json &json, bool format) {
|
||||
CreneauHoraire creneau;
|
||||
if (format) {
|
||||
creneau.m_debut = SolverDate::from_json(json["debut"], true);
|
||||
creneau.m_fin = SolverDate::from_json(json["fin"], true);
|
||||
} else {
|
||||
creneau.m_debut = SolverDate::from_json(json["debut"]);
|
||||
creneau.m_fin = SolverDate::from_json(json["fin"]);
|
||||
}
|
||||
|
||||
return creneau;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user