001/*
002 * BridJ - Dynamic and blazing-fast native interop for Java.
003 * http://bridj.googlecode.com/
004 *
005 * Copyright (c) 2010-2013, Olivier Chafik (http://ochafik.com/)
006 * All rights reserved.
007 *
008 * Redistribution and use in source and binary forms, with or without
009 * modification, are permitted provided that the following conditions are met:
010 * 
011 *     * Redistributions of source code must retain the above copyright
012 *       notice, this list of conditions and the following disclaimer.
013 *     * Redistributions in binary form must reproduce the above copyright
014 *       notice, this list of conditions and the following disclaimer in the
015 *       documentation and/or other materials provided with the distribution.
016 *     * Neither the name of Olivier Chafik nor the
017 *       names of its contributors may be used to endorse or promote products
018 *       derived from this software without specific prior written permission.
019 * 
020 * THIS SOFTWARE IS PROVIDED BY OLIVIER CHAFIK AND CONTRIBUTORS ``AS IS'' AND ANY
021 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
022 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
023 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
024 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
025 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
026 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
027 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
028 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
029 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
030 */
031/*
032 * To change this template, choose Tools | Templates
033 * and open the template in the editor.
034 */
035package org.bridj.cpp.com;
036
037import org.bridj.FlagSet;
038import org.bridj.IntValuedEnum;
039import org.bridj.ValuedEnum;
040import org.bridj.Pointer;
041import org.bridj.StructObject;
042import org.bridj.ann.Field;
043import org.bridj.ann.Virtual;
044import java.util.Collections;
045import java.util.Iterator;
046
047/**
048 *
049 * @author Olivier
050 */
051@IID("00020400-0000-0000-C000-000000000046")
052public class IDispatch extends IUnknown {
053
054    public static class DISPPARAMS extends StructObject {
055
056        @Field(0)
057        public native Pointer<VARIANT> rgvarg();
058
059        @Field(1)
060        public native Pointer<Integer> rgdispidNamedArgs();
061
062        @Field(2)
063        public native int cArgs();
064
065        @Field(3)
066        public native int cNamedArgs();
067    }
068
069    public static class EXCEPINFO extends StructObject {
070
071        @Field(0)
072        public native short wCode();
073
074        @Field(1)
075        public native short wReserved();
076
077        @Field(2)
078        public native Pointer<Character> bstrSource();
079
080        @Field(3)
081        public native Pointer<Character> bstrDescription();
082
083        @Field(4)
084        public native Pointer<Character> bstrHelpFile();
085
086        @Field(5)
087        public native int dwHelpContext();
088
089        @Field(6)
090        public native Pointer<?> pvReserved();
091
092        @Field(7)
093        public native Pointer<?> pfnDeferredFillIn();//HRESULT (__stdcall *pfnDeferredFillIn)(struct tagEXCEPINFO *);
094
095        @Field(8)
096        public native int scode();
097    }
098
099    @Virtual(0)
100    public native int GetTypeInfoCount(Pointer<Integer> pctinfo);
101
102    @Virtual(1)
103    public native int GetTypeInfo(int iTInfo, int lcid, Pointer<Pointer<ITypeInfo>> ppTInfo);
104
105    @Virtual(2)
106    public native int GetIDsOfNames(
107            Pointer riid,//REFIID riid,
108            Pointer<Pointer<Character>> rgszNames,
109            int cNames,
110            int lcid, //LCID lcid,
111            Pointer<Integer> rgDispId); //DISPID *rgDispId);
112
113    @Virtual(3)
114    public native int Invoke(
115            int dispIdMember,
116            Pointer<Byte> riid,
117            int lcid,
118            short wFlags,
119            Pointer<DISPPARAMS> pDispParams,
120            Pointer<VARIANT> pVarResult,
121            Pointer<EXCEPINFO> pExcepInfo,
122            Pointer<Integer> puArgErr);
123}