LeechCraft 0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
scopeguards.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <QSettings>
12#include "util.h"
13
14namespace LC::Util
15{
28 {
29 return MakeScopeGuard ([&settings] { settings.endGroup (); });
30 }
31
43 {
44 settings.beginGroup (group);
45 return MakeScopeGuard ([&settings] { settings.endGroup (); });
46 }
47}
Container< T > Filter(const Container< T > &c, F f)
Definition prelude.h:118
detail::ScopeGuard< F > MakeScopeGuard(const F &f)
Returns an object performing passed function on scope exit.
Definition util.h:155
auto BeginGroup(QSettings &settings, const QString &group)
Begins the group on settings and returns a scope guard ending that group.
Definition scopeguards.h:42
auto MakeEndGroupScopeGuard(QSettings &settings)
Creates a scope guard that ends the current group on settings.
Definition scopeguards.h:27