Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
OpenFOAM
primitives
strings
fileName
fileNameI.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) 1991-2010 OpenCFD Ltd.
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
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
27
28
inline
void
Foam::fileName::stripInvalid()
29
{
30
if
(
debug
&& string::stripInvalid<fileName>(*
this
))
31
{
32
std::cerr
33
<<
"fileName::stripInvalid() called for invalid fileName "
34
<< this->c_str() <<
std::endl
;
35
36
if
(
debug
> 1)
37
{
38
std::cerr
39
<<
" For debug level (= "
<<
debug
40
<<
") > 1 this is considered fatal"
<<
std::endl
;
41
std::abort
();
42
}
43
44
removeRepeated
(
'/'
);
45
removeTrailing
(
'/'
);
46
}
47
}
48
49
50
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51
52
inline
Foam::fileName::fileName
()
53
:
54
string
()
55
{}
56
57
inline
Foam::fileName::fileName
(
const
fileName
& fn)
58
:
59
string
(fn)
60
{}
61
62
inline
Foam::fileName::fileName
(
const
word
& w)
63
:
64
string
(w)
65
{}
66
67
68
inline
Foam::fileName::fileName
(
const
string
& str)
69
:
70
string
(str)
71
{
72
stripInvalid();
73
}
74
75
76
inline
Foam::fileName::fileName
(
const
std::string& str)
77
:
78
string
(str)
79
{
80
stripInvalid();
81
}
82
83
84
inline
Foam::fileName::fileName
(
const
char
* str)
85
:
86
string
(str)
87
{
88
stripInvalid();
89
}
90
91
92
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
93
94
inline
bool
Foam::fileName::valid
(
char
c)
95
{
96
return
97
(
98
!
isspace
(c)
99
&& c !=
'"'
// string quote
100
&& c !=
'\''
// string quote
101
);
102
}
103
104
105
// ************************ vim: set sw=4 sts=4 et: ************************ //