1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef CLASSFACTORY_HXX_INCLUDED 25 #define CLASSFACTORY_HXX_INCLUDED 26 27 #if defined _MSC_VER 28 #pragma warning(push, 1) 29 #endif 30 #include <objidl.h> 31 #if defined _MSC_VER 32 #pragma warning(pop) 33 #endif 34 35 class CClassFactory : public IClassFactory 36 { 37 public: 38 CClassFactory(const CLSID& clsid); 39 virtual ~CClassFactory(); 40 41 //----------------------------- 42 // IUnknown methods 43 //----------------------------- 44 45 virtual HRESULT STDMETHODCALLTYPE QueryInterface( 46 REFIID riid, 47 void __RPC_FAR *__RPC_FAR *ppvObject); 48 49 virtual ULONG STDMETHODCALLTYPE AddRef(void); 50 51 virtual ULONG STDMETHODCALLTYPE Release(void); 52 53 //----------------------------- 54 // IClassFactory methods 55 //----------------------------- 56 57 virtual HRESULT STDMETHODCALLTYPE CreateInstance( 58 IUnknown __RPC_FAR *pUnkOuter, 59 REFIID riid, 60 void __RPC_FAR *__RPC_FAR *ppvObject); 61 62 virtual HRESULT STDMETHODCALLTYPE LockServer(BOOL fLock); 63 64 static bool IsLocked(); 65 66 private: 67 long m_RefCnt; 68 CLSID m_Clsid; 69 70 static long s_ServerLocks; 71 }; 72 73 #endif 74 75 /* vim: set noet sw=4 ts=4: */ 76