TortoiseGitBlame: Diff shown in wrong order
[TortoiseGit.git] / src / GitWCRev / GitWCRevCOM.h
blob85647f57dbb6ed63c6bf61cedffa043fc3134a0f
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2017 - TortoiseGit
4 // Copyright (C) 2007-2008, 2010-2011, 2013 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #pragma once
22 #include <initguid.h>
23 #include "GitWCRev.h"
25 /**
26 * \ingroup GitWCRev
27 * Implements the IGitWCRev interface of the COM object that GitWCRevCOM publishes.
29 class GitWCRev : public IGitWCRev
32 // Construction
33 public:
34 GitWCRev();
35 ~GitWCRev();
37 // IUnknown implementation
38 virtual HRESULT __stdcall QueryInterface(const IID& iid, void** ppv) override;
39 virtual ULONG __stdcall AddRef() override;
40 virtual ULONG __stdcall Release() override;
42 // IDispatch implementation
43 virtual HRESULT __stdcall GetTypeInfoCount(UINT* pctinfo) override;
44 virtual HRESULT __stdcall GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo) override;
45 virtual HRESULT __stdcall GetIDsOfNames(REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid) override;
46 virtual HRESULT __stdcall Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr) override;
48 // IGitWCRev implementation
49 virtual HRESULT __stdcall GetWCInfo(/*[in]*/ BSTR wcPath, /*[in]*/VARIANT_BOOL ignore_submodules) override;
51 virtual HRESULT __stdcall get_Revision(/*[out, retval]*/VARIANT* rev) override;
53 virtual HRESULT __stdcall get_Date(/*[out, retval]*/VARIANT* date) override;
55 virtual HRESULT __stdcall get_Author(/*[out, retval]*/VARIANT* author) override;
57 virtual HRESULT __stdcall get_HasModifications(/*[out, retval]*/VARIANT_BOOL* modifications) override;
59 virtual HRESULT __stdcall get_HasUnversioned(/*[out, retval]*/VARIANT_BOOL* unversioned) override;
61 virtual HRESULT __stdcall get_IsWcTagged(/*[out, retval]*/VARIANT_BOOL* tagged) override;
63 virtual HRESULT __stdcall get_IsGitItem(/*[out, retval]*/VARIANT_BOOL* versioned) override;
65 virtual HRESULT __stdcall get_IsUnborn(/*[out, retval]*/VARIANT_BOOL* unborn) override;
67 virtual HRESULT __stdcall get_HasSubmodule(/*[out, retval]*/VARIANT_BOOL* has_submodule) override;
69 virtual HRESULT __stdcall get_HasSubmoduleModifications(/*[out, retval]*/VARIANT_BOOL* modifications) override;
71 virtual HRESULT __stdcall get_HasSubmoduleUnversioned(/*[out, retval]*/VARIANT_BOOL* unversioned) override;
73 virtual HRESULT __stdcall get_IsSubmoduleUp2Date(/*[out, retval]*/VARIANT_BOOL* up2date) override;
75 private:
76 BOOL CopyDateToString(WCHAR* destbuf, int buflen, __time64_t time);
78 HRESULT LoadTypeInfo(ITypeInfo ** pptinfo, const CLSID& libid, const CLSID& iid, LCID lcid);
79 static HRESULT BoolToVariantBool(BOOL value, VARIANT_BOOL* result);
80 static HRESULT Utf8StringToVariant(const char* string, VARIANT* result );
81 HRESULT __stdcall GetWCInfoInternal(/*[in]*/ BSTR wcPath, /*[in]*/VARIANT_BOOL ignore_submodules);
83 // Reference count
84 long m_cRef ;
85 LPTYPEINFO m_ptinfo; // pointer to type-library
87 GitWCRev_t GitStat;
90 /**
91 * \ingroup GitWCRev
92 * Implements the IClassFactory interface of the GitWCRev COM object.
93 * Used as global object only - no true reference counting in this class.
95 class CFactory : public IClassFactory
97 public:
98 // IUnknown
99 virtual HRESULT __stdcall QueryInterface(const IID& iid, void** ppv) override;
100 virtual ULONG __stdcall AddRef() override;
101 virtual ULONG __stdcall Release() override;
103 // Interface IClassFactory
104 virtual HRESULT __stdcall CreateInstance(IUnknown* pUnknownOuter, const IID& iid, void** ppv) override;
105 virtual HRESULT __stdcall LockServer(BOOL bLock) override;
107 CFactory() {}
108 ~CFactory() {}