comparison dwt/internal/mozilla/nsEmbedString.d @ 348:9a4d7706df52

Test Update to fix linux XPCOM interface issues
author John Reimer <terminal.node@gmail.com>
date Fri, 31 Oct 2008 21:46:44 -0700
parents 3f4a5c7d138f
children
comparison
equal deleted inserted replaced
347:ff6dd48f5248 348:9a4d7706df52
2 2
3 import Utf = tango.text.convert.Utf; 3 import Utf = tango.text.convert.Utf;
4 4
5 import dwt.internal.mozilla.Common; 5 import dwt.internal.mozilla.Common;
6 import dwt.internal.mozilla.nsStringAPI; 6 import dwt.internal.mozilla.nsStringAPI;
7 import XPCOM = dwt.internal.mozilla.XPCOM;
7 8
8 scope class nsEmbedString 9 scope class nsEmbedString
9 { 10 {
10 this(wchar[] s) 11 this(wchar[] s)
11 { 12 {
12 nsresult result; 13 nsresult result;
13 result = NS_StringContainerInit2(&str, s.ptr, s.length, 0); 14 result = NS_StringContainerInit2(&str, s.ptr, s.length, 0);
14 if (result != 0) // TODO: convert to XPCOM fail macro 15 if (XPCOM.NS_FAILED(result))
15 throw new Exception("Init string container fail"); 16 throw new Exception("Init string container fail");
16 } 17 }
17 18
18 this() 19 this()
19 { 20 {
20 nsresult result; 21 nsresult result;
21 result = NS_StringContainerInit(&str); 22 result = NS_StringContainerInit(&str);
22 if (result != 0) // TODO: convert to XPCOM fail macro 23 if (XPCOM.NS_FAILED(result))
23 throw new Exception("Init string container fail"); 24 throw new Exception("Init string container fail");
24 } 25 }
25 26
26 nsAString* opCast() 27 nsAString* opCast()
27 { 28 {
53 { 54 {
54 this(char[] s) 55 this(char[] s)
55 { 56 {
56 nsresult result; 57 nsresult result;
57 result = NS_CStringContainerInit2(&str, s.ptr, s.length, 0); 58 result = NS_CStringContainerInit2(&str, s.ptr, s.length, 0);
58 if (result != 0) // TODO: convert to XPCOM fail macro 59 if (XPCOM.NS_FAILED(result))
59 throw new Exception("Init string container fail"); 60 throw new Exception("Init string container fail");
60 } 61 }
61 62
62 this() 63 this()
63 { 64 {
64 nsresult result; 65 nsresult result;
65 result = NS_CStringContainerInit(&str); 66 result = NS_CStringContainerInit(&str);
66 if (result != 0) // TODO: convert to XPCOM fail macro 67 if (XPCOM.NS_FAILED(result))
67 throw new Exception("Init string container fail"); 68 throw new Exception("Init string container fail");
68 } 69 }
69 70
70 nsACString* opCast() 71 nsACString* opCast()
71 { 72 {