IOobjectI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "foamVersion.H"
27 
28 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
29 
30 template<class Name>
32 {
33  if (group != word::null)
34  {
35  return name + ('.' + group);
36  }
37  else
38  {
39  return name;
40  }
41 }
42 
43 
44 template<class Stream>
45 inline Stream& Foam::IOobject::writeBanner(Stream& os, bool noHint)
46 {
47  static bool spacesSet(false);
48  static char spaces[40];
49 
50  if (!spacesSet)
51  {
52  memset(spaces, ' ', 40);
53 
54  size_t len = strlen(Foam::FOAMversion);
55  if (len < 38)
56  {
57  spaces[38 - len] = '\0';
58  }
59  else
60  {
61  spaces[0] = '\0';
62  }
63  spacesSet = true;
64  }
65 
66  if (noHint)
67  {
68  os <<
69  "/*--------------------------------------"
70  "-------------------------------------*\\\n";
71  }
72  else
73  {
74  os <<
75  "/*--------------------------------*- C++ "
76  "-*----------------------------------*\\\n";
77  }
78 
79  os <<
80  " ========= |\n"
81  " \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox\n"
82  " \\\\ / O peration | Website: https://openfoam.org\n"
83  " \\\\ / A nd | Version: " << FOAMversion << "\n"
84  " \\\\/ M anipulation |\n"
85  "\\*-----------------------------------------"
86  "----------------------------------*/\n";
87 
88  return os;
89 }
90 
91 
92 template<class Stream>
93 inline Stream& Foam::IOobject::writeDivider(Stream& os)
94 {
95  os <<
96  "// * * * * * * * * * * * * * * * * * "
97  "* * * * * * * * * * * * * * * * * * * * //\n";
98 
99  return os;
100 }
101 
102 template<class Stream>
103 inline Stream& Foam::IOobject::writeEndDivider(Stream& os)
104 {
105  os << "\n\n"
106  "// *****************************************"
107  "******************************** //\n";
108 
109  return os;
110 }
111 
112 
113 // ************************************************************************* //
const char *const group
Group name for atomic constants.
const word & name() const
Return name.
Definition: IOobject.H:297
static Stream & writeBanner(Stream &os, bool noHint=false)
Write the standard OpenFOAM file/dictionary banner.
Definition: IOobjectI.H:45
static Stream & writeDivider(Stream &os)
Write the standard file section divider.
Definition: IOobjectI.H:93
word group() const
Return group (extension part of name)
Definition: IOobject.C:379
const char *const FOAMversion
A class for handling words, derived from string.
Definition: word.H:59
static word groupName(Name name, const word &group)
static const word null
An empty word.
Definition: word.H:77
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
static Stream & writeEndDivider(Stream &os)
Write the standard end file divider.
Definition: IOobjectI.H:103