Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
eb3c47c7
Commit
eb3c47c7
authored
Mar 12, 2009
by
Mark Olesen
Browse files
pass-thru object in assignment of primitive types (strings)
parent
e011328d
Changes
12
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/db/Time/instant/instant.C
View file @
eb3c47c7
...
...
@@ -36,16 +36,16 @@ const char* const Foam::instant::typeName = "instant";
Foam
::
instant
::
instant
()
{}
Foam
::
instant
::
instant
(
const
scalar
t
val
,
const
word
&
tname
)
Foam
::
instant
::
instant
(
const
scalar
val
,
const
word
&
tname
)
:
value_
(
t
val
),
value_
(
val
),
name_
(
tname
)
{}
Foam
::
instant
::
instant
(
const
scalar
t
val
)
Foam
::
instant
::
instant
(
const
scalar
val
)
:
value_
(
t
val
),
name_
(
Time
::
timeName
(
t
val
))
value_
(
val
),
name_
(
Time
::
timeName
(
val
))
{}
Foam
::
instant
::
instant
(
const
word
&
tname
)
...
...
@@ -57,20 +57,19 @@ Foam::instant::instant(const word& tname)
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
int
Foam
::
operator
==
(
const
instant
&
I1
,
const
instant
&
I2
)
bool
Foam
::
operator
==
(
const
instant
&
a
,
const
instant
&
b
)
{
return
(
I1
.
value_
<
I2
.
value_
+
SMALL
&&
I1
.
value_
>
I2
.
value_
-
SMALL
a
.
value_
<
b
.
value_
+
SMALL
&&
a
.
value_
>
b
.
value_
-
SMALL
);
}
int
Foam
::
operator
!=
(
const
instant
&
I1
,
const
instant
&
I2
)
bool
Foam
::
operator
!=
(
const
instant
&
a
,
const
instant
&
b
)
{
// Invert the '==' operator ('0'='false')
return
I1
==
I2
?
0
:
1
;
return
!
operator
==
(
a
,
b
);
}
...
...
src/OpenFOAM/db/Time/instant/instant.H
View file @
eb3c47c7
...
...
@@ -50,8 +50,8 @@ class instant;
// Friend Operators
int
operator
==
(
const
instant
&
,
const
instant
&
);
int
operator
!=
(
const
instant
&
,
const
instant
&
);
bool
operator
==
(
const
instant
&
,
const
instant
&
);
bool
operator
!=
(
const
instant
&
,
const
instant
&
);
// IOstream Operators
...
...
@@ -79,9 +79,9 @@ public:
{
public:
bool
operator
()(
const
instant
&
one
,
const
instant
&
two
)
const
bool
operator
()(
const
instant
&
a
,
const
instant
&
b
)
const
{
return
one
.
value
()
<
two
.
value
();
return
a
.
value
()
<
b
.
value
();
}
};
...
...
@@ -137,8 +137,8 @@ public:
// Friend Operators
friend
int
operator
==
(
const
instant
&
,
const
instant
&
);
friend
int
operator
!=
(
const
instant
&
,
const
instant
&
);
friend
bool
operator
==
(
const
instant
&
,
const
instant
&
);
friend
bool
operator
!=
(
const
instant
&
,
const
instant
&
);
// IOstream Operators
...
...
src/OpenFOAM/primitives/complex/complex.H
View file @
eb3c47c7
...
...
@@ -51,13 +51,13 @@ namespace Foam
class
complex
;
inline
scalar
magSqr
(
const
complex
&
c
);
inline
complex
sqr
(
const
complex
&
c
);
inline
scalar
mag
(
const
complex
&
c
);
inline
const
complex
&
max
(
const
complex
&
c1
,
const
complex
&
c2
);
inline
const
complex
&
min
(
const
complex
&
c1
,
const
complex
&
c2
);
inline
complex
limit
(
const
complex
&
c1
,
const
complex
&
c2
);
inline
const
complex
&
sum
(
const
complex
&
c
);
inline
scalar
magSqr
(
const
complex
&
);
inline
complex
sqr
(
const
complex
&
);
inline
scalar
mag
(
const
complex
&
);
inline
const
complex
&
max
(
const
complex
&
,
const
complex
&
);
inline
const
complex
&
min
(
const
complex
&
,
const
complex
&
);
inline
complex
limit
(
const
complex
&
,
const
complex
&
);
inline
const
complex
&
sum
(
const
complex
&
);
inline
complex
operator
+
(
const
complex
&
,
const
complex
&
);
inline
complex
operator
-
(
const
complex
&
);
inline
complex
operator
-
(
const
complex
&
,
const
complex
&
);
...
...
@@ -67,8 +67,8 @@ inline complex operator*(const scalar, const complex&);
inline
complex
operator
*
(
const
complex
&
,
const
scalar
);
inline
complex
operator
/
(
const
complex
&
,
const
scalar
);
inline
complex
operator
/
(
const
scalar
,
const
complex
&
);
Istream
&
operator
>>
(
Istream
&
is
,
complex
&
);
Ostream
&
operator
<<
(
Ostream
&
os
,
const
complex
&
C
);
Istream
&
operator
>>
(
Istream
&
,
complex
&
);
Ostream
&
operator
<<
(
Ostream
&
,
const
complex
&
);
/*---------------------------------------------------------------------------*\
...
...
@@ -127,13 +127,13 @@ public:
// Member operators
inline
void
operator
=
(
const
complex
&
);
inline
const
complex
&
operator
=
(
const
complex
&
);
inline
void
operator
+=
(
const
complex
&
);
inline
void
operator
-=
(
const
complex
&
);
inline
void
operator
*=
(
const
complex
&
);
inline
void
operator
/=
(
const
complex
&
);
inline
void
operator
=
(
const
scalar
);
inline
const
complex
&
operator
=
(
const
scalar
);
inline
void
operator
+=
(
const
scalar
);
inline
void
operator
-=
(
const
scalar
);
inline
void
operator
*=
(
const
scalar
);
...
...
@@ -150,12 +150,12 @@ public:
friend
scalar
magSqr
(
const
complex
&
c
);
friend
complex
sqr
(
const
complex
&
c
);
friend
scalar
mag
(
const
complex
&
c
);
friend
const
complex
&
max
(
const
complex
&
c1
,
const
complex
&
c2
);
friend
const
complex
&
min
(
const
complex
&
c1
,
const
complex
&
c2
);
friend
const
complex
&
max
(
const
complex
&
,
const
complex
&
);
friend
const
complex
&
min
(
const
complex
&
,
const
complex
&
);
friend
complex
limit
(
const
complex
&
c1
,
const
complex
&
c2
);
friend
complex
limit
(
const
complex
&
,
const
complex
&
);
friend
const
complex
&
sum
(
const
complex
&
c
);
friend
const
complex
&
sum
(
const
complex
&
);
// Friend operators
...
...
src/OpenFOAM/primitives/complex/complexI.H
View file @
eb3c47c7
...
...
@@ -76,10 +76,11 @@ inline complex complex::conjugate() const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline
void
complex
::
operator
=
(
const
complex
&
c
)
inline
const
complex
&
complex
::
operator
=
(
const
complex
&
c
)
{
re
=
c
.
re
;
im
=
c
.
im
;
return
*
this
;
}
...
...
@@ -109,10 +110,11 @@ inline void complex::operator/=(const complex& c)
}
inline
void
complex
::
operator
=
(
const
scalar
s
)
inline
const
complex
&
complex
::
operator
=
(
const
scalar
s
)
{
re
=
s
;
im
=
0.0
;
return
*
this
;
}
...
...
@@ -234,8 +236,8 @@ inline complex operator+(const complex& c1, const complex& c2)
{
return
complex
(
c1
.
re
+
c2
.
re
,
c1
.
im
+
c2
.
im
c1
.
re
+
c2
.
re
,
c1
.
im
+
c2
.
im
);
}
...
...
@@ -254,8 +256,8 @@ inline complex operator-(const complex& c1, const complex& c2)
{
return
complex
(
c1
.
re
-
c2
.
re
,
c1
.
im
-
c2
.
im
c1
.
re
-
c2
.
re
,
c1
.
im
-
c2
.
im
);
}
...
...
src/OpenFOAM/primitives/strings/fileName/fileName.C
View file @
eb3c47c7
...
...
@@ -196,36 +196,41 @@ Foam::word Foam::fileName::component
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void
Foam
::
fileName
::
operator
=
(
const
fileName
&
str
)
const
Foam
::
fileName
&
Foam
::
fileName
::
operator
=
(
const
fileName
&
str
)
{
string
::
operator
=
(
str
);
return
*
this
;
}
void
Foam
::
fileName
::
operator
=
(
const
word
&
str
)
const
Foam
::
fileName
&
Foam
::
fileName
::
operator
=
(
const
word
&
str
)
{
string
::
operator
=
(
str
);
return
*
this
;
}
void
Foam
::
fileName
::
operator
=
(
const
string
&
str
)
const
Foam
::
fileName
&
Foam
::
fileName
::
operator
=
(
const
string
&
str
)
{
string
::
operator
=
(
str
);
stripInvalid
();
return
*
this
;
}
void
Foam
::
fileName
::
operator
=
(
const
std
::
string
&
str
)
const
Foam
::
fileName
&
Foam
::
fileName
::
operator
=
(
const
std
::
string
&
str
)
{
string
::
operator
=
(
str
);
stripInvalid
();
return
*
this
;
}
void
Foam
::
fileName
::
operator
=
(
const
char
*
str
)
const
Foam
::
fileName
&
Foam
::
fileName
::
operator
=
(
const
char
*
str
)
{
string
::
operator
=
(
str
);
stripInvalid
();
return
*
this
;
}
...
...
src/OpenFOAM/primitives/strings/fileName/fileName.H
View file @
eb3c47c7
...
...
@@ -158,11 +158,11 @@ public:
// Assignment
void
operator
=
(
const
fileName
&
);
void
operator
=
(
const
word
&
);
void
operator
=
(
const
string
&
);
void
operator
=
(
const
std
::
string
&
);
void
operator
=
(
const
char
*
);
const
fileName
&
operator
=
(
const
fileName
&
);
const
fileName
&
operator
=
(
const
word
&
);
const
fileName
&
operator
=
(
const
string
&
);
const
fileName
&
operator
=
(
const
std
::
string
&
);
const
fileName
&
operator
=
(
const
char
*
);
// IOstream operators
...
...
src/OpenFOAM/primitives/strings/keyType/keyType.H
View file @
eb3c47c7
...
...
@@ -106,12 +106,12 @@ public:
// Assignment
inline
void
operator
=
(
const
keyType
&
);
inline
void
operator
=
(
const
word
&
);
inline
const
keyType
&
operator
=
(
const
keyType
&
);
inline
const
keyType
&
operator
=
(
const
word
&
);
//- Assign from regular expression.
inline
void
operator
=
(
const
string
&
);
inline
void
operator
=
(
const
char
*
);
inline
const
keyType
&
operator
=
(
const
string
&
);
inline
const
keyType
&
operator
=
(
const
char
*
);
// IOstream operators
...
...
src/OpenFOAM/primitives/strings/keyType/keyTypeI.H
View file @
eb3c47c7
...
...
@@ -89,34 +89,38 @@ inline bool Foam::keyType::isPattern() const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline
void
Foam
::
keyType
::
operator
=
(
const
keyType
&
s
)
inline
const
Foam
::
keyType
&
Foam
::
keyType
::
operator
=
(
const
keyType
&
s
)
{
// Bypass checking
string
::
operator
=
(
s
);
isPattern_
=
s
.
isPattern_
;
return
*
this
;
}
inline
void
Foam
::
keyType
::
operator
=
(
const
word
&
s
)
inline
const
Foam
::
keyType
&
Foam
::
keyType
::
operator
=
(
const
word
&
s
)
{
word
::
operator
=
(
s
);
isPattern_
=
false
;
return
*
this
;
}
inline
void
Foam
::
keyType
::
operator
=
(
const
string
&
s
)
inline
const
Foam
::
keyType
&
Foam
::
keyType
::
operator
=
(
const
string
&
s
)
{
// Bypass checking
string
::
operator
=
(
s
);
isPattern_
=
true
;
return
*
this
;
}
inline
void
Foam
::
keyType
::
operator
=
(
const
char
*
s
)
inline
const
Foam
::
keyType
&
Foam
::
keyType
::
operator
=
(
const
char
*
s
)
{
// Bypass checking
string
::
operator
=
(
s
);
isPattern_
=
false
;
return
*
this
;
}
...
...
src/OpenFOAM/primitives/strings/word/word.H
View file @
eb3c47c7
...
...
@@ -117,10 +117,10 @@ public:
// Assignment
inline
void
operator
=
(
const
word
&
);
inline
void
operator
=
(
const
string
&
);
inline
void
operator
=
(
const
std
::
string
&
);
inline
void
operator
=
(
const
char
*
);
inline
const
word
&
operator
=
(
const
word
&
);
inline
const
word
&
operator
=
(
const
string
&
);
inline
const
word
&
operator
=
(
const
std
::
string
&
);
inline
const
word
&
operator
=
(
const
char
*
);
// Friend Operators
...
...
src/OpenFOAM/primitives/strings/word/wordI.H
View file @
eb3c47c7
...
...
@@ -132,30 +132,34 @@ inline bool Foam::word::valid(char c)
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline
void
Foam
::
word
::
operator
=
(
const
word
&
q
)
inline
const
Foam
::
word
&
Foam
::
word
::
operator
=
(
const
word
&
q
)
{
string
::
operator
=
(
q
);
return
*
this
;
}
inline
void
Foam
::
word
::
operator
=
(
const
string
&
q
)
inline
const
Foam
::
word
&
Foam
::
word
::
operator
=
(
const
string
&
q
)
{
string
::
operator
=
(
q
);
stripInvalid
();
return
*
this
;
}
inline
void
Foam
::
word
::
operator
=
(
const
std
::
string
&
q
)
inline
const
Foam
::
word
&
Foam
::
word
::
operator
=
(
const
std
::
string
&
q
)
{
string
::
operator
=
(
q
);
stripInvalid
();
return
*
this
;
}
inline
void
Foam
::
word
::
operator
=
(
const
char
*
q
)
inline
const
Foam
::
word
&
Foam
::
word
::
operator
=
(
const
char
*
q
)
{
string
::
operator
=
(
q
);
stripInvalid
();
return
*
this
;
}
...
...
src/OpenFOAM/primitives/strings/wordRe/wordRe.H
View file @
eb3c47c7
...
...
@@ -187,22 +187,22 @@ public:
//- Assign copy
// Always case sensitive
inline
void
operator
=
(
const
wordRe
&
);
inline
const
wordRe
&
operator
=
(
const
wordRe
&
);
//- Copy word, never a regular expression
inline
void
operator
=
(
const
word
&
);
inline
const
wordRe
&
operator
=
(
const
word
&
);
//- Copy string, auto-test for regular expression
// Always case sensitive
inline
void
operator
=
(
const
string
&
);
inline
const
wordRe
&
operator
=
(
const
string
&
);
//- Copy string, auto-test for regular expression
// Always case sensitive
inline
void
operator
=
(
const
std
::
string
&
);
inline
const
wordRe
&
operator
=
(
const
std
::
string
&
);
//- Copy string, auto-test for regular expression
// Always case sensitive
inline
void
operator
=
(
const
char
*
);
inline
const
wordRe
&
operator
=
(
const
char
*
);
// IOstream operators
...
...
src/OpenFOAM/primitives/strings/wordRe/wordReI.H
View file @
eb3c47c7
...
...
@@ -213,7 +213,7 @@ inline void Foam::wordRe::set(const char* str, const compOption opt)
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
inline
void
Foam
::
wordRe
::
operator
=
(
const
wordRe
&
str
)
inline
const
Foam
::
wordRe
&
Foam
::
wordRe
::
operator
=
(
const
wordRe
&
str
)
{
string
::
operator
=
(
str
);
...
...
@@ -225,34 +225,39 @@ inline void Foam::wordRe::operator=(const wordRe& str)
{
re_
.
clear
();
}
return
*
this
;
}
inline
void
Foam
::
wordRe
::
operator
=
(
const
word
&
str
)
inline
const
Foam
::
wordRe
&
Foam
::
wordRe
::
operator
=
(
const
word
&
str
)
{
word
::
operator
=
(
str
);
re_
.
clear
();
return
*
this
;
}
inline
void
Foam
::
wordRe
::
operator
=
(
const
string
&
str
)
inline
const
Foam
::
wordRe
&
Foam
::
wordRe
::
operator
=
(
const
string
&
str
)
{
string
::
operator
=
(
str
);
compile
(
DETECT
);
// auto-detect regex
return
*
this
;
}
inline
void
Foam
::
wordRe
::
operator
=
(
const
std
::
string
&
str
)
inline
const
Foam
::
wordRe
&
Foam
::
wordRe
::
operator
=
(
const
std
::
string
&
str
)
{
string
::
operator
=
(
str
);
compile
(
DETECT
);
// auto-detect regex
return
*
this
;
}
inline
void
Foam
::
wordRe
::
operator
=
(
const
char
*
str
)
inline
const
Foam
::
wordRe
&
Foam
::
wordRe
::
operator
=
(
const
char
*
str
)
{
string
::
operator
=
(
str
);
compile
(
DETECT
);
// auto-detect regex
return
*
this
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment