r23608 by craig - Use default initialisation for ScGuardedPtrData

scribus-commit scribus-commit at lists.scribus.net
Tue Apr 14 08:48:51 UTC 2020


Author: craig
Date: Tue Apr 14 08:48:51 2020
New Revision: 23608

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23608
Log:
Use default initialisation for ScGuardedPtrData

Modified:
    trunk/Scribus/scribus/scguardedptr.h

Modified: trunk/Scribus/scribus/scguardedptr.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23608&path=/trunk/Scribus/scribus/scguardedptr.h
==============================================================================
--- trunk/Scribus/scribus/scguardedptr.h	(original)
+++ trunk/Scribus/scribus/scguardedptr.h	Tue Apr 14 08:48:51 2020
@@ -17,53 +17,52 @@
 template<typename T>
 class ScGuardedPtrData
 {
-public:
+	public:
+		int refs {0};
+		T* pointer {nullptr};
 
-	int refs;
-	T* pointer;
-
-	ScGuardedPtrData(void) { pointer = nullptr; refs = 0; }
-	ScGuardedPtrData(T* ptr) { pointer = ptr; refs = 0; }
+		ScGuardedPtrData(void) { }
+		ScGuardedPtrData(T* ptr) { pointer = ptr; }
 };
 
 template<typename T>
 class ScGuardedPtr
 {
-protected:
-ScGuardedPtrData<T>* data {nullptr};
-public:
-	ScGuardedPtr();
-	ScGuardedPtr(T* ptr);
-	ScGuardedPtr(const ScGuardedPtr& gPtr);
-	~ScGuardedPtr();
+	protected:
+		ScGuardedPtrData<T>* data {nullptr};
+	public:
+		ScGuardedPtr();
+		ScGuardedPtr(T* ptr);
+		ScGuardedPtr(const ScGuardedPtr& gPtr);
+		~ScGuardedPtr();
 
-	ScGuardedPtr& operator=(const ScGuardedPtr& gPtr);
-	bool operator==( const ScGuardedPtr<T> &p ) const { return (T*)(*this) == (T*) p;}
-	bool operator!= ( const ScGuardedPtr<T>& p ) const { return !( *this == p ); }
+		ScGuardedPtr& operator=(const ScGuardedPtr& gPtr);
+		bool operator==( const ScGuardedPtr<T> &p ) const { return (T*)(*this) == (T*) p;}
+		bool operator!= ( const ScGuardedPtr<T>& p ) const { return !( *this == p ); }
 
-	bool isNull() const;
+		bool isNull() const;
 
-	T* operator->() const { return (T*)(data ? data->pointer : nullptr); }
-	T& operator*() const { return *((T*)(data ? data->pointer : 0)); }
-	operator T*() const { return (T*)(data ? data->pointer : nullptr); }
+		T* operator->() const { return (T*)(data ? data->pointer : nullptr); }
+		T& operator*() const { return *((T*)(data ? data->pointer : 0)); }
+		operator T*() const { return (T*)(data ? data->pointer : nullptr); }
 
-	int refCount() const;
-	void deref(void);
+		int refCount() const;
+		void deref(void);
 };
 
 template<typename T>
 class ScGuardedObject : public ScGuardedPtr<T>
 {
-public:
-	ScGuardedObject(T* ptr);
-	ScGuardedObject(const ScGuardedObject& gPtr);
-	~ScGuardedObject();
+	public:
+		ScGuardedObject(T* ptr);
+		ScGuardedObject(const ScGuardedObject& gPtr);
+		~ScGuardedObject();
 
-	ScGuardedObject& operator=(const ScGuardedObject& gPtr);
-	bool operator==( const ScGuardedObject<T> &p ) const { return (T*)(*this) == (T*) p;}
-	bool operator!= ( const ScGuardedObject<T>& p ) const { return !( *this == p ); }
+		ScGuardedObject& operator=(const ScGuardedObject& gPtr);
+		bool operator==( const ScGuardedObject<T> &p ) const { return (T*)(*this) == (T*) p;}
+		bool operator!= ( const ScGuardedObject<T>& p ) const { return !( *this == p ); }
 
-	void nullify();
+		void nullify();
 };
 
 template<typename T>




More information about the scribus-commit mailing list