1 module org.eclipse.swt.internal.mozilla.nsID;
2 
3 import org.eclipse.swt.internal.mozilla.Common;
4 import java.lang.all;
5 import java.text.ParseException;
6 
7 
8 struct nsID
9 {
10 align(1):
11     PRUint32 m0;
12     PRUint16 m1;
13     PRUint16 m2;
14     PRUint8[8] m3;
15 
16 	static nsID opCall(String aIDStr)
17 	{
18         nsID id;
19         if(aIDStr == null) throw new ParseException();
20         int i = 0;
21         with(id) {
22             for (; i < 8; i++) m0 = (m0 << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16);
23             if (aIDStr.charAt (i) != '-') throw new ParseException ();
24             i++;
25             for (; i < 13; i++) m1 = cast(short)((m1 << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
26             if (aIDStr.charAt (i) != '-') throw new ParseException ();
27             i++;
28             for (; i < 18; i++) m2 = cast(short)((m2 << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
29             if (aIDStr.charAt (i) != '-') throw new ParseException ();
30             i++;
31             for (; i < 21; i++) m3[0] = cast(byte)((m3[0] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
32             for (; i < 23; i++) m3[1] = cast(byte)((m3[1] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
33             if (aIDStr.charAt (i) != '-') throw new ParseException ();
34             i++;
35             for (; i < 26; i++) m3[2] = cast(byte)((m3[2] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
36             for (; i < 28; i++) m3[3] = cast(byte)((m3[3] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
37             for (; i < 30; i++) m3[4] = cast(byte)((m3[4] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
38             for (; i < 32; i++) m3[5] = cast(byte)((m3[5] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
39             for (; i < 34; i++) m3[6] = cast(byte)((m3[6] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
40             for (; i < 36; i++) m3[7] = cast(byte)((m3[7] << 4) + Integer.parseInt (aIDStr.substring (i, i + 1), 16));
41         }
42         return id;
43 	}
44 
45 }
46 
47 alias TryConst!(nsID) cnsID;
48 alias nsID  nsCID;
49 alias nsID  nsIID;
50 alias cnsID cnsCID;
51 alias cnsID cnsIID;