• Page principale
  • Pages associées
  • Modules
  • Classes
  • Fichiers

/tmp/galet/src/outils-base.cpp

Aller à la documentation de ce fichier.
00001 // vim:syntax=cpp.doxygen tw=3 sw=3
00002 /***************************************************************************
00003  *   Copyright (C) 2008 by Brice Boyer                                     *
00004  *   brice.boyer@ens-lyon.org                                              *
00005  *                                                                         *
00006  *   This program is free software; you can redistribute it and/or modify  *
00007  *   it under the terms of the GNU General Public License as published by  *
00008  *   the Free Software Foundation; either version 2 of the License, or     *
00009  *   (at your option) any later version.                                   *
00010  *                                                                         *
00011  *   This program is distributed in the hope that it will be useful,       *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU General Public License for more details.                          *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU General Public License     *
00017  *   along with this program; if not, write to the                         *
00018  *   Free Software Foundation, Inc.,                                       *
00019  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00020  ***************************************************************************/
00021 
00029 #include "outils-base.h"
00030 
00031 using namespace std;
00032 
00039 bool trouve(const entier_type & s, const entier_set & S)
00040 {
00041    entier_set::const_iterator ici = S.find(s) ;
00042    return (ici != S.end() );
00043 }
00044 
00049 string LaReponse( const bool & rep )
00050 {
00051    return (rep)?("oui"):("non");
00052 }
00053 
00059 string LaParente( const relatif_type & num)
00060 {
00061    assert(abs(num)<4);
00062    if (abs(num)>3)
00063       return "erreur!";
00064    assert(num != -2);
00065    noms_type Parents ( 7 )                  ;
00066    Parents [ _pere  +3] = "Les pères"         ;
00067    Parents [ 1 ]        = "erreur !"          ;
00068    Parents [ _fils  +3] = "Les fils"          ;
00069    Parents [ _filsv +3] = "fils vides"        ;
00070    Parents [ _filsg +3] = "fils avec galet"   ;
00071    Parents [ _perev +3] = "pères vides"       ;
00072    Parents [ _pereg +3] = "pères avec galet"  ;
00073    return Parents [ num+3];
00074 }
00075 
00081 string