comparison org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal/mozilla/nsID.d @ 0:6dd524f61e62

add dwt win and basic java stuff
author Frank Benoit <benoit@tionex.de>
date Mon, 02 Mar 2009 14:44:16 +0100
parents
children 4c0057e71936
comparison
equal deleted inserted replaced
-1:000000000000 0:6dd524f61e62
1 module org.eclipse.swt.internal.mozilla.nsID;
2
3 import org.eclipse.swt.internal.mozilla.Common;
4 import java.lang.all;
5
6 align(1)
7 struct nsID
8 {
9 PRUint32 m0;
10 PRUint16 m1;
11 PRUint16 m2;
12 PRUint8[8] m3;
13
14 static nsID opCall(String aIDStr)
15 {
16 nsID id;
17 if(aIDStr == null) throw new ParseException();
18 int i = 0;
19 with(id) {
20 for (; i < 8; i++) m0 = (m0 << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16);
21 if (aIDStr.charAt (i) != '-') throw new ParseException ();
22 i++;
23 for (; i < 13; i++) m1 = cast(short)((m1 << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
24 if (aIDStr.charAt (i) != '-') throw new ParseException ();
25 i++;
26 for (; i < 18; i++) m2 = cast(short)((m2 << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
27 if (aIDStr.charAt (i) != '-') throw new ParseException ();
28 i++;
29 for (; i < 21; i++) m3[0] = cast(byte)((m3[0] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
30 for (; i < 23; i++) m3[1] = cast(byte)((m3[1] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
31 if (aIDStr.charAt (i) != '-') throw new ParseException ();
32 i++;
33 for (; i < 26; i++) m3[2] = cast(byte)((m3[2] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
34 for (; i < 28; i++) m3[3] = cast(byte)((m3[3] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
35 for (; i < 30; i++) m3[4] = cast(byte)((m3[4] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
36 for (; i < 32; i++) m3[5] = cast(byte)((m3[5] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
37 for (; i < 34; i++) m3[6] = cast(byte)((m3[6] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
38 for (; i < 36; i++) m3[7] = cast(byte)((m3[7] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
39 }
40 return id;
41 }
42
43 }
44
45 alias nsID nsCID;
46 alias nsID nsIID;