xulrunner/examples/simple/components/src/SimpleTest.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* vim:set ts=2 sw=2 sts=2 et cin: */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #include <stdio.h>
     7 #include "nsISimpleTest.h"
     8 #include "mozilla/ModuleUtils.h"
    10 class SimpleTest : public nsISimpleTest
    11 {
    12 public:
    13   NS_DECL_ISUPPORTS
    14   NS_DECL_NSISIMPLETEST
    15 };
    17 NS_IMPL_ISUPPORTS(SimpleTest, nsISimpleTest)
    19 NS_IMETHODIMP
    20 SimpleTest::Add(int32_t a, int32_t b, int32_t *r)
    21 {
    22   printf("add(%d,%d) from C++\n", a, b);
    24   *r = a + b;
    25   return NS_OK;
    26 }
    28 NS_GENERIC_FACTORY_CONSTRUCTOR(SimpleTest)
    30 // 5e14b432-37b6-4377-923b-c987418d8429
    31 #define SIMPLETEST_CID \
    32   { 0x5e14b432, 0x37b6, 0x4377, \
    33     { 0x92, 0x3b, 0xc9, 0x87, 0x41, 0x8d, 0x84, 0x29 } }
    35 NS_DEFINE_NAMED_CID(SIMPLETEST_CID);
    37 static const mozilla::Module::CIDEntry kSimpleCIDs[] = {
    38   { &kSIMPLETEST_CID, false, nullptr, SimpleTestConstructor },
    39   { nullptr }
    40 };
    42 static const mozilla::Module::ContractIDEntry kSimpleContracts[] = {
    43   { "@test.mozilla.org/simple-test;1?impl=c++", &kSIMPLETEST_CID },
    44   { nullptr }
    45 };
    47 static const mozilla::Module kSimpleModule = {
    48   mozilla::Module::kVersion,
    49   kSimpleCIDs,
    50   kSimpleContracts
    51 };
    53 NSMODULE_DEFN(SimpleTestModule) = &kSimpleModule;

mercurial