Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/passthroughapp/ProtocolCF.h

Issue 29332980: Issue #1484 - Use the currently distributed version of PassthroughAPP unaltered
Patch Set: use OnStartEx() instead of OnStart() Created Dec. 23, 2015, 3:18 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2007 Igor Tandetnik
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #ifndef PASSTHROUGHAPP_PROTOCOLCF_H 1 #ifndef PASSTHROUGHAPP_PROTOCOLCF_H
16 #define PASSTHROUGHAPP_PROTOCOLCF_H 2 #define PASSTHROUGHAPP_PROTOCOLCF_H
17 3
18 #if _MSC_VER > 1000 4 #if _MSC_VER > 1000
19 #pragma once 5 #pragma once
20 #endif // _MSC_VER > 1000 6 #endif // _MSC_VER > 1000
21 7
22 namespace PassthroughAPP 8 namespace PassthroughAPP
23 { 9 {
24 10
25 namespace Detail 11 namespace Detail
26 { 12 {
27 // A bit of template metaprogramming allows to avoid requiring 13 // A bit of template metaprogramming allows to avoid requiring
28 // the protocol class to either derive from CComCoClass or explicitly 14 // the protocol class to either derive from CComCoClass or explicitly
29 // specify DECLARE_*AGGREGATABLE macro. If the class does it, the declared 15 // specify DECLARE_*AGGREGATABLE macro. If the class does it, the declared
30 // behavior is used, otherwise the default behavior is as if 16 // behavior is used, otherwise the default behavior is as if
31 // DECLARE_AGGREGATABLE is specified 17 // DECLARE_AGGREGATABLE is specified
32 18
33 // If T has a typedef _CreatorClass, Derived would pick it from its base. 19 // If T has a typedef _CreatorClass, Derived would pick it from its base.
34 // If T does not define _CreatorClass, the definition is picked from the nex t 20 // If T does not define _CreatorClass, the definition is picked from the next
35 // enclosing scope, which is ChooseCreatorClass::_CreatorClass, or Default 21 // enclosing scope, which is ChooseCreatorClass::_CreatorClass, or Default
36 template <typename T, typename Default> 22 template <typename T, typename Default>
37 struct ChooseCreatorClass 23 struct ChooseCreatorClass
38 { 24 {
39 typedef Default _CreatorClass; 25 » typedef Default _CreatorClass;
40 struct Derived : private T 26 » struct Derived : private T
41 { 27 » {
42 typedef _CreatorClass CreatorClass; 28 » » typedef _CreatorClass CreatorClass;
43 }; 29 » };
44 typedef typename Derived::CreatorClass CreatorClass; 30 » typedef typename Derived::CreatorClass CreatorClass;
45 }; 31 };
46 32
47 } // end namespace PassthroughAPP::Detail 33 } // end namespace PassthroughAPP::Detail
48 34
49 class ATL_NO_VTABLE CComClassFactoryProtocol : 35 class ATL_NO_VTABLE CComClassFactoryProtocol :
50 public CComClassFactory 36 » public CComClassFactory
51 { 37 {
52 typedef CComClassFactory BaseClass; 38 » typedef CComClassFactory BaseClass;
53 public: 39 public:
54 STDMETHODIMP CreateInstance(IUnknown* punkOuter, REFIID riid, 40 » STDMETHODIMP CreateInstance(IUnknown* punkOuter, REFIID riid,
55 void** ppvObj); 41 » » void** ppvObj);
56 42
57 HRESULT CreateInstanceTarget(IUnknown** ppTargetProtocol); 43 » HRESULT CreateInstanceTarget(IUnknown** ppTargetProtocol);
58 44
59 HRESULT GetTargetClassFactory(IClassFactory** ppCF); 45 » HRESULT GetTargetClassFactory(IClassFactory** ppCF);
60 HRESULT SetTargetClassFactory(IClassFactory* pCF); 46 » HRESULT SetTargetClassFactory(IClassFactory* pCF);
61 HRESULT SetTargetCLSID(REFCLSID clsid, DWORD clsContext = CLSCTX_ALL); 47 » HRESULT SetTargetCLSID(REFCLSID clsid, DWORD clsContext = CLSCTX_ALL);
62 48
63 void FinalRelease(); 49 » void FinalRelease();
64 private: 50 private:
65 CComPtr<IClassFactory> m_spTargetCF; 51 » CComPtr<IClassFactory> m_spTargetCF;
66 }; 52 };
67 53
68 template <class Factory, class Protocol, 54 template <class Factory, class Protocol,
69 class FactoryComObject = CComObjectNoLock<Factory> > 55 » class FactoryComObject = CComObjectNoLock<Factory> >
70 struct CMetaFactory 56 struct CMetaFactory
71 { 57 {
72 typedef 58 » typedef
73 CComCreator2<CComCreator<CComObject<Protocol> >, 59 » » CComCreator2<CComCreator<CComObject<Protocol> >,
74 CComCreator<CComAggObject<Protocol> > > 60 » » » CComCreator<CComAggObject<Protocol> > >
75 DefaultCreatorClass; 61 » DefaultCreatorClass;
76 62
77 typedef typename 63 » typedef typename
78 Detail::ChooseCreatorClass<Protocol, DefaultCreatorClass>::CreatorClass 64 » » Detail::ChooseCreatorClass<Protocol, DefaultCreatorClass>::Creat orClass
79 CreatorClass; 65 » » » CreatorClass;
80 66
81 // returns a non-AddRef'ed pointer to FactoryComObject, already initialized 67 » // returns a non-AddRef'ed pointer to FactoryComObject, already initiali zed
82 // with Protocol's creator function, via ppObj [out] parameter 68 » // with Protocol's creator function, via ppObj [out] parameter
83 static HRESULT CreateInstance(Factory** ppObj); 69 » static HRESULT CreateInstance(Factory** ppObj);
84 70
85 static HRESULT CreateInstance(IClassFactory* pTargetCF, 71 » static HRESULT CreateInstance(IClassFactory* pTargetCF,
86 IClassFactory** ppCF); 72 » » IClassFactory** ppCF);
87 static HRESULT CreateInstance(REFCLSID clsidTarget, IClassFactory** ppCF); 73 » static HRESULT CreateInstance(REFCLSID clsidTarget, IClassFactory** ppCF );
88 }; 74 };
89 75
90 } // end namespace PassthroughAPP 76 } // end namespace PassthroughAPP
91 77
92 #include "ProtocolCF.inl" 78 #include "ProtocolCF.inl"
93 79
94 #endif // PASSTHROUGHAPP_PROTOCOLCF_H 80 #endif // PASSTHROUGHAPP_PROTOCOLCF_H
OLDNEW

Powered by Google App Engine
This is Rietveld