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.com |\n"
88  "| \\\\/ M anipulation |"
89  " |\n"
90  "\\*-----------------------------------------"
91  "----------------------------------*/\n";
92 
93 #if defined(MSWIN)
94  os <<
95 "/* Windows port by Symscape (www.symscape.com); Some function Modified by Beijing Glory PKPM *\\\n"
96 "\\*---------------------------------------------------------------------------*/\n";
97 #elif defined(DARWIN)
98  os <<
99 "/* Mac OSX port by Symscape (www.symscape.com) *\\\n"
100 "\\*---------------------------------------------------------------------------*/\n";
101 #endif
102 
103  return os;
104 }
105 
106 
107 template<class Stream>
108 inline Stream& Foam::IOobject::writeDivider(Stream& os)
109 {
110  os <<
111  "// * * * * * * * * * * * * * * * * * "
112  "* * * * * * * * * * * * * * * * * * * * //\n";
113 
114  return os;
115 }
116 
117 template<class Stream>
118 inline Stream& Foam::IOobject::writeEndDivider(Stream& os)
119 {
120  os << "\n\n"
121  "// *****************************************"
122  "******************************** //\n";
123 
124  return os;
125 }
126 
127 
128 // ************************************************************************* //
Foam::IOobject::groupName
static word groupName(Name name, const word &group)
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::IOobject::writeEndDivider
static Stream & writeEndDivider(Stream &os)
Write the standard end file divider.
Definition: IOobjectI.H:118
Foam::constant::atomic::group
const char *const group
Group name for atomic constants.
Definition: atomicConstants.C:40
Foam::IOobject::name
const word & name() const
Return name.
Definition: IOobject.H:273
Foam::IOobject::writeDivider
static Stream & writeDivider(Stream &os)
Write the standard file section divider.
Definition: IOobjectI.H:108
Foam::IOobject::writeBanner
static Stream & writeBanner(Stream &os, bool noHint=false)
Write the standard OpenFOAM file/dictionary banner.
Definition: IOobjectI.H:45
Foam::word::null
static const word null
An empty word.
Definition: word.H:77
Foam::IOobject::group
word group() const
Return group (extension part of name)
Definition: IOobject.C:257
Foam::FOAMversion
const char *const FOAMversion
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
foamVersion.H