michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_GenericFactory_h michael@0: #define mozilla_GenericFactory_h michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: #include "mozilla/Module.h" michael@0: michael@0: namespace mozilla { michael@0: michael@0: /** michael@0: * A generic factory which uses a constructor function to create instances. michael@0: * This class is intended for use by the component manager and the generic michael@0: * module. michael@0: */ michael@0: class GenericFactory MOZ_FINAL : public nsIFactory michael@0: { michael@0: public: michael@0: typedef Module::ConstructorProcPtr ConstructorProcPtr; michael@0: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSIFACTORY michael@0: michael@0: GenericFactory(ConstructorProcPtr ctor) michael@0: : mCtor(ctor) michael@0: { michael@0: NS_ASSERTION(mCtor, "GenericFactory with no constructor"); michael@0: } michael@0: michael@0: private: michael@0: ConstructorProcPtr mCtor; michael@0: }; michael@0: michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_GenericFactory_h