1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008 Henrik Tidefelt
20 #include "shapesexceptions.h"
22 using namespace Shapes
;
24 Kernel::DebugLog::DebugLog( )
28 Kernel::DebugLog::~DebugLog( )
32 Kernel::DebugLog::initialized( ) const
34 return os_
!= 0 || ! filename_
.empty( );
38 Kernel::DebugLog::setStream( std::ostream
* os
)
42 throw "Multiply specified debug log";
48 Kernel::DebugLog::setFilename( const std::string
& filename
)
52 throw "Multiply specified debug log";
58 Kernel::DebugLog::os( )
62 if( filename_
.empty( ) )
64 throw Exceptions::InternalError( "The debug log filename was not initialized before it was needed." );
66 myFile_
.open( filename_
.c_str( ) );
67 if( ! myFile_
.is_open( ) )
69 throw Exceptions::FileWriteOpenError( Ast::THE_UNKNOWN_LOCATION
, strrefdup( filename_
), "(debug log)" );