removed for new error handling
This commit is contained in:
parent
91a8442167
commit
c0b86979d3
@ -1,81 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
This file is Part of the ZEngine Library for 2D game development.
|
|
||||||
Copyright (C) 2002, 2003 James Turk
|
|
||||||
|
|
||||||
Licensed under a BSD-style license.
|
|
||||||
|
|
||||||
The maintainer of this library is James Turk (james@conceptofzero.net)
|
|
||||||
and the home of this Library is http://www.zengine.sourceforge.net
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\par File Header:
|
|
||||||
File: ZE_Error.h <br>
|
|
||||||
Description: Header file for ZEngine Error Handling Functions. <br>
|
|
||||||
Author(s): James Turk <br>
|
|
||||||
$Id: ZE_Error.h,v 1.4 2002/12/29 06:50:19 cozman Exp $<br>
|
|
||||||
|
|
||||||
\file ZE_Error.h
|
|
||||||
\brief Definition file for ZEngine Error Handling Functions.
|
|
||||||
|
|
||||||
Definition file for ZEngine Error Logging + Formatting functions which are used for internal and external errors.
|
|
||||||
**/
|
|
||||||
|
|
||||||
#ifndef __ze_error_h__
|
|
||||||
#define __ze_error_h__
|
|
||||||
|
|
||||||
#include "ZE_Includes.h"
|
|
||||||
|
|
||||||
namespace ZE
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////
|
|
||||||
//Error Logging + Formatting//
|
|
||||||
//////////////////////////////
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\brief Error handling Utiltity function.
|
|
||||||
|
|
||||||
Get string describing error given appropriate details.
|
|
||||||
\param line Line error occured on.
|
|
||||||
\param file Name of file error occured in.
|
|
||||||
\param str More detail on error.
|
|
||||||
\return String describing error.
|
|
||||||
**/
|
|
||||||
string _GetError(int line, string file, string str);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\brief Error handling Utiltity function.
|
|
||||||
|
|
||||||
Log error to stderr, describing error given appropriate details.
|
|
||||||
\param line Line error occured on.
|
|
||||||
\param file Name of file error occured in.
|
|
||||||
\param str More detail on error.
|
|
||||||
**/
|
|
||||||
void _LogError(int line, string file, string str);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\brief Parses a string and interprets variable arguments, similar to sprintf.
|
|
||||||
|
|
||||||
Takes % identifiers out of fmtstr and parses them, replacing them with cooresponding values
|
|
||||||
in the variable arguments list. For more detail view stdarg documentation.
|
|
||||||
\param fmtstr defines format of resulting string
|
|
||||||
\param ... variable number of arguments after fmtstr
|
|
||||||
\return string of parsed and combined string
|
|
||||||
**/
|
|
||||||
string FormatStr(const char *fmtstr, ...);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Creates a string about an error, telling what file it occured in and where, and gives a user defined string as well.
|
|
||||||
**/
|
|
||||||
#define GetError(str) _GetError(__LINE__,__FILE__,str)
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Logs a string about an error, telling what file it occured in and where, and gives a user defined string as well.
|
|
||||||
**/
|
|
||||||
#define LogError(str) _LogError(__LINE__,__FILE__,str)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif //__ze_error_h__
|
|
@ -1,53 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
This file is Part of the ZEngine Library for 2D game development.
|
|
||||||
Copyright (C) 2002, 2003 James Turk
|
|
||||||
|
|
||||||
Licensed under a BSD-style license.
|
|
||||||
|
|
||||||
The maintainer of this library is James Turk (james@conceptofzero.net)
|
|
||||||
and the home of this Library is http://www.zengine.sourceforge.net
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\par File Header:
|
|
||||||
File: ZE_Error.cpp <br>
|
|
||||||
Description: Implementation source file for ZEngine error logging utility functions. <br>
|
|
||||||
Author(s): James Turk <br>
|
|
||||||
$Id: ZE_Error.cpp,v 1.3 2002/12/29 06:52:07 cozman Exp $<br>
|
|
||||||
|
|
||||||
\file ZE_Error.cpp
|
|
||||||
\brief Source file for error logging utilities.
|
|
||||||
|
|
||||||
Error logging utilities for ZEngine and programs making use of ZEngine.
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include "ZE_Error.h"
|
|
||||||
|
|
||||||
namespace ZE
|
|
||||||
{
|
|
||||||
|
|
||||||
string _GetError(int line, string file, string str)
|
|
||||||
{
|
|
||||||
return FormatStr("%s (Line %d)\n Message Was: %s \n",file.c_str(),line,str.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void _LogError(int line, string file, string str)
|
|
||||||
{
|
|
||||||
string errstr = _GetError(line,file,str);
|
|
||||||
#ifdef DEBUG_STREAM
|
|
||||||
fprintf(stderr,errstr.c_str()); //this line writes the actual debug info
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
string FormatStr(const char *fmtstr, ...)
|
|
||||||
{
|
|
||||||
char buf[512];
|
|
||||||
va_list args;
|
|
||||||
|
|
||||||
va_start(args,fmtstr);
|
|
||||||
vsprintf(buf, fmtstr, args);
|
|
||||||
va_end(args);
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user