IOobjectI.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 | Copyright (C) 2011 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  "| ========= |"
81  " |\n"
82  "| \\\\ / F ield |"
83  " OpenFOAM: The Open Source CFD Toolbox |\n"
84  "| \\\\ / O peration |"
85  " Version: " << FOAMversion << spaces << "|\n"
86  "| \\\\ / A nd |"
87  " Web: www.OpenFOAM.org |\n"
88  "| \\\\/ M anipulation |"
89  " |\n"
90  "\\*-----------------------------------------"
91  "----------------------------------*/\n";
92 
93  return os;
94 }
95 
96 
97 template<class Stream>
98 inline Stream& Foam::IOobject::writeDivider(Stream& os)
99 {
100  os <<
101  "// * * * * * * * * * * * * * * * * * "
102  "* * * * * * * * * * * * * * * * * * * * //\n";
103 
104  return os;
105 }
106 
107 template<class Stream>
108 inline Stream& Foam::IOobject::writeEndDivider(Stream& os)
109 {
110  os << "\n\n"
111  "// *****************************************"
112  "******************************** //\n";
113 
114  return os;
115 }
116 
117 
118 // ************************************************************************* //
const char *const group
Group name for atomic constants.
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:98
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:108
word group() const
Return group (extension part of name)
Definition: IOobject.C:239
const word & name() const
Return name.
Definition: IOobject.H:260