2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2005-03-10 13:00:09 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 10:16:05 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2005-03-10 13:00:09 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2005-03-10 13:00:09 +00:00
|
|
|
*
|
2008-04-11 10:16:05 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2005-03-10 13:00:09 +00:00
|
|
|
*
|
2008-04-11 10:16:05 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2005-03-10 13:00:09 +00:00
|
|
|
*
|
2008-04-11 10:16:05 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2005-03-10 13:00:09 +00:00
|
|
|
*
|
2008-04-11 10:16:05 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2005-03-10 13:00:09 +00:00
|
|
|
*
|
2008-04-11 10:16:05 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2005-03-10 13:00:09 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 16:14:02 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_comphelper.hxx"
|
|
|
|
|
2010-10-25 11:49:55 +02:00
|
|
|
#include "comphelper/flagguard.hxx"
|
2005-03-10 13:00:09 +00:00
|
|
|
#include "osl/diagnose.h"
|
|
|
|
#include "com/sun/star/uno/Exception.hpp"
|
|
|
|
|
|
|
|
namespace comphelper {
|
|
|
|
|
|
|
|
ScopeGuard::~ScopeGuard()
|
|
|
|
{
|
|
|
|
if (m_func)
|
|
|
|
{
|
2005-03-30 07:18:13 +00:00
|
|
|
if (m_excHandling == IGNORE_EXCEPTIONS)
|
2005-03-10 13:00:09 +00:00
|
|
|
{
|
|
|
|
try {
|
|
|
|
m_func();
|
|
|
|
}
|
|
|
|
catch (com::sun::star::uno::Exception & exc) {
|
2006-06-19 21:51:12 +00:00
|
|
|
(void) exc; // avoid warning about unused variable
|
2011-03-12 11:47:36 +01:00
|
|
|
OSL_FAIL(
|
|
|
|
rtl::OUStringToOString(
|
2005-03-10 13:00:09 +00:00
|
|
|
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
|
2010-12-04 13:22:40 +09:00
|
|
|
"UNO exception occurred: ") ) +
|
2005-03-10 13:00:09 +00:00
|
|
|
exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
|
|
|
|
}
|
|
|
|
catch (...) {
|
2011-03-12 11:47:36 +01:00
|
|
|
OSL_FAIL( "unknown exception occurred!" );
|
2005-03-10 13:00:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_func();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScopeGuard::dismiss()
|
|
|
|
{
|
|
|
|
m_func.clear();
|
|
|
|
}
|
|
|
|
|
2010-10-25 11:49:55 +02:00
|
|
|
FlagGuard::~FlagGuard()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
FlagRestorationGuard::~FlagRestorationGuard()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2005-03-10 13:00:09 +00:00
|
|
|
} // namespace comphelper
|
|
|
|
|
2010-10-14 08:27:31 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|