home *** CD-ROM | disk | FTP | other *** search
/ ftptest.leeds.ac.uk / 2015.02.ftptest.leeds.ac.uk.tar / ftptest.leeds.ac.uk / bionet / CAE-GROUP / SCL-WIN3x / SCL.EXE / ERRORDES.CPP < prev    next >
C/C++ Source or Header  |  1994-08-06  |  2KB  |  113 lines

  1.  
  2. /*
  3. * NIST Utils Class Library
  4. * clutils/errordesc.cc
  5. * February, 1994
  6. * David Sauder
  7. * K. C. Morris
  8.  
  9. * Development of this software was funded by the United States Government,
  10. * and is not subject to copyright.
  11. */
  12.  
  13. /* $Id: errordesc.cc,v 2.0.1.2 1994/04/05 16:44:39 sauderd Exp $  */ 
  14.  
  15. #include <errordes.h>
  16.  
  17. DebugLevel ErrorDescriptor::_debug_level = DEBUG_OFF;
  18. ostream *  ErrorDescriptor::_out = 0;
  19.  
  20. ErrorDescriptor::ErrorDescriptor ( Severity s,  DebugLevel d)
  21. :     _severity (s), 
  22.       _userMsg (0),
  23.       _detailMsg (0)
  24. {
  25.   if (d  != DEBUG_OFF) 
  26.     _debug_level = d;
  27. }
  28.  
  29.  
  30. const char *
  31. ErrorDescriptor::UserMsg () const
  32. {
  33.     if(_userMsg)
  34.     return _userMsg->chars();
  35.     else
  36.     return "";
  37. }
  38.  
  39. void
  40. ErrorDescriptor::UserMsg ( const char * msg)  
  41. {
  42.     if(!_userMsg)
  43.     _userMsg = new SCLstring;
  44.     *_userMsg = msg;
  45. }
  46.  
  47. void  
  48. ErrorDescriptor::PrependToUserMsg ( const char * msg)  
  49. {
  50.     if(!_userMsg)
  51.     _userMsg = new SCLstring;
  52.     _userMsg -> Prepend (msg);
  53. }
  54.  
  55. void  
  56. ErrorDescriptor::AppendToUserMsg ( const char * msg)  
  57. {
  58.     if(!_userMsg)
  59.     _userMsg = new SCLstring;
  60.     _userMsg -> Append (msg);
  61. }
  62.  
  63.  
  64. const char *
  65. ErrorDescriptor::DetailMsg ()  const
  66. {
  67.     if(_detailMsg)
  68.     return _detailMsg->chars();
  69.     else
  70.     return "";
  71. }
  72.  
  73. void
  74. ErrorDescriptor::DetailMsg ( const char * msg)  
  75. {
  76.     if(!_detailMsg)
  77.     _detailMsg = new SCLstring;
  78.     *_detailMsg = msg;
  79.     // cerr << "D " << _detailMsg->chars() << '\n';
  80. }
  81.  
  82. void
  83. ErrorDescriptor::PrependToDetailMsg (const char * msg)  
  84. {
  85.     if(!_detailMsg)
  86.     _detailMsg = new SCLstring;
  87.     _detailMsg -> Prepend (msg);
  88. }    
  89.  
  90. void
  91. ErrorDescriptor::AppendToDetailMsg (const char * msg)  
  92. {
  93.     if(!_detailMsg)
  94.     _detailMsg = new SCLstring;
  95.     _detailMsg -> Append (msg);
  96. }    
  97.  
  98. /******************************************************************
  99.  ** Procedure:  ErrorMessage
  100.  ** Parameters:  char * msg -- message to print
  101.  ** Returns:  
  102.  ** Description:  prints out a fatal error messsage and exits the program
  103.  ** Side Effects:  aborts the program
  104.  ** Status:  stub for better function
  105.  ******************************************************************/
  106.  
  107. void
  108. ErrorMessage (char * msg)    
  109. {
  110.     cerr << "WARNING:  Unknown dangerous error:  " << msg << "\n";
  111.     cerr << "*****  Suggest that you save file before continuing  *****\n" ;
  112. }
  113.