當前位置: 首頁>>代碼示例>>C#>>正文


C# TypeSystem.OutputSettings類代碼示例

本文整理匯總了C#中MonoDevelop.Ide.TypeSystem.OutputSettings的典型用法代碼示例。如果您正苦於以下問題:C# OutputSettings類的具體用法?C# OutputSettings怎麽用?C# OutputSettings使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OutputSettings類屬於MonoDevelop.Ide.TypeSystem命名空間,在下文中一共展示了OutputSettings類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DomTypeNodeBuilder

		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>";
//				}
//			};
		}
開發者ID:Kalnor,項目名稱:monodevelop,代碼行數:26,代碼來源:DomTypeNodeBuilder.cs

示例2: GetFieldString

        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 ();
        }
開發者ID:atsushieno,項目名稱:md-typescript,代碼行數:25,代碼來源:TypeScriptAmbience.cs

示例3: GetString

 public override string GetString(string nameSpace, OutputSettings settings)
 {
     var result = new StringBuilder ();
     result.Append (settings.EmitKeyword ("Namespace"));
     result.Append (Format (nameSpace));
     return result.ToString ();
 }
開發者ID:Kalnor,項目名稱:monodevelop,代碼行數:7,代碼來源:NetAmbience.cs

示例4: GetConstructorString

        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 ();
        }
開發者ID:Kalnor,項目名稱:monodevelop,代碼行數:23,代碼來源:NetAmbience.cs

示例5: AppendParameter

		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));
		}
開發者ID:txdv,項目名稱:monodevelop,代碼行數:16,代碼來源:CSharpAmbience.cs

示例6: AppendExplicitInterfaces

		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 ("."));
			}
		}
開發者ID:txdv,項目名稱:monodevelop,代碼行數:13,代碼來源:CSharpAmbience.cs

示例7: GetIndexerString

		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 ();
		}
開發者ID:txdv,項目名稱:monodevelop,代碼行數:37,代碼來源:CSharpAmbience.cs

示例8: GetOperatorString

		protected override string GetOperatorString (IMethod method, OutputSettings settings)
		{
			return InternalGetMethodString (method, settings, settings.EmitName (method, Format (FilterName (method.Name))), true);
		}
開發者ID:txdv,項目名稱:monodevelop,代碼行數:4,代碼來源:CSharpAmbience.cs

示例9: GetMethodString

		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);
		}
開發者ID:txdv,項目名稱:monodevelop,代碼行數:4,代碼來源:CSharpAmbience.cs

示例10: GetTypeString

		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) {
//.........這裏部分代碼省略.........
開發者ID:txdv,項目名稱:monodevelop,代碼行數:101,代碼來源:CSharpAmbience.cs

示例11: GetConstructorString

		protected abstract string GetConstructorString (IMethod constructor, OutputSettings settings);
開發者ID:rajeshpillai,項目名稱:monodevelop,代碼行數:1,代碼來源:Ambience.cs

示例12: GetMethodString

		protected abstract string GetMethodString (IMethod method, OutputSettings settings);
開發者ID:rajeshpillai,項目名稱:monodevelop,代碼行數:1,代碼來源:Ambience.cs

示例13: GetTypeString

		protected abstract string GetTypeString (IType type, OutputSettings settings);
開發者ID:rajeshpillai,項目名稱:monodevelop,代碼行數:1,代碼來源:Ambience.cs

示例14: GetTypeReferenceString

		protected abstract string GetTypeReferenceString (IType reference, OutputSettings settings);
開發者ID:rajeshpillai,項目名稱:monodevelop,代碼行數:1,代碼來源:Ambience.cs

示例15: GetString

		public abstract string GetString (string nameSpace, OutputSettings settings);
開發者ID:rajeshpillai,項目名稱:monodevelop,代碼行數:1,代碼來源:Ambience.cs


注:本文中的MonoDevelop.Ide.TypeSystem.OutputSettings類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。