TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Noms.cpp
1/****************************************************************************
2* Copyright (c) 2026, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16#include <Noms.h>
17Implemente_instanciable(Noms,"Noms",VECT(Nom));
18
19// XD nom_anonyme nom nul INHERITS_BRACE not_set
20// XD vect_nom listobj vect_nom NO_BRACE nom_anonyme NO_COMMA Vect of name.
21// XD list_nom listobj list_nom BRACE nom_anonyme NO_COMMA List of name.
22// XD list_nom_virgule listobj list_nom_virgule BRACE nom_anonyme COMMA List of name.
23
24// XD un_pb objet_lecture nul NO_BRACE pour les groupes
25// XD attr mot ref_Pb_base mot REQ the string
26// XD list_un_pb listobj nul BRACE un_pb COMMA pour les groupes
27// XD list_list_nom listobj nul BRACE list_un_pb COMMA pour les groupes
28
29Sortie& Noms::printOn(Sortie& s) const
30{
31 return VECT(Nom)::printOn(s);
32}
33
34Entree& Noms::readOn(Entree& s)
35{
36 return VECT(Nom)::readOn(s);
37}
38
39int Noms::search(const Nom& t ) const
40{
41 //Use rang() now
42 return rang(t.getString().c_str());
43}
44
46{
47 assert(size()>=0);
48 int i=size();
49 while(i--)
50 {
51 const Nom& unnom=operator[](i);
52 if (unnom.getString().compare(t)==0)
53 {
54 return i;
55 }
56 }
57 return -1;
58}
59
60int Noms::contient_(const char* const ch) const
61{
62 return (rang(ch)!=-1);
63}
64/* Returns the VECT position number of a string (-1 if not found) */
65int Noms::rang(const char* const ch) const
66{
67 //Optimization to avoid creating an object Nom:
68 assert(size()>=0);
69 int i=size();
70 while(i--)
71 if (operator[](i).getString()==ch)
72 {
73 return i;
74 }
75 return -1;
76}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
const std::string & getString() const
Definition Nom.h:92
Un tableau de chaine de caracteres (VECT(Nom)).
Definition Noms.h:26
int rang(const char *const ch) const
Definition Noms.cpp:65
int search_without_checking_Motcle(const Nom &t) const
Definition Noms.cpp:45
int search(const Nom &t) const
Definition Noms.cpp:39
int contient_(const char *const ch) const
Definition Noms.cpp:60
Classe de base des flux de sortie.
Definition Sortie.h:52