QxOrm 1.4.9
C++ Object Relational Mapping library
Loading...
Searching...
No Matches
cont_ptr_utils.h
Go to the documentation of this file.
1// -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
2// vim:tabstop=4:shiftwidth=4:expandtab:
3
4/*
5 * Copyright (C) 2004-2008 Wu Yongwei <adah at users dot sourceforge dot net>
6 *
7 * This software is provided 'as-is', without any express or implied
8 * warranty. In no event will the authors be held liable for any
9 * damages arising from the use of this software.
10 *
11 * Permission is granted to anyone to use this software for any purpose,
12 * including commercial applications, and to alter it and redistribute
13 * it freely, subject to the following restrictions:
14 *
15 * 1. The origin of this software must not be misrepresented; you must
16 * not claim that you wrote the original software. If you use this
17 * software in a product, an acknowledgement in the product
18 * documentation would be appreciated but is not required.
19 * 2. Altered source versions must be plainly marked as such, and must
20 * not be misrepresented as being the original software.
21 * 3. This notice may not be removed or altered from any source
22 * distribution.
23 *
24 * This file is part of Stones of Nvwa:
25 * http://sourceforge.net/projects/nvwa
26 *
27 */
28
41#ifndef QT_NO_DEBUG
42#ifndef _QX_MODE_RELEASE
43#if _QX_USE_MEM_LEAK_DETECTION
44
45#ifndef _CONT_PTR_UTILS_H
46#define _CONT_PTR_UTILS_H
47
48#ifdef _MSC_VER
49#pragma once
50#endif
51
52namespace qx {
53namespace memory {
54
68{
69 template <typename _Tp>
70 const _Tp& operator()(const _Tp* __ptr) const
71 {
72 return *__ptr;
73 }
74};
75
90{
91 template <typename _Pointer>
92 bool operator()(_Pointer __ptr1, _Pointer __ptr2) const
93 {
94 return *__ptr1 < *__ptr2;
95 }
96};
97
109{
110 template <typename _Pointer>
111 void operator()(_Pointer __ptr) const
112 {
113 delete __ptr;
114 }
115};
116
127template <typename _OutputStrm, typename _StringType = const char*>
129{
130 output_object(_OutputStrm& __outs, const _StringType& __sep)
131 : _M_outs(__outs), _M_sep(__sep)
132 {}
133
134 template <typename _Tp>
135 void operator()(const _Tp* __ptr) const
136 {
137 _M_outs << *__ptr << _M_sep;
138 }
139
140private:
141 _OutputStrm& _M_outs;
142 _StringType _M_sep;
143};
144
145} // namespace memory
146} // namespace qx
147
148#endif // _CONT_PTR_UTILS_H
149#endif // _QX_USE_MEM_LEAK_DETECTION
150#endif // _QX_MODE_RELEASE
151#endif // QT_NO_DEBUG
#define QX_DLL_EXPORT
Definition QxMacro.h:182
Root namespace for all QxOrm library features.
void operator()(_Pointer __ptr) const
bool operator()(_Pointer __ptr1, _Pointer __ptr2) const
const _Tp & operator()(const _Tp *__ptr) const
void operator()(const _Tp *__ptr) const
output_object(_OutputStrm &__outs, const _StringType &__sep)