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