001: /*******************************************************************************
002: * Copyright (c) 2000, 2006 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.swt.internal.ole.win32;
011:
012: public class IStorage extends IUnknown {
013: public IStorage(int /*long*/address) {
014: super (address);
015: }
016:
017: public int Commit(int grfCommitFlag) {
018: return COM.VtblCall(9, address, grfCommitFlag);
019: }
020:
021: public int CopyTo(int ciidExclude, //Number of elements in rgiidExclude
022: GUID rgiidExclude, //Array of interface identifiers (IIDs)
023: String[] snbExclude, //Points to a block of stream names in the storage object
024: int /*long*/pstgDest //Points to destination storage object
025: ) {
026: // we only support snbExclude = null
027: if (snbExclude != null) {
028: return COM.E_INVALIDARG;
029: }
030: return COM.VtblCall(7, address, ciidExclude, rgiidExclude, 0,
031: pstgDest);
032: }
033:
034: public int CreateStorage(String pwcsName, //Pointer to the name of the new storage object
035: int grfMode, //Access mode for the new storage object
036: int reserved1, //Reserved; must be zero
037: int reserved2, //Reserved; must be zero
038: int /*long*/[] ppStg //Pointer to new storage object
039: ) {
040:
041: // create a null terminated array of char
042: char[] buffer = null;
043: if (pwcsName != null) {
044: buffer = (pwcsName + "\0").toCharArray();
045: }
046:
047: return COM.VtblCall(5, address, buffer, grfMode, reserved1,
048: reserved2, ppStg);
049: }
050:
051: public int CreateStream(String pwcsName, //Pointer to the name of the new stream
052: int grfMode, //Access mode for the new stream
053: int reserved1, //Reserved; must be zero
054: int reserved2, //Reserved; must be zero
055: int /*long*/[] ppStm //Pointer to new stream object
056: ) {
057:
058: // create a null terminated array of char
059: char[] buffer = null;
060: if (pwcsName != null) {
061: buffer = (pwcsName + "\0").toCharArray();
062: }
063:
064: return COM.VtblCall(3, address, buffer, grfMode, reserved1,
065: reserved2, ppStm);
066: }
067:
068: public int DestroyElement(String pwcsName) {
069:
070: // create a null terminated array of char
071: char[] buffer = null;
072: if (pwcsName != null) {
073: buffer = (pwcsName + "\0").toCharArray();
074: }
075: return COM.VtblCall(12, address, buffer);
076: }
077:
078: public int EnumElements(int reserved1, //Reserved; must be zero
079: int /*long*/reserved2, //Reserved; must be NULL
080: int reserved3, //Reserved; must be zero
081: int /*long*/[] ppenum //Pointer to output variable that
082: // receives the IEnumSTATSTG interface
083: ) {
084: return COM.VtblCall(11, address, reserved1, reserved2,
085: reserved3, ppenum);
086: }
087:
088: public int OpenStorage(String pwcsName, //Pointer to the name of the
089: // storage object to open
090: int /*long*/pstgPriority, //Must be NULL.
091: int grfMode, //Access mode for the new storage object
092: String snbExclude[], //Must be NULL.
093: int reserved, //Reserved; must be zero
094: int /*long*/[] ppStg //Pointer to opened storage object
095: ) {
096:
097: // create a null terminated array of char
098: char[] buffer = null;
099: if (pwcsName != null) {
100: buffer = (pwcsName + "\0").toCharArray();
101: }
102:
103: // we only support the case where snbExclude = null
104: if (snbExclude != null) {
105: return COM.E_INVALIDARG;
106: }
107: return COM.VtblCall(6, address, buffer, pstgPriority, grfMode,
108: 0, reserved, ppStg);
109: }
110:
111: public int OpenStream(String pwcsName, //Pointer to name of stream to open
112: int /*long*/reserved1, //Reserved; must be NULL
113: int grfMode, //Access mode for the new stream
114: int reserved2, //Reserved; must be zero
115: int /*long*/[] ppStm //Pointer to output variable
116: // that receives the IStream interface pointer
117: ) {
118:
119: // create a null terminated array of char
120: char[] buffer = null;
121: if (pwcsName != null) {
122: buffer = (pwcsName + "\0").toCharArray();
123: }
124:
125: return COM.VtblCall(4, address, buffer, reserved1, grfMode,
126: reserved2, ppStm);
127: }
128:
129: public int RenameElement(String pwcsOldName, //Pointer to the name of the
130: // element to be changed
131: String pwcsNewName //Pointer to the new name for
132: // the specified element
133: ) {
134:
135: // create a null terminated array of char
136: char[] buffer1 = null;
137: if (pwcsOldName != null) {
138: buffer1 = (pwcsOldName + "\0").toCharArray();
139: }
140: // create a null terminated array of char
141: char[] buffer2 = null;
142: if (pwcsNewName != null) {
143: buffer2 = (pwcsNewName + "\0").toCharArray();
144: }
145: return COM.VtblCall(13, address, buffer1, buffer2);
146: }
147:
148: public int Revert() {
149: return COM.VtblCall(10, address);
150: }
151:
152: public int SetClass(GUID clsid //CLSID to be assigned to the storage object
153: ) {
154: return COM.VtblCall(15, address, clsid);
155: }
156: }
|