/* Chordata - .NET File Format Parser
 * Copyright (C) 2001-2002  Jay Freeman (saurik)
*/

/*
 *        Redistribution and use in source and binary
 * forms, with or without modification, are permitted
 * provided that the following conditions are met:
 * 
 * 1. Redistributions of source code must retain the
 *    above copyright notice, this list of conditions
 *    and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the
 *    above copyright notice, this list of conditions
 *    and the following disclaimer in the documentation
 *    and/or other materials provided with the
 *    distribution.
 * 3. The name of the author may not be used to endorse
 *    or promote products derived from this software
 *    without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS''
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef CHORDATA_FLAGS_H
#define CHORDATA_FLAGS_H

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

namespace Chordata {
namespace Flags {

enum CorFieldAttr {
    fdFieldAccessMask		= 0x00000007,
    fdPrivateScope			= 0x00000000,
    fdPrivate				= 0x00000001,
    fdFamANDAssem			= 0x00000002,
    fdAssembly				= 0x00000003,
    fdFamily				= 0x00000004,
    fdFamORAssem			= 0x00000005,
    fdPublic				= 0x00000006,

    fdStatic				= 0x00000010,
    fdInitOnly				= 0x00000020,
    fdLiteral				= 0x00000040,
    fdNotSerialized			= 0x00000080,

    fdSpecialName			= 0x00000200,
    fdPinvokeImpl			= 0x00002000,

    fdReservedMask			= 0x00009500,
    fdRTSpecialName			= 0x00000400,
    fdHasFieldMarshal		= 0x00001000,
    fdHasDefault			= 0x00008000,
    fdHasFieldRVA			= 0x00000100
};

enum CorFileFlags {
	ffContainsMetaData		= 0x00000000,
	ffContainsNoMetaData	= 0x00000001
};

enum CorMethodAttr {
    mdMemberAccessMask		= 0x00000007,
    mdPrivateScope			= 0x00000000,
    mdPrivate				= 0x00000001,
    mdFamANDAssem			= 0x00000002,
    mdAssem					= 0x00000003,
    mdFamily				= 0x00000004,
    mdFamORAssem			= 0x00000005,
    mdPublic				= 0x00000006,

    mdStatic				= 0x00000010,
    mdFinal					= 0x00000020,
    mdVirtual				= 0x00000040,
    mdHideBySig				= 0x00000080,

    mdVtableLayoutMask		= 0x00000100,
    mdReuseSlot				= 0x00000000,
    mdNewSlot				= 0x00000100,

    mdAbstract				= 0x00000400,
    mdSpecialName			= 0x00000800,

    mdPinvokeImpl			= 0x00002000,
    mdUnmanagedExport		= 0x00000008,

    mdReservedMask			= 0x0000d000,
    mdRTSpecialName			= 0x00001000,
    mdHasSecurity			= 0x00004000,
    mdRequireSecObject		= 0x00008000
};

enum CorMethodImpl {
	miCodeTypeMask			= 0x00000003,
	miIL					= 0x00000000,
	miNative				= 0x00000001,
	miOPTIL					= 0x00000002,
	miRuntime				= 0x00000003,

	miManagedMask			= 0x00000004,
	miUnmanaged				= 0x00000004,
	miManaged				= 0x00000000,

	miForwardRef			= 0x00000010,
	miOLE					= 0x00000080,

	miInternalCall			= 0x00001000,

	miSynchronized			= 0x00000020,
	miNoInlining			= 0x00000008,
	miMaxMethodImplVal		= 0x0000ffff
};

enum CorParamAttr {
	pdIn					= 0x00000001,
	pdOut					= 0x00000002,
	pdOptional				= 0x00000010,

	pdReservedMask			= 0x0000f000,
	pdHasDefault			= 0x00001000,
	pdHasFieldMarshal		= 0x00002000,

	pdUnused				= 0x0000cfe0
};

enum CorPropertyAttr {
	prSpecialName			= 0x00000200,

	prReservedMask			= 0x0000f400,
	prRTSpecialName			= 0x00000400,
	prHasDefault			= 0x00001000,

    prUnused				= 0x0000e9ff
};

enum CorTypeAttr {
    tdVisibilityMask		= 0x00000007,
    tdNotPublic				= 0x00000000,
    tdPublic				= 0x00000001,
    tdNestedPublic			= 0x00000002,
    tdNestedPrivate			= 0x00000003,
    tdNestedFamily			= 0x00000004,
    tdNestedAssembly		= 0x00000005,
    tdNestedFamANDAssem		= 0x00000006,
    tdNestedFamORAssem		= 0x00000007,

    tdLayoutMask			= 0x00000018,
    tdAutoLayout			= 0x00000000,
    tdSequentialLayout		= 0x00000008,
    tdExplicitLayout		= 0x00000010,

    tdClassSemanticsMask	= 0x00000020,
    tdClass					= 0x00000000,
    tdInterface				= 0x00000020,

    tdAbstract				= 0x00000080,
    tdSealed				= 0x00000100,
    tdSpecialName			= 0x00000400,

    tdImport				= 0x00001000,
    tdSerializable			= 0x00002000,

    tdStringFormatMask		= 0x00030000,     
    tdAnsiClass				= 0x00000000,
    tdUnicodeClass			= 0x00010000,
    tdAutoClass				= 0x00020000,

    tdBeforeFieldInit		= 0x00100000,

    tdReservedMask			= 0x00040800,
    tdRTSpecialName			= 0x00000800,
    tdHasSecurity			= 0x00040000
};

namespace CallingConvention {
	enum CorCallingConvention {
		Default			= 0x0,

		VarArg			= 0x5,
		Field			= 0x6,
		LocalSignature	= 0x7,
		Property		= 0x8,
		Unmanaged		= 0x9,
		Max				= 0x10,

		Mask			= 0x0f,
		HasThis			= 0x20,
		ExplicitThis	= 0x40
	};
}

} }

#endif//CHORDATA_FLAGS_H