Herezh_dev/Enumeration/Enum_IO_XML.cc

137 lines
3.7 KiB
C++
Raw Normal View History

// FICHIER : Enum_IO_XML.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.
//
2023-05-03 17:23:49 +02:00
// 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 "Enum_IO_XML.h"
# include <iostream>
using namespace std; //introduces namespace std
#include <stdlib.h>
#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.h> // a priori ce n'est pas portable
#else
#include <string.h> // pour le flot en memoire centrale
#endif
#include <string>
string Nom_Enum_IO_XML (Enum_IO_XML id_Enum_IO_XML)
// Retourne le nom du type de Enum_IO_XML correspondant a l'identificateur
// de type enumere id_Enum_IO_XML
{
string result;
switch (id_Enum_IO_XML)
{
case XML_TYPE_GLOBAUX :
result="XML_TYPE_GLOBAUX";
break;
case XML_IO_POINT_INFO :
result="XML_IO_POINT_INFO";
break;
case XML_IO_POINT_BI :
result="XML_IO_POINT_BI";
break;
case XML_IO_ELEMENT_FINI :
result="XML_IO_ELEMENT_FINI";
break;
case XML_ACTION_INTERACTIVE :
result="XML_ACTION_INTERACTIVE";
break;
case XML_STRUCTURE_DONNEE :
result="XML_STRUCTURE_DONNEE";
break;
default :
cout << "\nErreur : valeur incorrecte du type Enum_IO_XML !\n";
cout << "Nom_Enum_IO_XML(Enum_IO_XML ) \n";
Sortie(1);
};
return result;
};
Enum_IO_XML Id_nom_Enum_IO_XML (string nom_Enum_IO_XML)
// Retourne la variable de type enumere associe au nom
// de Enum_IO_XML nom_Enum_IO_XML
{
Enum_IO_XML result;
if ( nom_Enum_IO_XML=="XML_TYPE_GLOBAUX" )
result=XML_TYPE_GLOBAUX;
else if ( nom_Enum_IO_XML=="XML_IO_POINT_INFO")
result=XML_IO_POINT_INFO;
else if (nom_Enum_IO_XML=="XML_IO_POINT_BI" )
result=XML_IO_POINT_BI;
else if (nom_Enum_IO_XML=="XML_IO_ELEMENT_FINI" )
result=XML_IO_ELEMENT_FINI;
else if (nom_Enum_IO_XML=="XML_ACTION_INTERACTIVE" )
result=XML_ACTION_INTERACTIVE;
else if (nom_Enum_IO_XML=="XML_STRUCTURE_DONNEE" )
result=XML_STRUCTURE_DONNEE;
else
{
cout << "\nErreur : nom ** " << nom_Enum_IO_XML << " ** de Enum_IO_XML inconnu !\n";
cout << "Id_nom_Enum_IO_XML(string nom ) \n";
Sortie(1);
};
return result;
};
// surcharge de la lecture
istream & operator >> (istream & entree, Enum_IO_XML & result)
{ string nom_Enum_IO_XML;
entree >> nom_Enum_IO_XML;
result = Id_nom_Enum_IO_XML ( nom_Enum_IO_XML);
return entree;
};
// surcharge de l'operator d'ecriture
ostream & operator << (ostream & sort, const Enum_IO_XML& a)
{ // on ecrit la forme caractère
sort << Nom_Enum_IO_XML(a) << " ";
return sort;
};