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 */
031package org.bridj.cpp.com;
032
033import java.util.Collections;
034import java.util.Iterator;
035import org.bridj.BridJ;
036import org.bridj.FlagSet;
037import org.bridj.IntValuedEnum;
038import org.bridj.ValuedEnum;
039
040public enum VARENUM implements IntValuedEnum<VARENUM> {
041
042    VT_EMPTY(0),
043    VT_NULL(1),
044    VT_I2(2),
045    VT_I4(3),
046    VT_R4(4),
047    VT_R8(5),
048    VT_CY(6),
049    VT_DATE(7),
050    VT_BSTR(8),
051    VT_DISPATCH(9),
052    VT_ERROR(10),
053    VT_BOOL(11),
054    VT_VARIANT(12),
055    VT_UNKNOWN(13),
056    VT_DECIMAL(14),
057    VT_I1(16),
058    VT_UI1(17),
059    VT_UI2(18),
060    VT_UI4(19),
061    VT_I8(20),
062    VT_UI8(21),
063    VT_INT(22),
064    VT_UINT(23),
065    VT_VOID(24),
066    VT_HRESULT(25),
067    VT_PTR(26),
068    VT_SAFEARRAY(27),
069    VT_CARRAY(28),
070    VT_USERDEFINED(29),
071    VT_LPSTR(30),
072    VT_LPWSTR(31),
073    VT_FILETIME(64),
074    VT_BLOB(65),
075    VT_STREAM(66),
076    VT_STORAGE(67),
077    VT_STREAMED_OBJECT(68),
078    VT_STORED_OBJECT(69),
079    VT_BLOB_OBJECT(70),
080    VT_CF(71),
081    VT_CLSID(72),
082    VT_VECTOR(0x1000),
083    VT_ARRAY(0x2000),
084    VT_BYREF(0x4000),
085    VT_RESERVED(0x8000),
086    VT_ILLEGAL(0xFFFF),
087    VT_ILLEGALMASKED(0xFFF),
088    VT_TYPEMASK(0xFFF);
089
090    VARENUM(long value) {
091        this.value = value;
092    }
093    public final long value;
094
095    public long value() {
096        return this.value;
097    }
098
099    public Iterator<VARENUM> iterator() {
100        return Collections.singleton(this).iterator();
101    }
102
103    public static ValuedEnum<VARENUM> fromValue(long value) {
104        return FlagSet.fromValue(value, values());
105    }
106};