~ubuntu-branches/debian/sid/pgadmin3/sid

« back to all changes in this revision

Viewing changes to pgadmin/include/pgscript/utilities/pgsCopiedPtr.h

  • Committer: Bazaar Package Importer
  • Author(s): Gerfried Fuchs
  • Date: 2009-07-30 12:27:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20090730122716-fddbh42on721bbs2
Tags: 1.10.0-1
* New upstream release.
* Adjusted watch file to match release candidates.
* Updated to Standards-Version 3.8.2:
  - Moved to Section: database.
  - Add DEB_BUILD_OPTIONS support for parallel building.
  - Move from findstring to filter suggestion for DEB_BUILD_OPTIONS parsing.
* pgagent got split into its own separate source package by upstream.
* Exclude Docs.vcproj from installation.
* Move doc-base.enus from pgadmin3 to pgadmin3-data package, the files are
  in there too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//////////////////////////////////////////////////////////////////////////
 
2
//
 
3
// pgScript - PostgreSQL Tools
 
4
// RCS-ID:      $Id: pgsCopiedPtr.h 7758 2009-03-26 20:49:59Z dpage $
 
5
// Copyright (C) 2002 - 2009, The pgAdmin Development Team
 
6
// This software is released under the BSD Licence
 
7
//
 
8
//////////////////////////////////////////////////////////////////////////
 
9
 
 
10
 
 
11
#ifndef PGSCOPIEDPTR_H_
 
12
#define PGSCOPIEDPTR_H_
 
13
 
 
14
#include <algorithm>
 
15
 
 
16
template <typename T> class pgsCopiedPtr
 
17
{
 
18
 
 
19
private:
 
20
 
 
21
        T * p;
 
22
 
 
23
public:
 
24
 
 
25
        pgsCopiedPtr(T * p) :
 
26
                p(p)
 
27
        {
 
28
                
 
29
        }
 
30
 
 
31
        pgsCopiedPtr() :
 
32
                p(0)
 
33
        {
 
34
                
 
35
        }
 
36
 
 
37
        pgsCopiedPtr(const pgsCopiedPtr & that) :
 
38
                p(that.p == 0 ? 0 : that.p->clone())
 
39
        {
 
40
                
 
41
        }
 
42
 
 
43
        ~pgsCopiedPtr()
 
44
        {
 
45
                pdelete(p);
 
46
        }
 
47
 
 
48
        pgsCopiedPtr & operator =(pgsCopiedPtr that)
 
49
        {
 
50
                std::swap(p, that.p);
 
51
                return (*this);
 
52
        }
 
53
 
 
54
        T & operator *()
 
55
        {
 
56
                return *p;
 
57
        }
 
58
 
 
59
        const T & operator *() const
 
60
        {
 
61
                return *p;
 
62
        }
 
63
 
 
64
        T * operator ->()
 
65
        {
 
66
                return p;
 
67
        }
 
68
 
 
69
        const T * operator ->() const
 
70
        {
 
71
                return p;
 
72
        }
 
73
 
 
74
        const T * get() const
 
75
        {
 
76
                return p;
 
77
        }
 
78
};
 
79
 
 
80
#endif /*PGSCOPIEDPTR_H_*/