#region Using Directives using System; #endregion Using Directives namespace ScintillaNET { /// /// Provides an abstraction over Scintilla's Document Pointer /// public class Document : ScintillaHelperBase { #region Fields private IntPtr _handle; #endregion Fields #region Methods /// /// Increases the document's reference count /// /// No, you aren't looking at COM, move along. public void AddRef() { NativeScintilla.AddRefDocument(_handle); } /// /// Overridden. /// /// Another Document Object /// True if both Documents have the same Handle public override bool Equals(object obj) { Document d = obj as Document; if (_handle == IntPtr.Zero) return false; return _handle.Equals(d._handle); } /// /// Overridden /// /// Document Pointer's hashcode public override int GetHashCode() { return _handle.GetHashCode(); } /// /// Decreases the document's reference count /// /// /// When the document's reference count reaches 0 Scintilla will destroy the document /// public void Release() { NativeScintilla.ReleaseDocument(_handle); } #endregion Methods #region Properties /// /// Scintilla's internal document pointer. /// public IntPtr Handle { get { return _handle; } set { _handle = value; } } #endregion Properties #region Constructors internal Document(Scintilla scintilla, IntPtr handle) : base(scintilla) { _handle = handle; } #endregion Constructors } }