<#@ template language="C#" #> <#@ output extention=".cs" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> using System; namespace LibGit2Sharp.Core.Handles { <# var cNames = new[] { "git_tree_entry", "git_reference", "git_repository", "git_signature", "git_status_list", "git_blame", "git_diff", "git_patch", "git_config", "git_index_conflict_iterator", "git_index", "git_reflog", "git_treebuilder", "git_packbuilder", "git_note", "git_describe_result", "git_submodule", "git_annotated_commit", "git_odb", "git_revwalk", "git_remote", "git_object", "git_rebase", "git_odb_stream", "git_worktree", }; var csNames = new[] { "TreeEntryHandle", "ReferenceHandle", "RepositoryHandle", "SignatureHandle", "StatusListHandle", "BlameHandle", "DiffHandle", "PatchHandle", "ConfigurationHandle", "ConflictIteratorHandle", "IndexHandle", "ReflogHandle", "TreeBuilderHandle", "PackBuilderHandle", "NoteHandle", "DescribeResultHandle", "SubmoduleHandle", "AnnotatedCommitHandle", "ObjectDatabaseHandle", "RevWalkerHandle", "RemoteHandle", "ObjectHandle", "RebaseHandle", "OdbStreamHandle", "WorktreeHandle" }; for (var i = 0; i < cNames.Length; i++) { #> internal unsafe class <#= csNames[i] #> : Libgit2Object { internal <#= csNames[i] #>(<#= cNames[i] #> *ptr, bool owned) : base((void *) ptr, owned) { } internal <#= csNames[i] #>(IntPtr ptr, bool owned) : base(ptr, owned) { } public override void Free() { NativeMethods.<#= cNames[i] #>_free((<#= cNames[i] #>*) ptr); } public static implicit operator <#= cNames[i] #>*(<#= csNames[i] #> handle) { return (<#= cNames[i] #>*) handle.Handle; } } <# } #> }