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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::exprTools::stringEntry
29
30Description
31 Creates an expression from a string (removing surrounding quotes)
32
33SourceFiles
34 expressionEntryStrings.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef exprTools_expressionEntryStrings_H
39#define exprTools_expressionEntryStrings_H
40
41#include "expressionEntry.H"
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45namespace Foam
46{
47namespace exprTools
48{
49
50/*---------------------------------------------------------------------------*\
51 Class stringEntry Declaration
52\*---------------------------------------------------------------------------*/
54struct 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// ************************************************************************* //
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type get(const label i) const
Definition: UList.H:528
A keyword and a list of tokens is an 'entry'.
Definition: entry.H:70
Convert dictionary entry to a stringified expression.
Namespace for OpenFOAM.
volScalarField & e
Definition: createFields.H:11
Creates an expression from a string (removing surrounding quotes)
virtual string toExpr(const entry &e) const
To string.
static string evaluate(const entry &e)
To string.