ListPolicy.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::Detail::ListPolicy
28 
29 Description
30  Additional compile-time controls of List behaviour
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef ListPolicy_H
35 #define ListPolicy_H
36 
37 #include "label.H"
38 #include <type_traits>
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 // Forward Declarations
46 class word;
47 class wordRe;
48 class keyType;
49 
50 namespace Detail
51 {
52 namespace ListPolicy
53 {
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 //- Number of items before requiring line-breaks in the list output.
58 //
59 // Default definition: 10
60 template<class T>
61 struct short_length : std::integral_constant<label,10> {};
62 
63 // Could override on a per-type basis
64 // Eg,
65 // template<> struct short_length<label> : std::integral_constant<label,20> {};
66 
67 
68 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69 
70 //- Can suppress additional line breaks separate ASCII data content
71 //- when the data elements are primitives, or contiguous
72 //
73 // Default definition: (integral | floating-point) are contiguous and thus
74 // never need any line breaks
75 template<class T>
76 struct no_linebreak : std::is_arithmetic<T> {};
77 
78 // Specialization for word, wordRe, keyType
79 // These elements are normally fairly short, so ok to output a few (eg, 10)
80 // of them on a single line.
81 
82 //- Suppress line-breaks for word
83 template<> struct no_linebreak<word> : std::true_type {};
84 
85 //- Suppress line-breaks for wordRe
86 template<> struct no_linebreak<wordRe> : std::true_type {};
87 
88 //- Suppress line-breaks for keyType
89 template<> struct no_linebreak<keyType> : std::true_type {};
90 
91 
92 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
93 
94 } // End namespace ListPolicy
95 } // End namespace Detail
96 } // End namespace Foam
97 
98 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
99 
100 #endif
101 
102 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::wordRe
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
Definition: wordRe.H:80
Foam::keyType
A class for handling keywords in dictionaries.
Definition: keyType.H:68
Foam::Detail::ListPolicy::short_length
Number of items before requiring line-breaks in the list output.
Definition: ListPolicy.H:61
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::Detail::ListPolicy::no_linebreak
Definition: ListPolicy.H:76
label.H