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.
27 * Implements the IGitWCRev interface of the COM object that GitWCRevCOM publishes.
29 class GitWCRev
: public IGitWCRev
37 // IUnknown implementation
38 virtual HRESULT __stdcall
QueryInterface(const IID
& iid
, void** ppv
) ;
39 virtual ULONG __stdcall
AddRef() ;
40 virtual ULONG __stdcall
Release() ;
42 // IDispatch implementation
43 virtual HRESULT __stdcall
GetTypeInfoCount(UINT
* pctinfo
);
44 virtual HRESULT __stdcall
GetTypeInfo(UINT itinfo
, LCID lcid
, ITypeInfo
** pptinfo
);
45 virtual HRESULT __stdcall
GetIDsOfNames(REFIID riid
, LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgdispid
);
46 virtual HRESULT __stdcall
Invoke(DISPID dispidMember
, REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pdispparams
, VARIANT
* pvarResult
, EXCEPINFO
* pexcepinfo
, UINT
* puArgErr
);
48 // IGitWCRev implementation
49 virtual HRESULT __stdcall
GetWCInfo(/*[in]*/ BSTR wcPath
, /*[in]*/VARIANT_BOOL ignore_submodules
);
51 virtual HRESULT __stdcall
get_Revision(/*[out, retval]*/VARIANT
* rev
);
53 virtual HRESULT __stdcall
get_Date(/*[out, retval]*/VARIANT
* date
);
55 virtual HRESULT __stdcall
get_Author(/*[out, retval]*/VARIANT
* author
);
57 virtual HRESULT __stdcall
get_HasModifications(/*[out, retval]*/VARIANT_BOOL
* modifications
);
59 virtual HRESULT __stdcall
get_HasUnversioned(/*[out, retval]*/VARIANT_BOOL
* unversioned
);
61 virtual HRESULT __stdcall
get_IsWcTagged(/*[out, retval]*/VARIANT_BOOL
* tagged
);
63 virtual HRESULT __stdcall
get_IsGitItem(/*[out, retval]*/VARIANT_BOOL
* versioned
);
65 virtual HRESULT __stdcall
get_IsUnborn(/*[out, retval]*/VARIANT_BOOL
* unborn
);
67 virtual HRESULT __stdcall
get_HasSubmodule(/*[out, retval]*/VARIANT_BOOL
* has_submodule
);
69 virtual HRESULT __stdcall
get_HasSubmoduleModifications(/*[out, retval]*/VARIANT_BOOL
* modifications
);
71 virtual HRESULT __stdcall
get_HasSubmoduleUnversioned(/*[out, retval]*/VARIANT_BOOL
* unversioned
);
73 virtual HRESULT __stdcall
get_IsSubmoduleUp2Date(/*[out, retval]*/VARIANT_BOOL
* up2date
);
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
);
85 LPTYPEINFO m_ptinfo
; // pointer to type-library
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
99 virtual HRESULT __stdcall
QueryInterface(const IID
& iid
, void** ppv
);
100 virtual ULONG __stdcall
AddRef();
101 virtual ULONG __stdcall
Release();
103 // Interface IClassFactory
104 virtual HRESULT __stdcall
CreateInstance(IUnknown
* pUnknownOuter
, const IID
& iid
, void** ppv
);
105 virtual HRESULT __stdcall
LockServer(BOOL bLock
);