diff options
author | Matt A. Tobin <email@mattatobin.com> | 2019-12-16 20:09:38 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2019-12-16 20:09:38 -0500 |
commit | e2de507e0261c9b138cd3cf5356c21eca3e7a28d (patch) | |
tree | f32816881d4f8512d42ece948a41ae21c977c633 /xulrunner/examples/simple/components/src/SimpleTest.cpp | |
parent | 06494f307850c576868831bd28a61464eab1f359 (diff) | |
download | UXP-e2de507e0261c9b138cd3cf5356c21eca3e7a28d.tar UXP-e2de507e0261c9b138cd3cf5356c21eca3e7a28d.tar.gz UXP-e2de507e0261c9b138cd3cf5356c21eca3e7a28d.tar.lz UXP-e2de507e0261c9b138cd3cf5356c21eca3e7a28d.tar.xz UXP-e2de507e0261c9b138cd3cf5356c21eca3e7a28d.zip |
Issue #1323 - Move XULRunner back to topsrcdir
Diffstat (limited to 'xulrunner/examples/simple/components/src/SimpleTest.cpp')
-rw-r--r-- | xulrunner/examples/simple/components/src/SimpleTest.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/xulrunner/examples/simple/components/src/SimpleTest.cpp b/xulrunner/examples/simple/components/src/SimpleTest.cpp new file mode 100644 index 000000000..06249abdd --- /dev/null +++ b/xulrunner/examples/simple/components/src/SimpleTest.cpp @@ -0,0 +1,54 @@ +/* vim:set ts=2 sw=2 sts=2 et cin: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include <stdio.h> +#include "nsISimpleTest.h" +#include "mozilla/ModuleUtils.h" + +class SimpleTest : public nsISimpleTest +{ + ~SimpleTest() {} +public: + NS_DECL_ISUPPORTS + NS_DECL_NSISIMPLETEST +}; + +NS_IMPL_ISUPPORTS(SimpleTest, nsISimpleTest) + +NS_IMETHODIMP +SimpleTest::Add(int32_t a, int32_t b, int32_t *r) +{ + printf("add(%d,%d) from C++\n", a, b); + + *r = a + b; + return NS_OK; +} + +NS_GENERIC_FACTORY_CONSTRUCTOR(SimpleTest) + +// 5e14b432-37b6-4377-923b-c987418d8429 +#define SIMPLETEST_CID \ + { 0x5e14b432, 0x37b6, 0x4377, \ + { 0x92, 0x3b, 0xc9, 0x87, 0x41, 0x8d, 0x84, 0x29 } } + +NS_DEFINE_NAMED_CID(SIMPLETEST_CID); + +static const mozilla::Module::CIDEntry kSimpleCIDs[] = { + { &kSIMPLETEST_CID, false, nullptr, SimpleTestConstructor }, + { nullptr } +}; + +static const mozilla::Module::ContractIDEntry kSimpleContracts[] = { + { "@test.mozilla.org/simple-test;1?impl=c++", &kSIMPLETEST_CID }, + { nullptr } +}; + +static const mozilla::Module kSimpleModule = { + mozilla::Module::kVersion, + kSimpleCIDs, + kSimpleContracts +}; + +NSMODULE_DEFN(SimpleTestModule) = &kSimpleModule; |