exprTools.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  Copyright (C) 2019 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Namespace
27  Foam::exprTools
28 
29 Description
30  Helper methods for creating expressions.
31 
32 SourceFiles
33  exprTools.C
34  exprToolsTemplates.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef exprTools_H
39 #define exprTools_H
40 
41 #include "exprOps.H"
42 #include "exprString.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Namespace exprTools Declarations
51 \*---------------------------------------------------------------------------*/
52 
53 namespace exprTools
54 {
55 
56 //- Stringified value for zero of given type
57 template<class Type>
58 string zeroValue();
59 
60 //- Stringified version of data with comma separators between components
61 template<class Type>
62 string toString(const Type& data, const word& prefix);
63 
64 //- Stringified version of data with comma separators between components.
65 //- Uses prefix corresponding to the pTraits of Type.
66 template<class Type>
67 string toString(const Type& data);
68 
69 //- Stringified version of primitiveEntry of Type.
70 //- Uses comma separators and prefix corresponding to the pTraits of Type
71 template<class Type>
72 string toString(ITstream& is);
73 
74 //- Get an expression string list from a dictionary
75 // Supports list and inline specifications, as well as indirect
76 // inclusion of other expression string lists.
77 //
78 // Syntax examples,
79 // \code
80 //
81 // // Single items. Inline or list format.
82 // list1a "var1=p";
83 // list1b ( "var1=p" );
84 //
85 // // Multiple items. Inline or list format.
86 // list2a "var2=T; var3=U; var4=rho";
87 // list2b ( "var2=T" "var3=U; var4=rho" );
88 //
89 // // Indirection. Inline or list format.
90 // list3a "#list1a; #list2b";
91 // list2b ( "var1=p" "#list2a" );
92 //
93 // \endcode
94 List<expressions::exprString> getList
95 (
96  const dictionary& dict,
97  const word& keyword,
98  bool mandatory = true,
99  label recursionDepth = 0
100 );
101 
102 
103 } // End namespace exprTools
104 
105 
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107 
108 } // End namespace Foam
109 
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 
112 #ifdef NoRepository
113  #include "exprToolsTemplates.C"
114 #endif
115 
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 
118 #endif
119 
120 // ************************************************************************* //
exprString.H
exprToolsTemplates.C
Foam::exprTools::toString
string toString(const Type &data, const word &prefix)
Stringified version of data with comma separators between components.
dict
dictionary dict
Definition: searchingEngine.H:14
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::exprTools::zeroValue
string zeroValue()
Stringified value for zero of given type.
Foam::exprTools::getList
List< expressions::exprString > getList(const dictionary &dict, const word &keyword, bool mandatory=true, label recursionDepth=0)
Get an expression string list from a dictionary.
Definition: exprTools.C:120
exprOps.H
Operations involving expressions.