• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

Analitza

  • sources
  • kde-4.14
  • kdeedu
  • analitza
  • analitza
pushvalue.h
Go to the documentation of this file.
1 /*
2  Copyright 2007-2008 David Nolden <david.nolden.kdevelop@art-master.de>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 
19 #ifndef PUSHVALUE_H
20 #define PUSHVALUE_H
21 
28 template<class Value>
29 class PushValue {
30  public:
31  PushValue( Value& ptr, const Value& push = Value() ) : m_ptr(ptr) {
32  m_oldPtr = m_ptr;
33  m_ptr = push;
34  }
35  ~PushValue() {
36  m_ptr = m_oldPtr;
37  }
38  private:
39  Value& m_ptr;
40  Value m_oldPtr;
41 };
42 
44 template<class Value>
45 class PushPositiveValue {
46  public:
47  PushPositiveValue( Value& ptr, const Value& push = Value() ) : m_ptr(ptr) {
48  m_oldPtr = m_ptr;
49  if( push ) {
50  m_ptr = push;
51  }
52  }
53  ~PushPositiveValue() {
54  m_ptr = m_oldPtr;
55  }
56  private:
57  Value& m_ptr;
58  Value m_oldPtr;
59 };
60 
61 #endif
PushPositiveValue::~PushPositiveValue
~PushPositiveValue()
Definition: pushvalue.h:53
PushValue::PushValue
PushValue(Value &ptr, const Value &push=Value())
Definition: pushvalue.h:31
PushValue
A simple helper-class that does the following: Backup the given reference-value given through...
Definition: pushvalue.h:29
PushValue::~PushValue
~PushValue()
Definition: pushvalue.h:35
PushPositiveValue::PushPositiveValue
PushPositiveValue(Value &ptr, const Value &push=Value())
Definition: pushvalue.h:47
PushPositiveValue
Only difference to PushValue: The value is only replaced if the new value is positive.
Definition: pushvalue.h:45
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:11:37 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Analitza

Skip menu "Analitza"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal