Selaa lähdekoodia

libobs: Rename OBSObj to OBSPtr

Makes it a bit more explicit that it's just a pointer RAII, and because
an OBSObject will be added
jp9000 3 vuotta sitten
vanhempi
sitoutus
6b944a2f3c
2 muutettua tiedostoa jossa 12 lisäystä ja 12 poistoa
  1. 1 1
      UI/frontend-plugins/frontend-tools/scripts.cpp
  2. 11 11
      libobs/obs.hpp

+ 1 - 1
UI/frontend-plugins/frontend-tools/scripts.cpp

@@ -49,7 +49,7 @@
 
 /* ----------------------------------------------------------------- */
 
-using OBSScript = OBSObj<obs_script_t *, obs_script_destroy>;
+using OBSScript = OBSPtr<obs_script_t *, obs_script_destroy>;
 
 struct ScriptData {
 	std::vector<OBSScript> scripts;

+ 11 - 11
libobs/obs.hpp

@@ -253,26 +253,26 @@ inline OBSWeakService OBSGetWeakRef(obs_service_t *service)
 }
 
 /* objects that are not meant to be instanced */
-template<typename T, void destroy(T)> class OBSObj {
+template<typename T, void destroy(T)> class OBSPtr {
 	T obj;
 
 public:
-	inline OBSObj() : obj(nullptr) {}
-	inline OBSObj(T obj_) : obj(obj_) {}
-	inline OBSObj(const OBSObj &) = delete;
-	inline OBSObj(OBSObj &&other) : obj(other.obj) { other.obj = nullptr; }
+	inline OBSPtr() : obj(nullptr) {}
+	inline OBSPtr(T obj_) : obj(obj_) {}
+	inline OBSPtr(const OBSPtr &) = delete;
+	inline OBSPtr(OBSPtr &&other) : obj(other.obj) { other.obj = nullptr; }
 
-	inline ~OBSObj() { destroy(obj); }
+	inline ~OBSPtr() { destroy(obj); }
 
-	inline OBSObj &operator=(T obj_)
+	inline OBSPtr &operator=(T obj_)
 	{
 		if (obj_ != obj)
 			destroy(obj);
 		obj = obj_;
 		return *this;
 	}
-	inline OBSObj &operator=(const OBSObj &) = delete;
-	inline OBSObj &operator=(OBSObj &&other)
+	inline OBSPtr &operator=(const OBSPtr &) = delete;
+	inline OBSPtr &operator=(OBSPtr &&other)
 	{
 		if (obj)
 			destroy(obj);
@@ -287,8 +287,8 @@ public:
 	inline bool operator!=(T p) const { return obj != p; }
 };
 
-using OBSDisplay = OBSObj<obs_display_t *, obs_display_destroy>;
-using OBSView = OBSObj<obs_view_t *, obs_view_destroy>;
+using OBSDisplay = OBSPtr<obs_display_t *, obs_display_destroy>;
+using OBSView = OBSPtr<obs_view_t *, obs_view_destroy>;
 
 /* signal handler connection */
 class OBSSignal {