Add namespace qualifier to WarningIn, FatalErrorIn, etc. macros.

- Previously had just 'Warning' instead of '::Foam::Warning', which
  meant that an identically named class method would inadvertently be
  used - resulting in a compile failure.
This commit is contained in:
Mark Olesen
2009-12-16 08:55:04 +01:00
parent a5217d7be3
commit e434b51914
6 changed files with 145 additions and 73 deletions

View File

@ -36,7 +36,8 @@ Description
Usage
@code
messageStream << "message1" << "message2" << FoamDataType << endl;
messageStream
<< "message1" << "message2" << FoamDataType << endl;
@endcode
SourceFiles
@ -55,6 +56,7 @@ SourceFiles
namespace Foam
{
// Forward declaration of classes
class IOstream;
class Ostream;
class OSstream;
@ -103,13 +105,13 @@ public:
messageStream
(
const string& title,
errorSeverity sev,
errorSeverity,
const int maxErrors = 0
);
//- Construct from dictionary
messageStream(const dictionary& dict);
messageStream(const dictionary&);
// Member functions
@ -133,8 +135,8 @@ public:
return maxErrors_;
}
//- Convert to Ostream
// Prints basic message and then returns Ostream for further info.
//- Convert to OSstream
// Prints basic message and returns OSstream for further info.
OSstream& operator()
(
const char* functionName,
@ -142,6 +144,8 @@ public:
const int sourceFileLineNumber = 0
);
//- Convert to OSstream
// Prints basic message and returns OSstream for further info.
OSstream& operator()
(
const string& functionName,
@ -149,8 +153,8 @@ public:
const int sourceFileLineNumber = 0
);
//- Convert to Ostream
// Prints basic message and then returns Ostream for further info.
//- Convert to OSstream
// Prints basic message and returns OSstream for further info.
OSstream& operator()
(
const char* functionName,
@ -161,8 +165,8 @@ public:
const label ioEndLineNumber = -1
);
//- Convert to Ostream
// Prints basic message and then returns Ostream for further info.
//- Convert to OSstream
// Prints basic message and returns OSstream for further info.
OSstream& operator()
(
const char* functionName,
@ -171,8 +175,8 @@ public:
const IOstream&
);
//- Convert to Ostream
// Prints basic message and then returns Ostream for further info.
//- Convert to OSstream
// Prints basic message and returns OSstream for further info.
OSstream& operator()
(
const char* functionName,
@ -181,10 +185,10 @@ public:
const dictionary&
);
//- Convert to Ostream for << operations
//- Convert to OSstream for << operations
operator OSstream&();
//- Explicitly convert to Ostream for << operations
//- Explicitly convert to OSstream for << operations
OSstream& operator()()
{
return operator OSstream&();
@ -199,18 +203,6 @@ extern messageStream SeriousError;
extern messageStream Warning;
extern messageStream Info;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Convienient macros to add the file name and line number to the function name
#define SeriousErrorIn(fn) SeriousError(fn, __FILE__, __LINE__)
#define SeriousIOErrorIn(fn, ios) SeriousError(fn, __FILE__, __LINE__, ios)
#define WarningIn(fn) Warning(fn, __FILE__, __LINE__)
#define IOWarningIn(fn, ios) Warning(fn, __FILE__, __LINE__, ios)
#define InfoIn(fn) Info(fn, __FILE__, __LINE__)
#define IOInfoIn(fn, ios) Info(fn, __FILE__, __LINE__, ios)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
@ -219,6 +211,60 @@ extern messageStream Info;
#include "OSstream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Convenience macros to add the file name and line number to the function name
/**
* @def SeriousErrorIn(functionName)
* Report an error message using Foam::SeriousError for functionName in
* file __FILE__ at line __LINE__
*/
#define SeriousErrorIn(fn) \
::Foam::SeriousError((fn), __FILE__, __LINE__)
/**
* @def SeriousIOErrorIn(functionName, ios)
* Report an IO error message using Foam::SeriousError for functionName in
* file __FILE__ at line __LINE__
* for a particular IOstream
*/
#define SeriousIOErrorIn(fn, ios) \
::Foam::SeriousError((fn), __FILE__, __LINE__, ios)
/**
* @def WarningIn(functionName)
* Report a warning using Foam::Warning for functionName in
* file __FILE__ at line __LINE__
*/
#define WarningIn(fn) \
::Foam::Warning((fn), __FILE__, __LINE__)
/**
* @def IOWarningIn(functionName, ios)
* Report an IO warning using Foam::Warning for functionName in
* file __FILE__ at line __LINE__
* for a particular IOstream
*/
#define IOWarningIn(fn, ios) \
::Foam::Warning((fn), __FILE__, __LINE__, (ios))
/**
* @def InfoIn(functionName)
* Report a information message using Foam::Info for functionName in
* file __FILE__ at line __LINE__
*/
#define InfoIn(fn) \
::Foam::Info((fn), __FILE__, __LINE__)
/**
* @def IOInfoIn(functionName, ios)
* Report an IO information message using Foam::Info for functionName in
* file __FILE__ at line __LINE__
* for a particular IOstream
*/
#define IOInfoIn(fn, ios) \
::Foam::Info((fn), __FILE__, __LINE__, (ios))
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif