~ubuntu-branches/ubuntu/warty/aqsis/warty

« back to all changes in this revision

Viewing changes to libri2rib/error.cpp

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-08-24 07:25:04 UTC
  • Revision ID: james.westby@ubuntu.com-20040824072504-zf993vnevvisdsvb
Tags: upstream-0.9.1
Import upstream version 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Aqsis
 
2
// Copyright � 1997 - 2001, Paul C. Gregory
 
3
//
 
4
// Contact: pgregory@aqsis.com
 
5
//
 
6
// This library is free software; you can redistribute it and/or
 
7
// modify it under the terms of the GNU Lesser General Public
 
8
// License as published by the Free Software Foundation; either
 
9
// version 2.1 of the License, or (at your option) any later version.
 
10
//
 
11
// This library is distributed in the hope that it will be useful,
 
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
// General Public License for more details.
 
15
//
 
16
// You should have received a copy of the GNU General Public
 
17
// License along with this library; if not, write to the Free Software
 
18
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
19
 
 
20
/** \file
 
21
 *  \brief Error reporting class implementation.
 
22
 *  \author Lionel J. Lacour (intuition01@online.fr)
 
23
 */
 
24
#include <iostream>
 
25
#include <stdlib.h>
 
26
#include "error.h"
 
27
 
 
28
 
 
29
/// Storage for the last error number reported.
 
30
RtInt RiLastError;
 
31
 
 
32
/// Default implementation of ignore error handler.
 
33
RtVoid RiErrorIgnore( RtInt cd, RtInt sev, const char *msg )
 
34
{}
 
35
/// Default implementation of print error handler.
 
36
 
 
37
RtVoid RiErrorPrint( RtInt cd, RtInt sev, const char *msg )
 
38
{}
 
39
/// Default implementation of abort error handler.
 
40
 
 
41
RtVoid RiErrorAbort( RtInt cd, RtInt sev, const char *msg )
 
42
{}
 
43
 
 
44
 
 
45
USING_NAMESPACE( libri2rib );
 
46
 
 
47
RtVoid CqError::manage ()
 
48
{
 
49
    RiLastError = m_Code;
 
50
    std::cerr << "RI2RIB: " << m_Message1 << m_Message2 << m_Message3 << std::endl;
 
51
    if ( m_Severity == RIE_SEVERE ) exit( EXIT_FAILURE );
 
52
 
 
53
    if ( m_ToRib == TqTrue )
 
54
    {
 
55
        std::string tmp;
 
56
        switch ( m_Severity )
 
57
        {
 
58
        case RIE_INFO: tmp = std::string( "INFO: " ); break;
 
59
        case RIE_WARNING: tmp = std::string( "WARNING: " ); break;
 
60
        case RIE_ERROR: tmp = std::string( "ERROR: " ); break;
 
61
        default: break;
 
62
        }
 
63
        tmp += m_Message1 + m_Message2 + m_Message3;
 
64
        RiArchiveRecord( RI_COMMENT, const_cast<char *> ( tmp.c_str() ) );
 
65
    }
 
66
}