diff dwt/internal/cocoa/NSProcessInfo.d @ 0:380af2bdd8e5

Upload of whole dwt tree
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Sat, 09 Aug 2008 17:00:02 +0200
parents
children 8b48be5454ce
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/cocoa/NSProcessInfo.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ * Port to the D Programming language:
+ *     Jacob Carlborg <jacob.carlborg@gmail.com>
+ *******************************************************************************/
+module dwt.internal.cocoa.NSProcessInfo;
+
+import dwt.internal.cocoa.NSArray;
+import dwt.internal.cocoa.NSDictionary;
+import dwt.internal.cocoa.NSInteger;
+import dwt.internal.cocoa.NSObject;
+import dwt.internal.cocoa.NSString;
+import dwt.internal.cocoa.OS;
+import objc = dwt.internal.objc.runtime;
+
+public class NSProcessInfo : NSObject
+{
+
+    public this ()
+    {
+        super();
+    }
+
+    public this (objc.id id)
+    {
+        super(id);
+    }
+
+    public NSUInteger activeProcessorCount ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_activeProcessorCount);
+    }
+
+    public NSArray arguments ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_arguments);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public NSDictionary environment ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_environment);
+        return result !is null ? new NSDictionary(result) : null;
+    }
+
+    public NSString globallyUniqueString ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_globallyUniqueString);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSString hostName ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_hostName);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public uint operatingSystem ()
+    {
+        return  cast(uint) OS.objc_msgSend(this.id, OS.sel_operatingSystem);
+    }
+
+    public NSString operatingSystemName ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_operatingSystemName);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSString operatingSystemVersionString ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_operatingSystemVersionString);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public ulong physicalMemory ()
+    {
+        return cast(ulong) OS.objc_msgSend(this.id, OS.sel_physicalMemory);
+    }
+
+    public int processIdentifier ()
+    {
+        return cast(int) OS.objc_msgSend(this.id, OS.sel_processIdentifier);
+    }
+
+    public static NSProcessInfo processInfo ()
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSProcessInfo, OS.sel_processInfo);
+        return result !is null ? new NSProcessInfo(result) : null;
+    }
+
+    public NSString processName ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_processName);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSUInteger processorCount ()
+    {
+        return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_processorCount);
+    }
+
+    public void setProcessName (NSString newName)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setProcessName_1, newName !is null ? newName.id : null);
+    }
+
+}