// This is a generated file, modify: generate/templates/templates/class_header.h #ifndef GITCRED_H #define GITCRED_H #include #include #include #include #include #include #include "async_baton.h" #include "nodegit_wrapper.h" #include "promise_completion.h" #include "reference_counter.h" extern "C" { #include } #include "../include/typedefs.h" using namespace node; using namespace v8; class GitCred; struct GitCredTraits { typedef GitCred cppClass; typedef git_cred cType; static const bool isDuplicable = false; static void duplicate(git_cred **dest, git_cred *src) { Nan::ThrowError("duplicate called on GitCred which cannot be duplicated"); } static const bool isSingleton = false; static const bool isFreeable = true; static void free(git_cred *raw) { unsigned long referenceCount = 0; if (referenceCount == 0) { ::git_cred_free(raw); // :: to avoid calling this free recursively } } }; class GitCred : public NodeGitWrapper { // grant full access to base class friend class NodeGitWrapper; public: static void InitializeComponent (v8::Local target); private: GitCred() : NodeGitWrapper( "A new GitCred cannot be instantiated." ) {} GitCred(git_cred *raw, bool selfFreeing, v8::Local owner = v8::Local()) : NodeGitWrapper(raw, selfFreeing, owner) {} ~GitCred(); static NAN_METHOD(DefaultNew); static NAN_METHOD(GetUsername); static NAN_METHOD(HasUsername); static NAN_METHOD(SshKeyFromAgent); struct SshKeyMemoryNewBaton { int error_code; const git_error* error; git_cred * out; const char * username; const char * publickey; const char * privatekey; const char * passphrase; }; class SshKeyMemoryNewWorker : public Nan::AsyncWorker { public: SshKeyMemoryNewWorker( SshKeyMemoryNewBaton *_baton, Nan::Callback *callback ) : Nan::AsyncWorker(callback) , baton(_baton) {}; ~SshKeyMemoryNewWorker() {}; void Execute(); void HandleOKCallback(); private: SshKeyMemoryNewBaton *baton; }; static NAN_METHOD(SshKeyMemoryNew); static NAN_METHOD(SshKeyNew); struct UsernameNewBaton { int error_code; const git_error* error; git_cred * cred; const char * username; }; class UsernameNewWorker : public Nan::AsyncWorker { public: UsernameNewWorker( UsernameNewBaton *_baton, Nan::Callback *callback ) : Nan::AsyncWorker(callback) , baton(_baton) {}; ~UsernameNewWorker() {}; void Execute(); void HandleOKCallback(); private: UsernameNewBaton *baton; }; static NAN_METHOD(UsernameNew); static NAN_METHOD(UserpassPlaintextNew); }; #endif