1 /** 2 * @file XMLLogOverride.cpp 3 * @brief Utility class implementing a temporary override the severity on error logs. 4 * @author Frank T. Bergmann 5 * 6 * <!-------------------------------------------------------------------------- 7 * This file is part of libSBML. Please visit http://sbml.org for more 8 * information about SBML, and the latest version of libSBML. 9 * 10 * Copyright (C) 2020 jointly by the following organizations: 11 * 1. California Institute of Technology, Pasadena, CA, USA 12 * 2. University of Heidelberg, Heidelberg, Germany 13 * 3. University College London, London, UK 14 * 15 * Copyright (C) 2019 jointly by the following organizations: 16 * 1. California Institute of Technology, Pasadena, CA, USA 17 * 2. University of Heidelberg, Heidelberg, Germany 18 * 19 * Copyright (C) 2013-2018 jointly by the following organizations: 20 * 1. California Institute of Technology, Pasadena, CA, USA 21 * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK 22 * 3. University of Heidelberg, Heidelberg, Germany 23 * 24 * Copyright (C) 2009-2013 jointly by the following organizations: 25 * 1. California Institute of Technology, Pasadena, CA, USA 26 * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK 27 * 28 * Copyright (C) 2006-2008 by the California Institute of Technology, 29 * Pasadena, CA, USA 30 * 31 * Copyright (C) 2002-2005 jointly by the following organizations: 32 * 1. California Institute of Technology, Pasadena, CA, USA 33 * 2. Japan Science and Technology Agency, Japan 34 * 35 * This library is free software; you can redistribute it and/or modify it 36 * under the terms of the GNU Lesser General Public License as published by 37 * the Free Software Foundation. A copy of the license agreement is provided 38 * in the file named "LICENSE.txt" included with this software distribution and 39 * also available online as http://sbml.org/software/libsbml/license.html 40 * ---------------------------------------------------------------------- --> 41 */ 42 43 #include <sbml/xml/XMLLogOverride.h> 44 #include <sbml/xml/XMLErrorLog.h> 45 46 using namespace std; 47 48 LIBSBML_CPP_NAMESPACE_BEGIN 49 #ifdef __cplusplus 50 XMLLogOverride(XMLErrorLog * log,XMLErrorSeverityOverride_t new_override)51 XMLLogOverride::XMLLogOverride(XMLErrorLog* log, XMLErrorSeverityOverride_t new_override) 52 : mLog(log) 53 { 54 if (log == NULL) return; 55 mOldStatus = log->getSeverityOverride(); 56 log->setSeverityOverride(new_override); 57 } 58 ~XMLLogOverride()59 XMLLogOverride::~XMLLogOverride() 60 { 61 if (mLog == NULL) return; 62 mLog->setSeverityOverride(mOldStatus); 63 } 64 65 #endif /* __cplusplus */ 66 /** @cond doxygenIgnored */ 67 /** @endcond */ 68 69 LIBSBML_CPP_NAMESPACE_END 70