Import 1.9b4 extra tag from cvs
[mozilla-extra.git] / extensions / mono / test / test.cpp
blobbc0a52e2bf1c85f08ec85ba418072d98594f86f3
1 #include "test.h"
2 #include <stdio.h>
4 class testimpl : public test
6 public:
7 testimpl() : mIntProp(-5) { }
8 NS_DECL_ISUPPORTS
9 NS_DECL_TEST
10 private:
11 PRInt32 mIntProp;
14 NS_IMPL_ISUPPORTS1(testimpl, test);
16 NS_IMETHODIMP
17 testimpl::Poke(const char *with)
19 fprintf(stderr, "poke: %s!\n", with);
20 return NS_OK;
23 NS_IMETHODIMP
24 testimpl::Say(const char *sayIt)
26 fprintf(stderr, "testimpl says: %s!\n", sayIt);
27 return NS_OK;
30 NS_IMETHODIMP
31 testimpl::Shout(const char *shoutIt)
33 fprintf(stderr, "testimpl shouts: %s!\n", shoutIt);
34 return NS_OK;
37 NS_IMETHODIMP
38 testimpl::Add(PRInt32 a, PRInt32 b, PRInt32 *result)
40 *result = a + b;
41 fprintf(stderr, "%d(%08x) + %d(%08x) = %d(%08x)\n", a, a, b, b,
42 *result, *result);
43 return NS_OK;
46 NS_IMETHODIMP
47 testimpl::Peek(char **retval)
49 *retval = strdup("AHOY!");
50 fprintf(stderr, "ahoy is %p @ %p\n", *retval, retval);
51 return NS_OK;
54 NS_IMETHODIMP
55 testimpl::Callback(testCallback *cb)
57 fprintf(stderr, "testCallback is %p\n", cb);
58 return cb->Call();
61 NS_IMETHODIMP
62 testimpl::GetIntProp(PRInt32 *aIntProp)
64 *aIntProp = mIntProp;
65 return NS_OK;
68 NS_IMETHODIMP
69 testimpl::SetIntProp(PRInt32 aIntProp)
71 mIntProp = aIntProp;
72 return NS_OK;
75 NS_IMETHODIMP
76 testimpl::GetRoIntProp(PRInt32 *aRoIntProp)
78 *aRoIntProp = 42;
79 return NS_OK;
82 extern "C" testimpl*
83 GetImpl(void)
85 return new testimpl;