source: NonGTP/Xerces/xerces/include/xercesc/util/FlagJanitor.hpp @ 358

Revision 358, 3.1 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1/*
2 * Copyright 1999-2000,2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * $Log: FlagJanitor.hpp,v $
19 * Revision 1.4  2004/09/08 13:56:21  peiyongz
20 * Apache License Version 2.0
21 *
22 * Revision 1.3  2003/03/07 18:11:54  tng
23 * Return a reference instead of void for operator=
24 *
25 * Revision 1.2  2002/11/04 15:22:03  tng
26 * C++ Namespace Support.
27 *
28 * Revision 1.1.1.1  2002/02/01 22:22:10  peiyongz
29 * sane_include
30 *
31 * Revision 1.4  2000/03/02 19:54:39  roddey
32 * This checkin includes many changes done while waiting for the
33 * 1.1.0 code to be finished. I can't list them all here, but a list is
34 * available elsewhere.
35 *
36 * Revision 1.3  2000/02/24 20:05:24  abagchi
37 * Swat for removing Log from API docs
38 *
39 * Revision 1.2  2000/02/06 07:48:01  rahulj
40 * Year 2K copyright swat.
41 *
42 * Revision 1.1.1.1  1999/11/09 01:04:17  twl
43 * Initial checkin
44 *
45 * Revision 1.2  1999/11/08 20:45:06  rahul
46 * Swat for adding in Product name and CVS comment log variable.
47 *
48 */
49
50
51#if !defined(FLAGJANITOR_HPP)
52#define FLAGJANITOR_HPP
53
54#include <xercesc/util/XercesDefs.hpp>
55
56XERCES_CPP_NAMESPACE_BEGIN
57
58template <class T> class FlagJanitor
59{
60public :
61    // -----------------------------------------------------------------------
62    //  Constructors and Destructor
63    // -----------------------------------------------------------------------
64    FlagJanitor(T* const valPtr, const T newVal);
65    ~FlagJanitor();
66
67
68    // -----------------------------------------------------------------------
69    //  Value management methods
70    // -----------------------------------------------------------------------
71    void release();
72
73
74private :
75    // -----------------------------------------------------------------------
76    //  Unimplemented constructors and operators
77    // -----------------------------------------------------------------------
78    FlagJanitor();
79    FlagJanitor(const FlagJanitor<T>&);
80    FlagJanitor<T>& operator=(const FlagJanitor<T>&);
81
82
83    // -----------------------------------------------------------------------
84    //  Private data members
85    //
86    //  fOldVal
87    //      The old value that was in the flag when we were constructed.
88    //
89    //  fValPtr
90    //      A pointer to the flag that we are to restore the value of
91    // -----------------------------------------------------------------------
92    T   fOldVal;
93    T*  fValPtr;
94};
95
96XERCES_CPP_NAMESPACE_END
97
98#if !defined(XERCES_TMPLSINC)
99#include <xercesc/util/FlagJanitor.c>
100#endif
101
102#endif
Note: See TracBrowser for help on using the repository browser.