expressionEntryStrings.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Original code Copyright (C) 2014-2018 Bernhard Gschaider
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::exprTools::stringEntry
29 
30 Description
31  Creates an expression from a string (removing surrounding quotes)
32 
33 SourceFiles
34  expressionEntryStrings.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef exprTools_expressionEntryStrings_H
39 #define exprTools_expressionEntryStrings_H
40 
41 #include "expressionEntry.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 namespace exprTools
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class stringEntry Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 struct stringEntry
55 :
57 {
58  //- To string
59  static string evaluate(const entry& e)
60  {
61  return e.get<string>();
62  }
63 
64  //- To string
65  virtual string toExpr(const entry& e) const
66  {
67  return evaluate(e);
68  }
69 };
70 
71 
72 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
73 
74 } // End namespace exprTools
75 } // End namespace Foam
76 
77 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78 
79 #endif
80 
81 // ************************************************************************* //
Foam::entry
A keyword and a list of tokens is an 'entry'.
Definition: entry.H:67
Foam::exprTools::stringEntry::evaluate
static string evaluate(const entry &e)
To string.
Definition: expressionEntryStrings.H:58
Foam::exprTools::expressionEntry
Convert dictionary entry to a stringified expression.
Definition: expressionEntry.H:85
Foam::exprTools::stringEntry::toExpr
virtual string toExpr(const entry &e) const
To string.
Definition: expressionEntryStrings.H:64
Foam::exprTools::stringEntry
Creates an expression from a string (removing surrounding quotes)
Definition: expressionEntryStrings.H:53
expressionEntry.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::constant::electromagnetic::e
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11