1 | /* |
2 | * $Id: PROPPAGEINFO.java,v 1.1 2006/03/01 19:21:27 hastings Exp $ |
3 | * |
4 | * (c) Copyright, Moebius Solutions, Inc., 2004 |
5 | * |
6 | * All Rights Reserved |
7 | * |
8 | * This material may be reproduced by or for the U. S. Government |
9 | * pursuant to the copyright license under the clause at |
10 | * DFARS 252.227-7014 (OCT 2001). |
11 | */ |
12 | package com.moesol.bindings.platform_sdk.component_services; |
13 | |
14 | import com.moesol.bindings.platform_sdk.windows_api.SIZE; |
15 | |
16 | /** |
17 | * * <code>IDL: [ helpstring(""), ]<br/> |
18 | * struct/union</code> |
19 | */ |
20 | public class PROPPAGEINFO extends com.moesol.bindings.NativeStructure { |
21 | public static final com.moesol.bindings.platform_sdk.component_services.GUID UUID = new com.moesol.bindings.platform_sdk.component_services.GUID( |
22 | 0x00000000, (short)0x0000, (short)0x0000, |
23 | new byte[] { |
24 | (byte)0x00, (byte)0x00, |
25 | (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 |
26 | } ); |
27 | /** |
28 | * Create a new instance. |
29 | */ |
30 | public PROPPAGEINFO() { |
31 | super(new byte[sizeof()]); |
32 | } |
33 | /** |
34 | * Create a new instance on a byte buffer. |
35 | */ |
36 | public PROPPAGEINFO(java.nio.ByteBuffer bb) { |
37 | super(bb); |
38 | // set limit based on the dynamic size in byte in bb. |
39 | bb.limit(getDynamicSize()); |
40 | } |
41 | public static int sizeof() { |
42 | return 28; |
43 | } |
44 | |
45 | /** |
46 | * Represent a native array of these structures |
47 | */ |
48 | public static class Array extends com.moesol.bindings.NativeArrayOfStructs { |
49 | public Array(java.nio.ByteBuffer bb) { |
50 | super(bb); |
51 | } |
52 | public PROPPAGEINFO get(int index) { |
53 | return new PROPPAGEINFO(getElementSlice(index, PROPPAGEINFO.sizeof())); |
54 | } |
55 | public void put(int index, PROPPAGEINFO value) { |
56 | get(index).putStruct(0, PROPPAGEINFO.sizeof(), value); |
57 | } |
58 | public int length() { |
59 | return _getByteBuffer().limit() / PROPPAGEINFO.sizeof(); |
60 | } |
61 | public int getDynamicSize() { |
62 | return _getByteBuffer().limit(); |
63 | } |
64 | public String toString() { |
65 | StringBuffer sb = new StringBuffer(); |
66 | for (int i = 0; i < length(); i++) { |
67 | sb.append(get(i)); |
68 | } |
69 | return sb.toString(); |
70 | } |
71 | } |
72 | |
73 | |
74 | |
75 | public static final int OFFSET_cb = 0; |
76 | /** |
77 | * |
78 | * @param v new cb value |
79 | */ |
80 | public void set_cb(long v) { |
81 | putUnsignedInt(0, v); |
82 | } |
83 | /** |
84 | * |
85 | * @return cb value |
86 | */ |
87 | public long get_cb() { |
88 | return getUnsignedInt(0); |
89 | } |
90 | |
91 | public static final int OFFSET_pszTitle = 4; |
92 | /** |
93 | * |
94 | * @param v new pszTitle value |
95 | */ |
96 | public void set_pszTitle(String v) { |
97 | putLpwstr(4, v); |
98 | } |
99 | /** |
100 | * |
101 | * @return pszTitle value |
102 | */ |
103 | public String get_pszTitle() { |
104 | return getLpwstr(4); |
105 | } |
106 | |
107 | public static final int OFFSET_SIZE = 8; |
108 | /** |
109 | * |
110 | * @param v new SIZE value |
111 | */ |
112 | public void set_SIZE(SIZE v) { |
113 | putStruct(8, 8, v); |
114 | } |
115 | /** |
116 | * |
117 | * @return SIZE value |
118 | */ |
119 | public SIZE get_SIZE() { |
120 | // We expect the ctor to constrain the byte buffer based on its dynamic size. |
121 | return new SIZE( getRemaining(8) ); |
122 | } |
123 | |
124 | public static final int OFFSET_pszDocString = 16; |
125 | /** |
126 | * |
127 | * @param v new pszDocString value |
128 | */ |
129 | public void set_pszDocString(String v) { |
130 | putLpwstr(16, v); |
131 | } |
132 | /** |
133 | * |
134 | * @return pszDocString value |
135 | */ |
136 | public String get_pszDocString() { |
137 | return getLpwstr(16); |
138 | } |
139 | |
140 | public static final int OFFSET_pszHelpFile = 20; |
141 | /** |
142 | * |
143 | * @param v new pszHelpFile value |
144 | */ |
145 | public void set_pszHelpFile(String v) { |
146 | putLpwstr(20, v); |
147 | } |
148 | /** |
149 | * |
150 | * @return pszHelpFile value |
151 | */ |
152 | public String get_pszHelpFile() { |
153 | return getLpwstr(20); |
154 | } |
155 | |
156 | public static final int OFFSET_dwHelpContext = 24; |
157 | /** |
158 | * |
159 | * @param v new dwHelpContext value |
160 | */ |
161 | public void set_dwHelpContext(long v) { |
162 | putUnsignedInt(24, v); |
163 | } |
164 | /** |
165 | * |
166 | * @return dwHelpContext value |
167 | */ |
168 | public long get_dwHelpContext() { |
169 | return getUnsignedInt(24); |
170 | } |
171 | |
172 | /** |
173 | * Get dynamic size in bytes. |
174 | * If this structure contains a variable size array, |
175 | * return the number of bytes needed to hold the fixed |
176 | * part and the variable sized array based on the [length_is()] |
177 | * attribute. Note that the sizeof method on returns the |
178 | * size of the fixed part plus the size of one array entry. |
179 | * |
180 | * @return dynamic size in bytes. |
181 | */ |
182 | public int getDynamicSize() { |
183 | return sizeof(); |
184 | } |
185 | |
186 | public String toString() { |
187 | StringBuffer sb = new StringBuffer(); |
188 | sb.append("\nPROPPAGEINFO("); |
189 | sb.append("cb("); |
190 | sb.append(get_cb()); |
191 | sb.append(")"); |
192 | |
193 | sb.append("pszTitle("); |
194 | sb.append(get_pszTitle()); |
195 | sb.append(")"); |
196 | |
197 | sb.append("SIZE("); |
198 | sb.append(get_SIZE()); |
199 | sb.append(")"); |
200 | |
201 | sb.append("pszDocString("); |
202 | sb.append(get_pszDocString()); |
203 | sb.append(")"); |
204 | |
205 | sb.append("pszHelpFile("); |
206 | sb.append(get_pszHelpFile()); |
207 | sb.append(")"); |
208 | |
209 | sb.append("dwHelpContext("); |
210 | sb.append(get_dwHelpContext()); |
211 | sb.append(")"); |
212 | |
213 | sb.append(')'); |
214 | return sb.toString(); |
215 | } |
216 | |
217 | protected void finalize() { |
218 | clearRecord(); |
219 | } |
220 | |
221 | /** |
222 | * Free the contained LPWSTR strings. We cannot rely on NativeStructure's |
223 | * default implementation of clearRecord because it uses type information to |
224 | * free nested BSTRs, SAFEARRAYs, etc. However, it does not currently |
225 | * support nested LPWSTR fields. If we call super.clearRecord we would |
226 | * get a COMException. |
227 | */ |
228 | public void clearRecord() { |
229 | freeLpwstr(OFFSET_pszDocString); |
230 | freeLpwstr(OFFSET_pszHelpFile); |
231 | freeLpwstr(OFFSET_pszTitle); |
232 | } |
233 | } |