112 lines
3 KiB
C++
112 lines
3 KiB
C++
// FICHIER : EnumLangue.cp
|
|
|
|
|
|
// This file is part of the Herezh++ application.
|
|
//
|
|
// The finite element software Herezh++ is dedicated to the field
|
|
// of mechanics for large transformations of solid structures.
|
|
// It is developed by Gérard Rio (APP: IDDN.FR.010.0106078.000.R.P.2006.035.20600)
|
|
// INSTITUT DE RECHERCHE DUPUY DE LÔME (IRDL) <https://www.irdl.fr/>.
|
|
//
|
|
// Herezh++ is distributed under GPL 3 license ou ultérieure.
|
|
//
|
|
// Copyright (C) 1997-2022 Université Bretagne Sud (France)
|
|
// AUTHOR : Gérard Rio
|
|
// E-MAIL : gerardrio56@free.fr
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License,
|
|
// or (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
// See the GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
//
|
|
// For more information, please consult: <https://herezh.irdl.fr/>.
|
|
|
|
|
|
#include "EnumLangue.h"
|
|
|
|
|
|
# include <iostream>
|
|
#include <stdlib.h>
|
|
using namespace std; //introduces namespace std
|
|
|
|
#include "Sortie.h"
|
|
//#ifdef SYSTEM_MAC_OS_X
|
|
// #include <stringfwd.h> // a priori ce n'est pas portable
|
|
//#el
|
|
#if defined SYSTEM_MAC_OS_CARBON
|
|
#include <stringfwd> // a priori ce n'est pas portable
|
|
#else
|
|
#include <string> // pour le flot en memoire centrale
|
|
#endif
|
|
#include <string>
|
|
#include <string.h>
|
|
|
|
|
|
|
|
string Nom_EnumLangue (EnumLangue id_EnumLangue)
|
|
// Retourne le nom du type de EnumLangue correspondant a l'identificateur
|
|
// de type enumere id_EnumLangue
|
|
{
|
|
|
|
string result;
|
|
switch (id_EnumLangue)
|
|
{
|
|
case FRANCAIS :
|
|
result="FRANCAIS";
|
|
break;
|
|
case ENGLISH :
|
|
result="ENGLISH";
|
|
break;
|
|
default :
|
|
cout << "\nErreur : valeur incorrecte du type EnumLangue !\n";
|
|
cout << "Nom_EnumLangue(EnumLangue ) \n";
|
|
Sortie(1);
|
|
};
|
|
return result;
|
|
|
|
};
|
|
|
|
EnumLangue Id_nom_EnumLangue (char* nom_EnumLangue)
|
|
// Retourne la variable de type enumere associe au nom
|
|
// de EnumLangue nom_EnumLangue
|
|
{
|
|
|
|
EnumLangue result;
|
|
if ( strcmp(nom_EnumLangue,"FRANCAIS")==0 )
|
|
result=FRANCAIS;
|
|
else if ( strcmp(nom_EnumLangue,"ENGLISH")==0 )
|
|
result=ENGLISH;
|
|
else
|
|
{
|
|
cout << "\nErreur : nom " << nom_EnumLangue << " de EnumLangue inconnu !\n";
|
|
cout << "\n Id_nom_EnumLangue(char* ) \n";
|
|
Sortie(1);
|
|
};
|
|
return result;
|
|
|
|
};
|
|
|
|
// surcharge de la lecture
|
|
istream & operator >> (istream & entree, EnumLangue & result)
|
|
{ char nom_EnumLangue[45];
|
|
entree >> nom_EnumLangue;
|
|
result = Id_nom_EnumLangue ( nom_EnumLangue);
|
|
return entree;
|
|
};
|
|
|
|
|
|
// surcharge de l'operator d'ecriture
|
|
ostream & operator << (ostream & sort, const EnumLangue& a)
|
|
{ // on ecrit la forme caractère
|
|
sort << Nom_EnumLangue(a) << " ";
|
|
return sort;
|
|
};
|
|
|