Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Gayed2010-09-17 17:57:29 +0000
committerGrant Gayed2010-09-17 17:57:29 +0000
commit1065415e239507fa887cbb82c3592b58b83f4023 (patch)
tree30f973047f2bf907749022ce50b889ea0ed0fea4 /bundles/org.eclipse.swt/Eclipse SWT PI/win32/org
parent75c6b52912768f207a601dbff89c84ba81f942a4 (diff)
downloadeclipse.platform.swt-1065415e239507fa887cbb82c3592b58b83f4023.tar.gz
eclipse.platform.swt-1065415e239507fa887cbb82c3592b58b83f4023.tar.xz
eclipse.platform.swt-1065415e239507fa887cbb82c3592b58b83f4023.zip
add toString()
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI/win32/org')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/GUID.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/GUID.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/GUID.java
index 8a4c3017f9..1c9349f742 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/GUID.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/GUID.java
@@ -16,4 +16,24 @@ public final class GUID {
public short Data3;
public byte[] Data4 = new byte[8];
public static final int sizeof = COM.GUID_sizeof ();
+
+ static final String zeros = "00000000"; //$NON-NLS-1$
+
+static String toHex (int v, int length) {
+ String t = Integer.toHexString (v).toUpperCase ();
+ int tlen = t.length ();
+ if (tlen > length) {
+ t = t.substring (tlen - length);
+ }
+ return zeros.substring (0, Math.max (0, length - tlen)) + t;
+}
+
+public String toString () {
+ return '{' + toHex (Data1, 8) + '-' +
+ toHex (Data2, 4) + '-' +
+ toHex (Data3, 4) + '-' +
+ toHex (Data4[0], 2) + toHex (Data4[1], 2) + '-' +
+ toHex (Data4[2], 2) + toHex (Data4[3], 2) + toHex (Data4[4], 2) + toHex (Data4[5], 2) + toHex (Data4[6], 2) + toHex (Data4[7], 2) + '}';
+}
+
}

Back to the top