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-------------------------------------------------------------------------------
10License
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
26Namespace
27 Foam::parsing
28
29Description
30 Collection of static functions and data related to parsing
31 and an isolated namespace for lexers, parsers, scanners.
32
33SourceFiles
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
47namespace Foam
48{
49
50/*---------------------------------------------------------------------------*\
51 Namespace parsing Declaration
52\*---------------------------------------------------------------------------*/
53
54namespace 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
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// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
errorType
Enumeration for possible parsing error.
Definition: parsing.H:58
@ NONE
No error encountered.
@ GENERAL
General parsing error.
@ TRAILING
Trailing content detected.
const Foam::Enum< errorType > errorNames
Strings corresponding to the errorType.
errorType checkConversion(const char *buf, char *endptr)
Sanity check after strtof, strtod, etc.
Definition: parsingI.H:29
Namespace for OpenFOAM.