<commit_before>#ifndef _GDIOBJ_H_
#define _GDIOBJ_H_

#include "win32/Window.h"

namespace Framework
{
	namespace Win32
	{
		template <typename Type> class CGdiObj
		{
		public:
			CGdiObj(Type nHandle)
			{
				m_nHandle = nHandle;
			}

			virtual ~CGdiObj()
			{
				DeleteObject(m_nHandle);
			}

			operator HGDIOBJ()
			{
				return m_nHandle;
			}

			operator Type()
			{
				return m_nHandle;
			}

		private:
			Type		m_nHandle;
		};

		typedef CGdiObj<HFONT>		CFont;
		typedef CGdiObj<HBRUSH>		CBrush;
		typedef CGdiObj<HBITMAP>	CBitmap;
		typedef CGdiObj<HPEN>		CPen;
	}
}

#endif<commit_msg>Changed the Framework::Win32::CGdiObj class to better manage the lifetime of GDI objects.<commit_after>#ifndef _GDIOBJ_H_
#define _GDIOBJ_H_

#include "win32/Window.h"

namespace Framework
{
	namespace Win32
	{
		template <typename Type> class CGdiObj
		{
		public:
			CGdiObj(Type handle = NULL)
				: m_handle(handle)
			{

			}

			CGdiObj(const CGdiObj&& src)
			{
				m_handle = src.m_handle;
				src.m_handle = NULL;
			}

			virtual ~CGdiObj()
			{
				Release();
			}

			CGdiObj& operator =(CGdiObj&& src)
			{
				if(&src != this)
				{
					Release();
					m_handle = src.m_handle;
					src.m_handle = NULL;
				}
				return (*this);
			}

			bool IsValid() const
			{
				return m_handle != NULL;
			}

			operator HGDIOBJ() const
			{
				return m_handle;
			}

			operator Type() const
			{
				return m_handle;
			}

		private:
			CGdiObj(const CGdiObj&)
			{

			}

			CGdiObj& operator =(const CGdiObj&)
			{
				
			}

			void Release()
			{
				if(m_handle)
				{
					DeleteObject(m_handle);
					m_handle = NULL;
				}
			}

			Type m_handle;
		};

		typedef CGdiObj<HFONT>		CFont;
		typedef CGdiObj<HBRUSH>		CBrush;
		typedef CGdiObj<HBITMAP>	CBitmap;
		typedef CGdiObj<HPEN>		CPen;
	}
}

#endif
{'fraction_non_alphanumeric': 0.10818231740801758, 'fraction_numerical': 0.0054914881933003845, 'mean_word_length': 2.544747081712062, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6575139', 'n_tokens_mistral': 970, 'n_tokens_neox': 726, 'n_words': 144}