mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:17:44 +00:00
LibC: Implement popen() and pclose().
I feel reasonably confident that I might have gotten these right. :^)
This commit is contained in:
parent
e92fe52031
commit
ccc6e69a29
3 changed files with 89 additions and 5 deletions
26
AK/ValueRestorer.h
Normal file
26
AK/ValueRestorer.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
namespace AK {
|
||||
|
||||
template<typename T>
|
||||
class ValueRestorer {
|
||||
public:
|
||||
ValueRestorer(T& variable)
|
||||
: m_variable(variable)
|
||||
, m_saved_value(variable)
|
||||
{
|
||||
}
|
||||
|
||||
~ValueRestorer()
|
||||
{
|
||||
m_variable = m_saved_value;
|
||||
}
|
||||
|
||||
private:
|
||||
T& m_variable;
|
||||
T m_saved_value;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
using AK::ValueRestorer;
|
Loading…
Add table
Add a link
Reference in a new issue