Take the line number as an integer, the STRINGIZER macro didn't work as expected

svn path=/trunk/; revision=40208
This commit is contained in:
Colin Finck 2009-03-24 12:37:54 +00:00
parent c0212e7286
commit 0a05554c18
3 changed files with 6 additions and 7 deletions

View file

@ -15,12 +15,12 @@
* Constant pointer to a char array with the source file where the exception occured (__FILE__) * Constant pointer to a char array with the source file where the exception occured (__FILE__)
* *
* @param Line * @param Line
* Constant pointer to a char array with the appropriate source line (#__LINE__) * Integer value with the appropriate source line (__LINE__)
* *
* @param Message * @param Message
* Constant pointer to a char array containing a short message about the exception * Constant pointer to a char array containing a short message about the exception
*/ */
CFatalException::CFatalException(const char* File, const char* Line, const char* Message) CFatalException::CFatalException(const char* File, int Line, const char* Message)
: m_File(File), m_Line(Line), m_Message(Message) : m_File(File), m_Line(Line), m_Message(Message)
{ {
} }

View file

@ -9,13 +9,13 @@ class CFatalException
{ {
private: private:
string m_File; string m_File;
string m_Line; int m_Line;
string m_Message; string m_Message;
public: public:
CFatalException(const char* File, const char* Line, const char* Message); CFatalException(const char* File, int Line, const char* Message);
const string& GetFile() const { return m_File; } const string& GetFile() const { return m_File; }
const string& GetLine() const { return m_Line; } int GetLine() const { return m_Line; }
const string& GetMessage() const { return m_Message; } const string& GetMessage() const { return m_Message; }
}; };

View file

@ -33,9 +33,8 @@ using namespace std;
#include "CWineTest.h" #include "CWineTest.h"
/* Useful macros */ /* Useful macros */
#define STRINGIZER(Value) #Value
#define EXCEPTION(Message) throw CSimpleException(Message) #define EXCEPTION(Message) throw CSimpleException(Message)
#define FATAL(Message) throw CFatalException(__FILE__, STRINGIZER(__LINE__), Message) #define FATAL(Message) throw CFatalException(__FILE__, __LINE__, Message)
#define SSEXCEPTION throw CSimpleException(ss.str().c_str()) #define SSEXCEPTION throw CSimpleException(ss.str().c_str())
/* main.c */ /* main.c */