Ejemplo n.º 1
0
 public void PrintCode(CodeWriter cp)
 {
     cp.BeginLine();
     foreach (CodeCustomAttribute a in customAttributes)
     {
         a.PrintCode(cp);
     }
     cp.BeginLine();
     if (IsStatic)
     {
         cp.Write("static ");
     }
     if (IsPublic)
     {
         cp.Write("public ");
     }
     if (returnType != null)
     {
         cp.Write(returnType + " ");
     }
     cp.Write(name);
     if (parameterTypes.Length > 0)
     {
         cp.Write(name + " [");
         for (int n = 0; n < parameterTypes.Length; n++)
         {
             if (n > 0)
             {
                 cp.Write(", ");
             }
             cp.Write(parameterTypes[n] + " arg" + n);
         }
         cp.Write("]");
     }
     cp.Write(" {");
     cp.EndLine();
     cp.Indent();
     cp.WriteLineInd("get {");
     get_builder.PrintCode(cp);
     cp.WriteLineUnind("}");
     cp.WriteLine("set {");
     set_builder.PrintCode(cp);
     cp.WriteLine("}");
     cp.WriteLineUnind("}");
 }
Ejemplo n.º 2
0
        public virtual void PrintCode(CodeWriter cp)
        {
            cp.BeginLine();
            foreach (CodeCustomAttribute a in customAttributes)
            {
                a.PrintCode(cp);
            }
            if ((methodBase.Attributes & MethodAttributes.Static) != 0)
            {
                cp.Write("static ");
            }
            if ((methodBase.Attributes & MethodAttributes.Public) != 0)
            {
                cp.Write("public ");
            }
            if (returnType != null)
            {
                cp.Write(returnType + " ");
            }
            cp.Write(name + " (");
            for (int n = 0; n < parameterTypes.Length; n++)
            {
                if (n > 0)
                {
                    cp.Write(", ");
                }
                cp.Write(parameterTypes[n] + " arg" + n);
            }
            cp.Write(")");
            cp.EndLine();
            cp.WriteLineInd("{");

            builder.PrintCode(cp);

            cp.WriteLineUnind("}");
        }
Ejemplo n.º 3
0
		public virtual void PrintCode (CodeWriter cp)
		{
			cp.BeginLine ();
			foreach (CodeCustomAttribute a in customAttributes)
				a.PrintCode (cp);
			if ((methodBase.Attributes & MethodAttributes.Static) != 0)
				cp.Write ("static ");
			if ((methodBase.Attributes & MethodAttributes.Public) != 0)
				cp.Write ("public ");
			if (returnType != null) cp.Write (returnType + " ");
			cp.Write (name + " (");
			for (int n=0; n<parameterTypes.Length; n++) {
				if (n > 0) cp.Write (", ");
				cp.Write (parameterTypes[n] + " arg" + n);
			}
			cp.Write (")");
			cp.EndLine ();
			cp.WriteLineInd ("{");
			
			builder.PrintCode (cp);
			
			cp.WriteLineUnind ("}");
		}
Ejemplo n.º 4
0
		public void PrintCode (CodeWriter cp)
		{
			cp.BeginLine ();
			foreach (CodeCustomAttribute a in customAttributes)
				a.PrintCode (cp);
			cp.BeginLine ();
			if (IsStatic)
				cp.Write ("static ");
			if (IsPublic)
				cp.Write ("public ");
			if (returnType != null) cp.Write (returnType + " ");
			cp.Write (name);
			if (parameterTypes.Length > 0) {
				cp.Write (name + " [");
				for (int n=0; n<parameterTypes.Length; n++) {
					if (n > 0) cp.Write (", ");
					cp.Write (parameterTypes[n] + " arg" + n);
				}
				cp.Write ("]");
			}
			cp.Write (" {");
			cp.EndLine ();
			cp.Indent ();
			cp.WriteLineInd ("get {");
			get_builder.PrintCode (cp);
			cp.WriteLineUnind ("}");
			cp.WriteLine ("set {");
			set_builder.PrintCode (cp);
			cp.WriteLine ("}");
			cp.WriteLineUnind ("}");
		}
Ejemplo n.º 5
0
        public void PrintCode(CodeWriter cw)
        {
            for (int n = 0; n < customAttributes.Count; n++)
            {
                CodeCustomAttribute cca = customAttributes [n] as CodeCustomAttribute;
                if (n > 0)
                {
                    cw.WriteLine("");
                }
                cca.PrintCode(cw);
            }

/*			if ((typeBuilder.Attributes & TypeAttributes.Abstract) != 0) cw.Write ("abstract ");
 *                      if ((typeBuilder.Attributes & TypeAttributes.NestedAssembly) != 0) cw.Write ("internal ");
 *                      if ((typeBuilder.Attributes & TypeAttributes.NestedPrivate) != 0) cw.Write ("private ");
 */         if ((typeBuilder.Attributes & TypeAttributes.Public) != 0)
            {
                cw.Write("public ");
            }
            cw.Write("class ").Write(typeBuilder.Name);

            bool dots = false;

            if (baseType != null && baseType != typeof(object))
            {
                cw.Write(" : " + baseType);
                dots = true;
            }

            if (interfaces != null && interfaces.Length > 0)
            {
                if (!dots)
                {
                    cw.Write(" : ");
                }
                else
                {
                    cw.Write(", ");
                }
                for (int n = 0; n < interfaces.Length; n++)
                {
                    if (n > 0)
                    {
                        cw.Write(", ");
                    }
                    cw.Write(interfaces[n].ToString());
                }
            }

            cw.EndLine().WriteLineInd("{");

            foreach (FieldInfo f in fields)
            {
                cw.BeginLine();
                ArrayList atts = (ArrayList)fieldAttributes [f];
                foreach (CodeCustomAttribute a in atts)
                {
                    a.PrintCode(cw);
                }
                if ((f.Attributes & FieldAttributes.Static) != 0)
                {
                    cw.Write("static ");
                }
                cw.Write(f.FieldType.Name + " ");
                cw.Write(f.Name + ";");
                cw.EndLine();
                cw.WriteLine("");
            }

            for (int n = 0; n < properties.Count; n++)
            {
                CodeProperty prop = properties [n] as CodeProperty;
                if (n > 0)
                {
                    cw.WriteLine("");
                }
                prop.PrintCode(cw);
            }

            for (int n = 0; n < methods.Count; n++)
            {
                CodeMethod met = methods[n] as CodeMethod;
                if (n > 0)
                {
                    cw.WriteLine("");
                }
                met.PrintCode(cw);
            }
            cw.WriteLineUnind("}");
        }
Ejemplo n.º 6
0
		public void PrintCode (CodeWriter cw)
		{
			for (int n=0; n<customAttributes.Count; n++) {
				CodeCustomAttribute cca = customAttributes [n] as CodeCustomAttribute;
				if (n > 0) cw.WriteLine ("");
				cca.PrintCode (cw);
			}

/*			if ((typeBuilder.Attributes & TypeAttributes.Abstract) != 0) cw.Write ("abstract ");
			if ((typeBuilder.Attributes & TypeAttributes.NestedAssembly) != 0) cw.Write ("internal ");
			if ((typeBuilder.Attributes & TypeAttributes.NestedPrivate) != 0) cw.Write ("private ");
*/			if ((typeBuilder.Attributes & TypeAttributes.Public) != 0) cw.Write ("public ");
			cw.Write ("class ").Write (typeBuilder.Name);
			
			bool dots = false;
			if (baseType != null && baseType != typeof(object)) {
				cw.Write (" : " + baseType);
				dots = true;
			}
			
			if (interfaces != null && interfaces.Length > 0) {
				if (!dots) cw.Write (" : ");
				else cw.Write (", ");
				for (int n=0; n<interfaces.Length; n++) {
					if (n > 0) cw.Write (", ");
					cw.Write (interfaces[n].ToString ());
				}
			}
			
			cw.EndLine ().WriteLineInd ("{");
			
			foreach (FieldInfo f in fields) {
				cw.BeginLine ();
				ArrayList atts = (ArrayList) fieldAttributes [f];
				foreach (CodeCustomAttribute a in atts)
					a.PrintCode (cw);
				if ((f.Attributes & FieldAttributes.Static) != 0)
					cw.Write ("static ");
				cw.Write (f.FieldType.Name + " ");
				cw.Write (f.Name + ";");
				cw.EndLine ();
				cw.WriteLine (""); 
			}
			
			for (int n=0; n<properties.Count; n++) {
				CodeProperty prop = properties [n] as CodeProperty;
				if (n > 0) cw.WriteLine ("");
				prop.PrintCode (cw);
			}

			for (int n=0; n<methods.Count; n++) {
				CodeMethod met = methods[n] as CodeMethod;
				if (n > 0) cw.WriteLine ("");
				met.PrintCode (cw);
			}
			cw.WriteLineUnind ("}");
		}