Path: blob/master/3rdparty/openexr/Iex/IexBaseExc.cpp
16337 views
///////////////////////////////////////////////////////////////////////////1//2// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas3// Digital Ltd. LLC4//5// All rights reserved.6//7// Redistribution and use in source and binary forms, with or without8// modification, are permitted provided that the following conditions are9// met:10// * Redistributions of source code must retain the above copyright11// notice, this list of conditions and the following disclaimer.12// * Redistributions in binary form must reproduce the above13// copyright notice, this list of conditions and the following disclaimer14// in the documentation and/or other materials provided with the15// distribution.16// * Neither the name of Industrial Light & Magic nor the names of17// its contributors may be used to endorse or promote products derived18// from this software without specific prior written permission.19//20// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS21// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT22// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR23// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT24// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,25// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT26// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,27// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY28// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT29// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE30// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.31//32///////////////////////////////////////////////////////////////////////////33343536//---------------------------------------------------------------------37//38// Constructors and destructors for our exception base class.39//40//---------------------------------------------------------------------4142#include "IexBaseExc.h"4344namespace Iex {45namespace {464748StackTracer currentStackTracer = 0;495051} // namespace525354void55setStackTracer (StackTracer stackTracer)56{57currentStackTracer = stackTracer;58}596061StackTracer62stackTracer ()63{64return currentStackTracer;65}666768BaseExc::BaseExc (const char* s) throw () :69std::string (s? s: ""),70_stackTrace (currentStackTracer? currentStackTracer(): "")71{72// empty73}747576BaseExc::BaseExc (const std::string &s) throw () :77std::string (s),78_stackTrace (currentStackTracer? currentStackTracer(): "")79{80// empty81}828384BaseExc::BaseExc (std::stringstream &s) throw () :85std::string (s.str()),86_stackTrace (currentStackTracer? currentStackTracer(): "")87{88// empty89}909192BaseExc::BaseExc (const BaseExc &be) throw () :93std::string (be),94_stackTrace (be._stackTrace)95{96// empty97}9899100BaseExc::~BaseExc () throw ()101{102// empty103}104105106const char *107BaseExc::what () const throw ()108{109return c_str();110}111112113BaseExc &114BaseExc::assign (std::stringstream &s)115{116std::string::assign (s.str());117return *this;118}119120BaseExc &121BaseExc::append (std::stringstream &s)122{123std::string::append (s.str());124return *this;125}126127128} // namespace Iex129130131