michael@0: /* vim:set ts=2 sw=2 sts=2 et cin: */ 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: #include michael@0: #include "nsISimpleTest.h" michael@0: #include "mozilla/ModuleUtils.h" michael@0: michael@0: class SimpleTest : public nsISimpleTest michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSISIMPLETEST michael@0: }; michael@0: michael@0: NS_IMPL_ISUPPORTS(SimpleTest, nsISimpleTest) michael@0: michael@0: NS_IMETHODIMP michael@0: SimpleTest::Add(int32_t a, int32_t b, int32_t *r) michael@0: { michael@0: printf("add(%d,%d) from C++\n", a, b); michael@0: michael@0: *r = a + b; michael@0: return NS_OK; michael@0: } michael@0: michael@0: NS_GENERIC_FACTORY_CONSTRUCTOR(SimpleTest) michael@0: michael@0: // 5e14b432-37b6-4377-923b-c987418d8429 michael@0: #define SIMPLETEST_CID \ michael@0: { 0x5e14b432, 0x37b6, 0x4377, \ michael@0: { 0x92, 0x3b, 0xc9, 0x87, 0x41, 0x8d, 0x84, 0x29 } } michael@0: michael@0: NS_DEFINE_NAMED_CID(SIMPLETEST_CID); michael@0: michael@0: static const mozilla::Module::CIDEntry kSimpleCIDs[] = { michael@0: { &kSIMPLETEST_CID, false, nullptr, SimpleTestConstructor }, michael@0: { nullptr } michael@0: }; michael@0: michael@0: static const mozilla::Module::ContractIDEntry kSimpleContracts[] = { michael@0: { "@test.mozilla.org/simple-test;1?impl=c++", &kSIMPLETEST_CID }, michael@0: { nullptr } michael@0: }; michael@0: michael@0: static const mozilla::Module kSimpleModule = { michael@0: mozilla::Module::kVersion, michael@0: kSimpleCIDs, michael@0: kSimpleContracts michael@0: }; michael@0: michael@0: NSMODULE_DEFN(SimpleTestModule) = &kSimpleModule;