parsing.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) 2017-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::parsing
28 
29 Description
30  Collection of static functions and data related to parsing
31  and an isolated namespace for lexers, parsers, scanners.
32 
33 SourceFiles
34  parsing.C
35  parsingI.H
36 
37 \*---------------------------------------------------------------------------*/
38 #ifndef parsing_H
39 #define parsing_H
40 
41 #include "Enum.H"
42 #include <cerrno>
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Namespace parsing Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 namespace parsing
54 {
55  //- Enumeration for possible parsing error
56  enum class errorType
57  {
58  NONE = 0,
59  GENERAL = 1,
60  RANGE = 2,
61  TRAILING = 3,
62  };
63 
64 
65  //- Strings corresponding to the errorType
66  extern const Foam::Enum<errorType> errorNames;
67 
68  //- Sanity check after strtof, strtod, etc.
69  // Should set errno = 0 prior to the conversion.
70  inline errorType checkConversion(const char* buf, char* endptr);
71 
72 
73 } // End namespace parsing
74 
75 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
76 
77 } // End namespace Foam
78 
79 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
80 
81 #include "parsingI.H"
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 #endif
86 
87 // ************************************************************************* //
Foam::Enum
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: IOstreamOption.H:51
parsingI.H
Foam::parsing::checkConversion
errorType checkConversion(const char *buf, char *endptr)
Sanity check after strtof, strtod, etc.
Definition: parsingI.H:29
Foam::parsing::errorType::RANGE
Range error.
Foam::parsing::errorType::TRAILING
Trailing content detected.
Foam::parsing::errorType::NONE
No error encountered.
Foam::parsing::errorNames
const Foam::Enum< errorType > errorNames
Strings corresponding to the errorType.
Foam::parsing::errorType::GENERAL
General parsing error.
Foam::parsing::errorType
errorType
Enumeration for possible parsing error.
Definition: parsing.H:56
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Enum.H