protected override string GetFieldString(ICSharpCode.NRefactory.TypeSystem.IField field, OutputSettings settings)
        {
            if (field == null)
                return "";
            var result = new StringBuilder ();
            bool isEnum = field.DeclaringTypeDefinition != null && field.DeclaringTypeDefinition.Kind == TypeKind.Enum;
            AppendModifiers (result, settings, field);

            if (!settings.CompletionListFomat && settings.IncludeReturnType && !isEnum) {
                result.Append (GetTypeReferenceString (field.ReturnType, settings));
                result.Append (settings.Markup (" "));
            }

            if (!settings.IncludeReturnType && settings.UseFullName) {
                result.Append (GetTypeReferenceString (field.DeclaringTypeDefinition, settings));
                result.Append (settings.Markup ("."));
            }
            result.Append (settings.EmitName (field, FilterName (Format (field.Name))));

            if (settings.CompletionListFomat && settings.IncludeReturnType && !isEnum) {
                result.Append (settings.Markup (" : "));
                result.Append (GetTypeReferenceString (field.ReturnType, settings));
            }
            return result.ToString ();
        }
		static DomTypeNodeBuilder ()
		{
			DomTypeNodeBuilder.settings = new OutputSettings (OutputFlags.AssemblyBrowserDescription);
			
			DomTypeNodeBuilder.settings.MarkupCallback += delegate (string text) {
				return "<span style=\"text\">" + text + "</span>";
			};
			DomTypeNodeBuilder.settings.EmitModifiersCallback = delegate (string text) {
				return "<span style=\"keyword.modifier\">" + text + "</span>";
			};
			DomTypeNodeBuilder.settings.EmitKeywordCallback = delegate (string text) {
				return MarkupKeyword (text);
			};
//			DomTypeNodeBuilder.settings.EmitNameCallback = delegate (IEntity domVisitable, ref string outString) {
//				if (domVisitable is IType) {
//					outString = "<span style=\"text.link\"><u><a ref=\"" + ((IType)domVisitable).HelpUrl + "\">" + outString + "</a></u></span>";
//				} else {
//					outString = "<span style=\"text\">" + outString + "</span>";
//				}
//			};
//			DomTypeNodeBuilder.settings.PostProcessCallback = delegate (IEntity domVisitable, ref string outString) {
//				if (domVisitable is IReturnType) {
//					outString = "<span style=\"text.link\"><u><a ref=\"" + ((IReturnType)domVisitable).HelpUrl + "\">" + outString + "</a></u></span>";
//				}
//			};
		}
Exemple #3
0
 public override string GetString(string nameSpace, OutputSettings settings)
 {
     var result = new StringBuilder ();
     result.Append (settings.EmitKeyword ("Namespace"));
     result.Append (Format (nameSpace));
     return result.ToString ();
 }
Exemple #4
0
        protected override string GetConstructorString(IMethod method, OutputSettings settings)
        {
            var result = new StringBuilder ();

            if (settings.IncludeModifiers)
                AppendModifiers (result, settings, method);

            result.Append (settings.EmitKeyword ("Constructor"));
            result.Append (settings.EmitName (method, method.DeclaringType.Name));

            if (settings.IncludeParameters) {
                result.Append (settings.Markup ("("));
                bool first = true;
                foreach (var parameter in method.Parameters) {
                    if (!first)
                        result.Append (settings.Markup (", "));
                    result.Append (GetParameterString (method, parameter, settings));
                    first = false;
                }
                result.Append (settings.Markup (")"));
            }
            return result.ToString ();
        }
Exemple #5
0
		protected override string GetIndexerString (IProperty property, OutputSettings settings)
		{
			if (property == null)
				return "";
			var result = new StringBuilder ();
			
			AppendModifiers (result, settings, property);
			
			if (settings.IncludeReturnType) {
				result.Append (GetTypeReferenceString (property.ReturnType, settings));
				result.Append (settings.Markup (" "));
			}
			
			if (!settings.IncludeReturnType && settings.UseFullName) {
				result.Append (GetTypeReferenceString (property.DeclaringTypeDefinition, new OutputSettings (OutputFlags.UseFullName)));
				result.Append (settings.Markup ("."));
			}
			
			AppendExplicitInterfaces (result, property, settings);
			
			result.Append (settings.EmitName (property, Format ("this")));
			
			if (settings.IncludeParameters && property.Getter.Parameters.Count > 0) {
				result.Append (settings.Markup ("["));
				AppendParameterList (result, settings, property.Getter.Parameters);
				result.Append (settings.Markup ("]"));
			}
			if (settings.IncludeAccessor) {
				result.Append (settings.Markup (" {"));
				if (property.CanGet)
					result.Append (settings.Markup (" get;"));
				if (property.CanSet)
					result.Append (settings.Markup (" set;"));
				result.Append (settings.Markup (" }"));
			}
			return result.ToString ();
		}
Exemple #6
0
		protected override string GetMethodString (IMethod method, OutputSettings settings)
		{
			return InternalGetMethodString (method, settings, settings.EmitName (method, Format (FilterName (method.EntityType == EntityType.Constructor || method.EntityType == EntityType.Destructor ? method.DeclaringTypeDefinition.Name : method.Name))), true);
		}
Exemple #7
0
		protected override string GetOperatorString (IMethod method, OutputSettings settings)
		{
			return InternalGetMethodString (method, settings, settings.EmitName (method, Format (FilterName (method.Name))), true);
		}
Exemple #8
0
 protected abstract string GetTypeString(IType type, OutputSettings settings);
Exemple #9
0
		protected override string GetTypeString (IType t, OutputSettings settings)
		{
			if (t.Kind == TypeKind.Unknown) {
				return t.Name;
			}
			
			if (t.Kind == TypeKind.TypeParameter)
				return t.FullName;
			
			var typeWithElementType = t as TypeWithElementType;
			if (typeWithElementType != null) {
				var sb = new StringBuilder ();
			
				if (typeWithElementType is PointerType) {
					sb.Append (settings.Markup ("*"));
				} 
				AppendType (sb, typeWithElementType.ElementType, settings);
				
				if (typeWithElementType is ArrayType) {
					sb.Append (settings.Markup ("["));
					sb.Append (settings.Markup (new string (',', ((ArrayType)t).Dimensions - 1)));
					sb.Append (settings.Markup ("]"));
				}
				return sb.ToString ();
			}
			
			ITypeDefinition type = t.GetDefinition ();
			if (type == null)
				return "";
			
			if (!settings.UseNETTypeNames && type.Namespace == "System" && type.TypeParameterCount == 0) {
				switch (type.Name) {
				case "Object":
					return "object";
				case "Boolean":
					return "bool";
				case "Char":
					return "char";
				case "SByte":
					return "sbyte";
				case "Byte":
					return "byte";
				case "Int16":
					return "short";
				case "UInt16":
					return "ushort";
				case "Int32":
					return "int";
				case "UInt32":
					return "uint";
				case "Int64":
					return "long";
				case "UInt64":
					return "ulong";
				case "Single":
					return "float";
				case "Double":
					return "double";
				case "Decimal":
					return "decimal";
				case "String":
					return "string";
				case "Void":
					return "void";
				}
			}
			
			// output anonymous type
			if (type.IsSynthetic && type.Name == "$Anonymous$")
				return GetTypeReferenceString (type, settings);
			
			var result = new StringBuilder ();
			
			
			var def = type;
			AppendModifiers (result, settings, def);
			if (settings.IncludeKeywords)
				result.Append (GetString (def.Kind));
			if (result.Length > 0 && !result.ToString ().EndsWith (" "))
				result.Append (settings.Markup (" "));
			
			
			if (type.Kind == TypeKind.Delegate && settings.ReformatDelegates && settings.IncludeReturnType) {
				var invoke = type.GetDelegateInvokeMethod ();
				result.Append (GetTypeReferenceString (invoke.ReturnType, settings));
				result.Append (settings.Markup (" "));
			}
			
			
			if (settings.UseFullInnerTypeName && type.DeclaringTypeDefinition != null) {
				bool includeGenerics = settings.IncludeGenerics;
				settings.OutputFlags |= OutputFlags.IncludeGenerics;
				string typeString = GetTypeReferenceString (type.DeclaringTypeDefinition, settings);
				if (!includeGenerics)
					settings.OutputFlags &= ~OutputFlags.IncludeGenerics;
				result.Append (typeString);
				result.Append (settings.Markup ("."));
			}
			result.Append (settings.EmitName (type, type.Name));
			if (settings.IncludeGenerics && type.TypeParameterCount > 0) {
				result.Append (settings.Markup ("<"));
				for (int i = 0; i < type.TypeParameterCount; i++) {
					if (i > 0)
						result.Append (settings.Markup (settings.HideGenericParameterNames ? "," : ", "));
					if (!settings.HideGenericParameterNames) {
						if (t is ParameterizedType) {
							result.Append (GetTypeReferenceString (((ParameterizedType)t).TypeArguments [i], settings));
						} else {
							AppendVariance (result, type.TypeParameters [i].Variance);
							result.Append (NetToCSharpTypeName (type.TypeParameters [i].FullName));
						}
					}
				}
				result.Append (settings.Markup (">"));
			}
			
			if (t.Kind == TypeKind.Delegate && settings.ReformatDelegates) {
//				var policy = GetPolicy (settings);
//				if (policy.BeforeMethodCallParentheses)
//					result.Append (settings.Markup (" "));
				result.Append (settings.Markup ("("));
				var invoke = type.GetDelegateInvokeMethod ();
				if (invoke != null) 
					AppendParameterList (result, settings, invoke.Parameters);
				result.Append (settings.Markup (")"));
				return result.ToString ();
			}
			
			if (settings.IncludeBaseTypes && type.DirectBaseTypes.Any ()) {
				bool first = true;
				foreach (var baseType in type.DirectBaseTypes) {
//				if (baseType.FullName == "System.Object" || baseType.FullName == "System.Enum")
//					continue;
					result.Append (settings.Markup (first ? " : " : ", "));
					first = false;
					result.Append (GetTypeReferenceString (baseType, settings));	
				}
				
			}
//		OutputConstraints (result, settings, type.TypeParameters);
			return result.ToString ();
		}
Exemple #10
0
 protected abstract string GetConstructorString(IMethod constructor, OutputSettings settings);
Exemple #11
0
		protected abstract string GetEventString (IEvent evt, OutputSettings settings);
Exemple #12
0
 protected abstract string GetParameterString(IParameterizedMember member, IParameter parameter, OutputSettings settings);
Exemple #13
0
 public abstract string GetString(string nameSpace, OutputSettings settings);
Exemple #14
0
 protected abstract string GetEventString(IEvent evt, OutputSettings settings);
Exemple #15
0
 protected abstract string GetIndexerString(IProperty property, OutputSettings settings);
Exemple #16
0
 protected abstract string GetFieldString(IField field, OutputSettings settings);
Exemple #17
0
 protected abstract string GetOperatorString(IMethod op, OutputSettings settings);
Exemple #18
0
 protected abstract string GetDestructorString(IMethod destructor, OutputSettings settings);
Exemple #19
0
		void AppendExplicitInterfaces (StringBuilder sb, IMember member, OutputSettings settings)
		{
			if (member == null || !member.IsExplicitInterfaceImplementation)
				return;
			foreach (var implementedInterfaceMember in member.ImplementedInterfaceMembers) {
				if (settings.UseFullName) {
					sb.Append (Format (implementedInterfaceMember.DeclaringTypeDefinition.FullName));
				} else {
					sb.Append (Format (implementedInterfaceMember.DeclaringTypeDefinition.Name));
				}
				sb.Append (settings.Markup ("."));
			}
		}
Exemple #20
0
		protected abstract string GetOperatorString (IMethod op, OutputSettings settings);
Exemple #21
0
		void AppendParameter (OutputSettings settings, StringBuilder result, IParameter parameter)
		{
			if (parameter == null)
				return;
			if (parameter.IsOut) {
				result.Append (settings.Markup ("out"));
				result.Append (settings.Markup (" "));
			} else if (parameter.IsRef) {
				result.Append (settings.Markup ("ref"));
				result.Append (settings.Markup (" "));
			} else if (parameter.IsParams) {
				result.Append (settings.Markup ("params"));
				result.Append (settings.Markup (" "));
			}
			result.Append (GetParameterString (null, parameter, settings));
		}
Exemple #22
0
 protected abstract string GetMethodString(IMethod method, OutputSettings settings);
Exemple #23
0
		protected abstract string GetDestructorString (IMethod destructor, OutputSettings settings);
Exemple #24
0
		protected abstract string GetParameterString (IParameterizedMember member, IParameter parameter, OutputSettings settings);
Exemple #25
0
		protected abstract string GetFieldString (IField field, OutputSettings settings);
Exemple #26
0
		public void AppendType (StringBuilder sb, IType type, OutputSettings settings)
		{
			if (type.Kind == TypeKind.Unknown) {
				sb.Append (type.Name);
				return;
			}
			if (type.Kind == TypeKind.TypeParameter) {
				sb.Append (type.Name);
				return;
			}
			if (type.DeclaringType != null) {
				AppendType (sb, type.DeclaringType, settings);
				sb.Append (settings.Markup ("."));
			}
			if (type.Namespace == "System" && type.TypeParameterCount == 0) {
				switch (type.Name) {
				case "Object":
					sb.Append ("object");
					return;
				case "Boolean":
					sb.Append ("bool");
					return;
				case "Char":
					sb.Append ("char");
					return;
				case "SByte":
					sb.Append ("sbyte");
					return;
				case "Byte":
					sb.Append ("byte");
					return;
				case "Int16":
					sb.Append ("short");
					return;
				case "UInt16":
					sb.Append ("ushort");
					return;
				case "Int32":
					sb.Append ("int");
					return;
				case "UInt32":
					sb.Append ("uint");
					return;
				case "Int64":
					sb.Append ("long");
					return;
				case "UInt64":
					sb.Append ("ulong");
					return;
				case "Single":
					sb.Append ("float");
					return;
				case "Double":
					sb.Append ("double");
					return;
				case "Decimal":
					sb.Append ("decimal");
					return;
				case "String":
					sb.Append ("string");
					return;
				case "Void":
					sb.Append ("void");
					return;
				}
			}
			
			var typeWithElementType = type as TypeWithElementType;
			if (typeWithElementType != null) {
				AppendType (sb, typeWithElementType.ElementType, settings);
				
				if (typeWithElementType is PointerType) {
					sb.Append (settings.Markup ("*"));
				} 
				
				if (typeWithElementType is ArrayType) {
					sb.Append (settings.Markup ("["));
					sb.Append (settings.Markup (new string (',', ((ArrayType)type).Dimensions - 1)));
					sb.Append (settings.Markup ("]"));
				}
				return;
			}
			
			var pt = type as ParameterizedType;
			if (pt != null) {
				if (pt.Name == "Nullable" && pt.Namespace == "System" && pt.TypeParameterCount == 1) {
					AppendType (sb, pt.TypeArguments [0], settings);
					sb.Append (settings.Markup ("?"));
					return;
				}
				sb.Append (pt.Name);
				if (pt.TypeParameterCount > 0) {
					sb.Append (settings.Markup ("<"));
					for (int i = 0; i < pt.TypeParameterCount; i++) {
						if (i > 0)
							sb.Append (settings.Markup (", "));
						AppendType (sb, pt.TypeArguments [i], settings);
					}
					sb.Append (settings.Markup (">"));
				}
				return;
			}
			
			var typeDef = type as ITypeDefinition ?? type.GetDefinition ();
			if (typeDef != null) {
				sb.Append (typeDef.Name);
				
				if (typeDef.TypeParameterCount > 0) {
					sb.Append (settings.Markup ("<"));
					for (int i = 0; i < typeDef.TypeParameterCount; i++) {
						if (i > 0)
							sb.Append (settings.Markup (", "));
						AppendVariance (sb, typeDef.TypeParameters [i].Variance);
						AppendType (sb, typeDef.TypeParameters [i], settings);
					}
					sb.Append (settings.Markup (">"));
				}
			}
		}
Exemple #27
0
		protected abstract string GetIndexerString (IProperty property, OutputSettings settings);
Exemple #28
0
 protected abstract string GetTypeReferenceString(IType reference, OutputSettings settings);
		public string CreateTooltip (MonoDevelop.Ide.Gui.Document doc, int offset, ResolveResult result, string errorInformations, Gdk.ModifierType modifierState)
		{
			try {
				OutputSettings settings = new OutputSettings (OutputFlags.ClassBrowserEntries | OutputFlags.IncludeParameterName | OutputFlags.IncludeKeywords | OutputFlags.IncludeMarkup | OutputFlags.UseFullName);
				// Approximate value for usual case
				StringBuilder s = new StringBuilder (150);
				string documentation = null;
				if (result != null) {
					if (result is UnknownIdentifierResolveResult) {
						s.Append (String.Format (GettextCatalog.GetString ("Unresolved identifier '{0}'"), ((UnknownIdentifierResolveResult)result).Identifier));
					} else if (result.IsError) {
						s.Append (GettextCatalog.GetString ("Resolve error."));
					} else if (result is LocalResolveResult) {
						var lr = (LocalResolveResult)result;
						s.Append ("<small><i>");
						s.Append (lr.IsParameter ? paramStr : localStr);
						s.Append ("</i></small>\n");
						s.Append (ambience.GetString (lr.Variable.Type, settings));
						s.Append (" ");
						s.Append (lr.Variable.Name);
					} else if (result is MethodGroupResolveResult) {
						var mrr = (MethodGroupResolveResult)result;
						s.Append ("<small><i>");
						s.Append (methodStr);
						s.Append ("</i></small>\n");
						var allMethods = new List<IMethod> (mrr.Methods);
						foreach (var l in mrr.GetExtensionMethods ()) {
							allMethods.AddRange (l);
						}
						var method = allMethods.FirstOrDefault ();
						if (method != null) {
							s.Append (GLib.Markup.EscapeText (CreateAmbience (doc, offset, method.Compilation).ConvertEntity (method)));
							if (allMethods.Count > 1) {
								int overloadCount = allMethods.Count - 1;
								s.Append (string.Format (GettextCatalog.GetPluralString (" (+{0} overload)", " (+{0} overloads)", overloadCount), overloadCount));
							}
							documentation = AmbienceService.GetDocumentationSummary (method);
						}
					} else if (result is MemberResolveResult) {
						var member = ((MemberResolveResult)result).Member;
						s.Append ("<small><i>");
						s.Append (GetString (member));
						s.Append ("</i></small>\n");
						var field = member as IField;
						if (field != null && field.IsConst) {
							s.Append (GLib.Markup.EscapeText (CreateAmbience (doc, offset, field.Compilation).ConvertType (field.Type)));
							s.Append (" ");
							s.Append (field.Name);
							s.Append (" = ");
							s.Append (GetConst (field.ConstantValue));
							s.Append (";");
						} else {
							s.Append (GLib.Markup.EscapeText (CreateAmbience (doc, offset, member.Compilation).ConvertEntity (member)));
						}
						documentation = AmbienceService.GetDocumentationSummary (member);
					} else if (result is NamespaceResolveResult) {
						s.Append ("<small><i>");
						s.Append (namespaceStr);
						s.Append ("</i></small>\n");
						s.Append (ambience.GetString (((NamespaceResolveResult)result).NamespaceName, settings));
					} else {
						var tr = result;
						var typeString = GetString (tr.Type);
						if (!string.IsNullOrEmpty (typeString)) {
							s.Append ("<small><i>");
							s.Append (typeString);
							s.Append ("</i></small>\n");
						}
						settings.OutputFlags |= OutputFlags.UseFullName;
						s.Append (ambience.GetString (tr.Type, settings));
						documentation = AmbienceService.GetDocumentationSummary (tr.Type.GetDefinition ());
					}
					
					if (!string.IsNullOrEmpty (documentation)) {
						s.Append ("\n<small>");
						s.Append (AmbienceService.GetDocumentationMarkup ("<summary>" + documentation + "</summary>"));
						s.Append ("</small>");
					}
				}
				
				if (!string.IsNullOrEmpty (errorInformations)) {
					if (s.Length != 0)
						s.Append ("\n\n");
					s.Append ("<small>");
					s.Append (errorInformations);
					s.Append ("</small>");
				}
				return s.ToString ();
			} catch (Exception e){
				return e.ToString ();
			}
		}
        protected override string GetParameterString(IParameterizedMember member, IParameter parameter, OutputSettings settings)
        {
            var result = new StringBuilder();

            if (settings.IncludeParameterName)
            {
                result.Append(Format(parameter.Name));
                if (settings.IncludeReturnType)
                {
                    result.Append(settings.Markup(" : "));
                    result.Append(GetTypeReferenceString(parameter.Type, settings));
                }
            }
            else
            {
                result.Append(GetTypeReferenceString(parameter.Type, settings));
            }
            if (parameter.IsRef || parameter.IsOut)
            {
                result.Append(settings.Markup("&"));
            }
            return(result.ToString());
        }
Exemple #31
0
		protected override string GetTypeReferenceString (IType reference, OutputSettings settings)
		{
			if (reference == null)
				return "null";
			var type = reference;
			if (type.Kind == TypeKind.Unknown) {
				return reference.Name;
			}
			
			if (reference.Kind == TypeKind.TypeParameter)
				return reference.FullName;
			
			var sb = new StringBuilder ();
			if (type is ITypeDefinition && ((ITypeDefinition)type).IsSynthetic && ((ITypeDefinition)type).Name == "$Anonymous$") {
				sb.Append ("new {");
				foreach (var property in ((ITypeDefinition)type).Properties) {
					sb.AppendLine ();
					sb.Append ("\t");
					sb.Append (GetTypeReferenceString (property.ReturnType, settings) ?? "?");
					sb.Append (" ");
					sb.Append (property.Name);
					sb.Append (";");
				}
				sb.AppendLine ();
				sb.Append ("}");
				return sb.ToString ();
			}
			
			AppendType (sb, type, settings);
			return sb.ToString ();
		}
 protected override string GetTypeReferenceString(IType reference, OutputSettings settings)
 {
     return(reference.ToString());
 }
Exemple #33
0
		string InternalGetMethodString (IMethod method, OutputSettings settings, string methodName, bool getReturnType)
		{
			if (method == null)
				return "";
			var result = new StringBuilder ();
			AppendModifiers (result, settings, method);
			if (!settings.CompletionListFomat && settings.IncludeReturnType && getReturnType) {
				result.Append (GetTypeReferenceString (method.ReturnType, settings));
				result.Append (settings.Markup (" "));
			}
			
			if (!settings.IncludeReturnType && settings.UseFullName) {
				result.Append (GetTypeReferenceString (method.DeclaringTypeDefinition, new OutputSettings (OutputFlags.UseFullName)));
				result.Append (settings.Markup ("."));
			}
			AppendExplicitInterfaces (result, method, settings);
			if (method.EntityType == EntityType.Operator) {
				result.Append ("operator ");
				result.Append (settings.Markup (GetOperator (methodName)));
			} else {
				result.Append (methodName);
			}
			
			if (settings.IncludeGenerics) {
				if (method.TypeParameters.Count > 0) {
					result.Append (settings.Markup ("<"));
					for (int i = 0; i < method.TypeParameters.Count; i++) {
						if (i > 0)
							result.Append (settings.Markup (settings.HideGenericParameterNames ? "," : ", "));
						if (!settings.HideGenericParameterNames) {
							AppendVariance (result, method.TypeParameters [i].Variance);
							result.Append (NetToCSharpTypeName (method.TypeParameters [i].Name));
						}
					}
					result.Append (settings.Markup (">"));
				}
			}
			
			if (settings.IncludeParameters) {
//			CSharpFormattingPolicy policy = GetPolicy (settings);
//			if (policy.BeforeMethodCallParentheses)
//				result.Append (settings.Markup (" "));
				result.Append (settings.Markup ("("));
				AppendParameterList (result, settings, method.Parameters);
				result.Append (settings.Markup (")"));
			}
			
			if (settings.CompletionListFomat && settings.IncludeReturnType && getReturnType) {
				result.Append (settings.Markup (" : "));
				result.Append (GetTypeReferenceString (method.ReturnType, settings));
			}
			
//		OutputConstraints (result, settings, method.TypeParameters);
			
			return result.ToString ();			
		}
Exemple #34
0
		public abstract string GetString (string nameSpace, OutputSettings settings);
Exemple #35
0
		protected override string GetDestructorString (IMethod method, OutputSettings settings)
		{
			return InternalGetMethodString (method, settings, settings.EmitName (method, settings.Markup ("~") + Format (FilterName (method.DeclaringTypeDefinition != null ? method.DeclaringTypeDefinition.Name : method.Name))), false);
		}
Exemple #36
0
		protected abstract string GetTypeReferenceString (IType reference, OutputSettings settings);
Exemple #37
0
		protected override string GetEventString (IEvent evt, OutputSettings settings)
		{
			if (evt == null)
				return "";
			var result = new StringBuilder ();
			AppendModifiers (result, settings, evt);
			if (settings.IncludeKeywords)
				result.Append (settings.EmitKeyword ("event"));
			if (!settings.CompletionListFomat && settings.IncludeReturnType) {
				result.Append (GetTypeReferenceString (evt.ReturnType, settings));
				result.Append (settings.Markup (" "));
			}
			
			if (!settings.IncludeReturnType && settings.UseFullName) {
				result.Append (GetTypeReferenceString (evt.DeclaringTypeDefinition, new OutputSettings (OutputFlags.UseFullName)));
				result.Append (settings.Markup ("."));
			}
			
			AppendExplicitInterfaces (result, evt, settings);
			result.Append (settings.EmitName (evt, Format (FilterName (evt.Name))));
			
			if (settings.CompletionListFomat && settings.IncludeReturnType) {
				result.Append (settings.Markup (" : "));
				result.Append (GetTypeReferenceString (evt.ReturnType, settings));
			}
			return result.ToString ();
		}
Exemple #38
0
		protected abstract string GetTypeString (IType type, OutputSettings settings);
Exemple #39
0
		protected override string GetParameterString (IParameterizedMember member, IParameter parameter, OutputSettings settings)
		{
			if (parameter == null)
				return "";
			var result = new StringBuilder ();
			if (settings.IncludeParameterName) {
				if (settings.IncludeModifiers) {
					if (parameter.IsOut) {
						result.Append (settings.EmitKeyword ("out"));
					}
					if (parameter.IsRef) {
						result.Append (settings.EmitKeyword ("ref"));
					}
					if (parameter.IsParams) {
						result.Append (settings.EmitKeyword ("params"));
					}
				}
				
				result.Append (GetTypeReferenceString (parameter.Type, settings));
				result.Append (" ");
				
				if (settings.HighlightName) {
					result.Append (settings.EmitName (parameter, settings.Highlight (Format (FilterName (parameter.Name)))));
				} else {
					result.Append (settings.EmitName (parameter, Format (FilterName (parameter.Name))));
				}
			} else {
				result.Append (GetTypeReferenceString (parameter.Type, settings));
			}
			return result.ToString ();
		}
Exemple #40
0
		protected abstract string GetMethodString (IMethod method, OutputSettings settings);
Exemple #41
0
		void AppendParameterList (StringBuilder result, OutputSettings settings, IEnumerable<IParameter> parameterList)
		{
			if (parameterList == null)
				return;
			
			bool first = true;
			foreach (var parameter in parameterList) {
				if (!first)
					result.Append (settings.Markup (", "));
				AppendParameter (settings, result, parameter);
				first = false;
			}
		}
Exemple #42
0
		protected abstract string GetConstructorString (IMethod constructor, OutputSettings settings);
Exemple #43
0
		void AppendModifiers (StringBuilder result, OutputSettings settings, IEntity entity)
		{
			if (!settings.IncludeModifiers)
				return;
			if (entity.IsStatic)
				result.Append (settings.EmitModifiers ("static"));
			if (entity.IsSealed)
				result.Append (settings.EmitModifiers ("sealed"));
			if (entity.IsAbstract)
				result.Append (settings.EmitModifiers ("abstract"));
			if (entity.IsShadowing)
				result.Append (settings.EmitModifiers ("new"));
			
			switch (entity.Accessibility) {
			case Accessibility.Internal:
				result.Append (settings.EmitModifiers ("internal"));
				break;
			case Accessibility.ProtectedAndInternal:
				result.Append (settings.EmitModifiers ("protected internal"));
				break;
			case Accessibility.ProtectedOrInternal:
				result.Append (settings.EmitModifiers ("internal protected"));
				break;
			case Accessibility.Protected:
				result.Append (settings.EmitModifiers ("protected"));
				break;
			case Accessibility.Private:
				result.Append (settings.EmitModifiers ("private"));
				break;
			case Accessibility.Public:
				result.Append (settings.EmitModifiers ("public"));
				break;
			}
		}
Exemple #44
0
        public string GetString(IType type, OutputSettings settings)
        {
            var result = GetTypeString(type, settings);

            return(settings.PostProcess(type, result));
        }