r20976 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Thu Feb 11 21:22:30 UTC 2016


Author: jghali
Date: Thu Feb 11 21:22:29 2016
New Revision: 20976

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20976
Log:
allow to retrieve the reference count of a guarded object

Modified:
    trunk/Scribus/scribus/scguardedptr.h

Modified: trunk/Scribus/scribus/scguardedptr.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20976&path=/trunk/Scribus/scribus/scguardedptr.h
==============================================================================
--- trunk/Scribus/scribus/scguardedptr.h	(original)
+++ trunk/Scribus/scribus/scguardedptr.h	Thu Feb 11 21:22:29 2016
@@ -47,6 +47,7 @@
 	T& operator*() const { return *((T*)(data ? data->pointer : 0)); }
 	operator T*() const { return (T*)(data ? data->pointer : 0); }
 
+	int refCount(void) const;
 	void deref(void);
 };
 
@@ -114,6 +115,14 @@
 };
 
 template<typename T>
+int ScGuardedPtr<T>::refCount(void) const
+{
+	if (data)
+		return data->refs;
+	return 0;
+};
+
+template<typename T>
 void ScGuardedPtr<T>::deref(void)
 {
 	if (data && --(data->refs) == 0)




More information about the scribus-commit mailing list