/usr/include/scim-1.0/scim_object.h is in libscim-dev 1.4.18-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | /** @file scim_object.h
* @brief Reference counted base class interface.
*
* Provides a reference counted base class
* for dynamic objects handled the scim smart pointer.
*
* Most code of this file are came from Inti project.
*/
/*
* Smart Common Input Method
*
* Copyright (c) 2002-2005 James Su <suzhe@tsinghua.org.cn>
* Copyright (c) 2002 The Inti Development Team.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*
* $Id: scim_object.h,v 1.9 2005/01/10 08:30:54 suzhe Exp $
*/
#ifndef __SCIM_OBJECT_H
#define __SCIM_OBJECT_H
namespace scim {
/**
* @addtogroup Accessories
* @{
*/
/**
* @class ReferencedObject
* @brief Reference counted base class.
*
* ReferencedObject is a reference counting base class.
* it has an integer reference counter so that dynamic objects
* can have their memory allocation handled by the scim
* smart pointer: Pointer<>. This keeps the memory management
* in scim consistent across all classes.
* If you derive a class from ReferencedObject and allocate it
* on the heap, you free the memory and destroy the object by
* calling unref(), not delete.
*/
class ReferencedObject
{
template<typename T> friend class Pointer;
ReferencedObject(const ReferencedObject&);
ReferencedObject& operator=(const ReferencedObject&);
bool m_referenced;
int m_ref_count;
protected:
ReferencedObject();
//!< Constructor.
virtual ~ReferencedObject() = 0;
//!< Destructor.
void set_referenced(bool reference);
//!< Set the internal referenced flag.
//!< @param reference - <EM>true</EM> if the initial reference count must be removed by owner.
//!<
//!< <BR>Called by derived classes to set the referenced flag. A object sets this flag
//!< to true , indicating that it owns the initial reference count and unref() must be called.
public:
bool is_referenced() const;
//!< The referenced flag setting.
//!< @return <EM>true</EM> if unref() must be explicitly called on this object.
void ref();
//!< Increase an object's reference count by one.
void unref();
//!< Decrease an object's reference count by one.
//!< When the reference count becomes zero delete is called. Remember, with ReferencedObject
//!< you must call unref() on dynmaically allocated objects, not delete.
};
/** @} */
} // namespace scim
#endif //__SCIM_OBJECT_H
/*
vi:ts=4:nowrap:ai:expandtab
*/
|