// Path: src/main/java/com/github/danfickle/cpptojavasourceconverter/TypeManager.java
// enum NameType
// {
// 	CAPITALIZED,
// 	CAMEL_CASE,
// 	ALL_CAPS;
// }
// 
// Path: src/main/java/com/github/danfickle/cpptojavasourceconverter/TypeManager.java
// enum TypeType
// {
// 	INTERFACE,
// 	IMPLEMENTATION,
// 	RAW;
// }
// 
// Path: src/main/java/com/github/danfickle/cpptojavasourceconverter/models/DeclarationModels.java
// public class CppBitfield extends CppDeclaration
// {
// 	public String qualified;
// 	public String type;
// 	public MExpression bits;
// 		
// 	@Override
// 	public String toString() 
// 	{
// 		/*
// 		int gettest_with_bit_field()
// 		{
//    			return bitfields & 1
// 		}
// 
// 		int settest_with_bit_field(final int val)
// 		{
//    			bitfields &= ~1;
//    			bitfields |= (val << 0) & 1;
//    			return val;
// 		}
// 
// 		int postInctest_with_bit_field()
// 		{
//    			int ret = gettest_with_bit_field();
//    			settest_with_bit_field(ret + 1)
// 		}
// 
// 		int postDectest_with_bit_field()
// 		{
//    			int ret = gettest_with_bit_field();
//    			settest_with_bit_field(ret - 1)
// 		}
// 		*/
// 			
// 		StringBuilder sb = new StringBuilder();
// 			
// 		sb.append(String.format("\n%s%s get%s()", tabOut(), this.type, this.name));
// 		sb.append(String.format("\n%s{", tabOut()));
// 		sb.append(String.format("\n%sreturn bitfields & 1", tabOut(1)));
// 		sb.append(String.format("\n%s}", tabOut()));
// 			
// 		sb.append(String.format("\n\n%s%s set%s(final %s val)", tabOut(), this.type, this.name, this.type));
// 		sb.append(String.format("\n%s{", tabOut()));
// 		sb.append(String.format("\n%sbitfields &= ~1;", tabOut(1)));
// 		sb.append(String.format("\n%sbitfields |= (val << 0) & 1;", tabOut(1)));
// 		sb.append(String.format("\n%sreturn val;", tabOut(1)));
// 		sb.append(String.format("\n%s}", tabOut()));
// 			
// 		sb.append(String.format("\n\n%s%s postInc%s()", tabOut(), this.type, this.name));
// 		sb.append(String.format("\n%s{", tabOut()));
// 		sb.append(String.format("\n%sint ret = get%s();", tabOut(1), this.name));
// 		sb.append(String.format("\n%sset%s(ret + 1)", tabOut(1), this.name));
// 		sb.append(String.format("\n%s}", tabOut()));			
// 
// 		sb.append(String.format("\n\n%s%s postDec%s()", tabOut(), this.type, this.name));
// 		sb.append(String.format("\n%s{", tabOut()));
// 		sb.append(String.format("\n%sint ret = get%s();", tabOut(1), this.name));
// 		sb.append(String.format("\n%sset%s(ret - 1)", tabOut(1), this.name));
// 		sb.append(String.format("\n%s}", tabOut()));			
// 
// 		return sb.toString();
// 	}
// }


import org.eclipse.cdt.core.dom.ast.*;
import com.github.danfickle.cpptojavasourceconverter.TypeManager.NameType;
import com.github.danfickle.cpptojavasourceconverter.TypeManager.TypeType;
import com.github.danfickle.cpptojavasourceconverter.models.DeclarationModels.CppBitfield;
package com.github.danfickle.cpptojavasourceconverter;



public class BitfieldManager
{
	private TranslationUnitContext ctx;
	
	BitfieldManager(TranslationUnitContext con) {
		ctx = con;
	}

	boolean isBitfield(IASTName name) throws DOMException
	{
		String complete = TypeManager.getCompleteName(name);
		return ctx.global.bitfields.contains(complete);
	}
	
	void addBitfield(IASTName name) throws DOMException
	{
		String complete = TypeManager.getCompleteName(name);
		ctx.global.bitfields.add(complete);
	}
	
	boolean isBitfield(IASTExpression expr) throws DOMException
	{
		expr = ExpressionHelpers.unwrap(expr);
		
		if (expr instanceof IASTIdExpression &&
			isBitfield(((IASTIdExpression) expr).getName()))
			return true;
		
		if (expr instanceof IASTFieldReference &&
			isBitfield(((IASTFieldReference) expr).getFieldName()))
			return true;
		
		return false;
	}
	
	void evalDeclBitfield(IField field, IASTDeclarator declarator) throws DOMException
	{
// Path: src/main/java/com/github/danfickle/cpptojavasourceconverter/TypeManager.java
// enum NameType
// {
// 	CAPITALIZED,
// 	CAMEL_CASE,
// 	ALL_CAPS;
// }
// 
// Path: src/main/java/com/github/danfickle/cpptojavasourceconverter/TypeManager.java
// enum TypeType
// {
// 	INTERFACE,
// 	IMPLEMENTATION,
// 	RAW;
// }
// 
// Path: src/main/java/com/github/danfickle/cpptojavasourceconverter/models/DeclarationModels.java
// public class CppBitfield extends CppDeclaration
// {
// 	public String qualified;
// 	public String type;
// 	public MExpression bits;
// 		
// 	@Override
// 	public String toString() 
// 	{
// 		/*
// 		int gettest_with_bit_field()
// 		{
//    			return bitfields & 1
// 		}
// 
// 		int settest_with_bit_field(final int val)
// 		{
//    			bitfields &= ~1;
//    			bitfields |= (val << 0) & 1;
//    			return val;
// 		}
// 
// 		int postInctest_with_bit_field()
// 		{
//    			int ret = gettest_with_bit_field();
//    			settest_with_bit_field(ret + 1)
// 		}
// 
// 		int postDectest_with_bit_field()
// 		{
//    			int ret = gettest_with_bit_field();
//    			settest_with_bit_field(ret - 1)
// 		}
// 		*/
// 			
// 		StringBuilder sb = new StringBuilder();
// 			
// 		sb.append(String.format("\n%s%s get%s()", tabOut(), this.type, this.name));
// 		sb.append(String.format("\n%s{", tabOut()));
// 		sb.append(String.format("\n%sreturn bitfields & 1", tabOut(1)));
// 		sb.append(String.format("\n%s}", tabOut()));
// 			
// 		sb.append(String.format("\n\n%s%s set%s(final %s val)", tabOut(), this.type, this.name, this.type));
// 		sb.append(String.format("\n%s{", tabOut()));
// 		sb.append(String.format("\n%sbitfields &= ~1;", tabOut(1)));
// 		sb.append(String.format("\n%sbitfields |= (val << 0) & 1;", tabOut(1)));
// 		sb.append(String.format("\n%sreturn val;", tabOut(1)));
// 		sb.append(String.format("\n%s}", tabOut()));
// 			
// 		sb.append(String.format("\n\n%s%s postInc%s()", tabOut(), this.type, this.name));
// 		sb.append(String.format("\n%s{", tabOut()));
// 		sb.append(String.format("\n%sint ret = get%s();", tabOut(1), this.name));
// 		sb.append(String.format("\n%sset%s(ret + 1)", tabOut(1), this.name));
// 		sb.append(String.format("\n%s}", tabOut()));			
// 
// 		sb.append(String.format("\n\n%s%s postDec%s()", tabOut(), this.type, this.name));
// 		sb.append(String.format("\n%s{", tabOut()));
// 		sb.append(String.format("\n%sint ret = get%s();", tabOut(1), this.name));
// 		sb.append(String.format("\n%sset%s(ret - 1)", tabOut(1), this.name));
// 		sb.append(String.format("\n%s}", tabOut()));			
// 
// 		return sb.toString();
// 	}
// }


// Path: src/main/java/com/github/danfickle/cpptojavasourceconverter/BitfieldManager.java
import org.eclipse.cdt.core.dom.ast.*;
import com.github.danfickle.cpptojavasourceconverter.TypeManager.NameType;
import com.github.danfickle.cpptojavasourceconverter.TypeManager.TypeType;
import com.github.danfickle.cpptojavasourceconverter.models.DeclarationModels.CppBitfield;

package com.github.danfickle.cpptojavasourceconverter;



public class BitfieldManager
{
	private TranslationUnitContext ctx;
	
	BitfieldManager(TranslationUnitContext con) {
		ctx = con;
	}

	boolean isBitfield(IASTName name) throws DOMException
	{
		String complete = TypeManager.getCompleteName(name);
		return ctx.global.bitfields.contains(complete);
	}
	
	void addBitfield(IASTName name) throws DOMException
	{
		String complete = TypeManager.getCompleteName(name);
		ctx.global.bitfields.add(complete);
	}
	
	boolean isBitfield(IASTExpression expr) throws DOMException
	{
		expr = ExpressionHelpers.unwrap(expr);
		
		if (expr instanceof IASTIdExpression &&
			isBitfield(((IASTIdExpression) expr).getName()))
			return true;
		
		if (expr instanceof IASTFieldReference &&
			isBitfield(((IASTFieldReference) expr).getFieldName()))
			return true;
		
		return false;
	}
	
	void evalDeclBitfield(IField field, IASTDeclarator declarator) throws DOMException
	{
		CppBitfield bitfield = ctx.declModels.new CppBitfield();