comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:380af2bdd8e5
1 /*******************************************************************************
2 * Copyright (c) 2007 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *
11 * Port to the D Programming language:
12 * Jacob Carlborg <jacob.carlborg@gmail.com>
13 *******************************************************************************/
14 module dwt.internal.cocoa.NSProcessInfo;
15
16 import dwt.internal.cocoa.NSArray;
17 import dwt.internal.cocoa.NSDictionary;
18 import dwt.internal.cocoa.NSInteger;
19 import dwt.internal.cocoa.NSObject;
20 import dwt.internal.cocoa.NSString;
21 import dwt.internal.cocoa.OS;
22 import objc = dwt.internal.objc.runtime;
23
24 public class NSProcessInfo : NSObject
25 {
26
27 public this ()
28 {
29 super();
30 }
31
32 public this (objc.id id)
33 {
34 super(id);
35 }
36
37 public NSUInteger activeProcessorCount ()
38 {
39 return OS.objc_msgSend(this.id, OS.sel_activeProcessorCount);
40 }
41
42 public NSArray arguments ()
43 {
44 objc.id result = OS.objc_msgSend(this.id, OS.sel_arguments);
45 return result !is null ? new NSArray(result) : null;
46 }
47
48 public NSDictionary environment ()
49 {
50 objc.id result = OS.objc_msgSend(this.id, OS.sel_environment);
51 return result !is null ? new NSDictionary(result) : null;
52 }
53
54 public NSString globallyUniqueString ()
55 {
56 objc.id result = OS.objc_msgSend(this.id, OS.sel_globallyUniqueString);
57 return result !is null ? new NSString(result) : null;
58 }
59
60 public NSString hostName ()
61 {
62 objc.id result = OS.objc_msgSend(this.id, OS.sel_hostName);
63 return result !is null ? new NSString(result) : null;
64 }
65
66 public uint operatingSystem ()
67 {
68 return cast(uint) OS.objc_msgSend(this.id, OS.sel_operatingSystem);
69 }
70
71 public NSString operatingSystemName ()
72 {
73 objc.id result = OS.objc_msgSend(this.id, OS.sel_operatingSystemName);
74 return result !is null ? new NSString(result) : null;
75 }
76
77 public NSString operatingSystemVersionString ()
78 {
79 objc.id result = OS.objc_msgSend(this.id, OS.sel_operatingSystemVersionString);
80 return result !is null ? new NSString(result) : null;
81 }
82
83 public ulong physicalMemory ()
84 {
85 return cast(ulong) OS.objc_msgSend(this.id, OS.sel_physicalMemory);
86 }
87
88 public int processIdentifier ()
89 {
90 return cast(int) OS.objc_msgSend(this.id, OS.sel_processIdentifier);
91 }
92
93 public static NSProcessInfo processInfo ()
94 {
95 objc.id result = OS.objc_msgSend(OS.class_NSProcessInfo, OS.sel_processInfo);
96 return result !is null ? new NSProcessInfo(result) : null;
97 }
98
99 public NSString processName ()
100 {
101 objc.id result = OS.objc_msgSend(this.id, OS.sel_processName);
102 return result !is null ? new NSString(result) : null;
103 }
104
105 public NSUInteger processorCount ()
106 {
107 return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_processorCount);
108 }
109
110 public void setProcessName (NSString newName)
111 {
112 OS.objc_msgSend(this.id, OS.sel_setProcessName_1, newName !is null ? newName.id : null);
113 }
114
115 }