Пример #1
0
        protected override string GetOperatorString(IMethod method, OutputSettings settings)
        {
            var result = new StringBuilder();

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

            result.Append(settings.EmitKeyword("Operator"));
            result.Append(settings.EmitName(method, settings.UseFullName ? method.FullName : method.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(")"));
            }

            if (settings.IncludeReturnType)
            {
                result.Append(settings.Markup(" : "));
                result.Append(GetTypeReferenceString(method.ReturnType, settings));
            }
            return(result.ToString());
        }
Пример #2
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 ();
 }
Пример #3
0
        protected override string GetIndexerString(IProperty property, OutputSettings settings)
        {
            var result = new StringBuilder();

            if (settings.IncludeModifiers)
            {
                AppendModifiers(result, settings, property);
            }
            result.Append(settings.EmitKeyword("Indexer"));
            result.Append(settings.EmitName(property, property.Name));

            if (settings.IncludeParameters && property.Parameters.Count > 0)
            {
                result.Append(settings.Markup("("));
                bool first = true;
                foreach (var parameter in property.Parameters)
                {
                    if (!first)
                    {
                        result.Append(settings.Markup(", "));
                    }
                    result.Append(GetParameterString(property, parameter, settings));
                    first = false;
                }
                result.Append(settings.Markup(")"));
            }
            if (settings.IncludeReturnType)
            {
                result.Append(settings.Markup(" : "));
                result.Append(GetTypeReferenceString(property.ReturnType, settings));
            }
            return(result.ToString());
        }
Пример #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());
        }
Пример #5
0
        protected override string GetDestructorString(IMethod method, OutputSettings settings)
        {
            var result = new StringBuilder();

            result.Append(settings.EmitKeyword("Destructor"));
            result.Append(settings.EmitName(method, method.DeclaringType.Name));
            return(result.ToString());
        }
Пример #6
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());
        }
Пример #7
0
        protected override string GetTypeString(IType t, OutputSettings settings)
        {
            ITypeDefinition type   = t.GetDefinition();
            var             result = new StringBuilder();

            if (settings.IncludeModifiers)
            {
                AppendModifiers(result, settings, type);
            }
            if (settings.IncludeKeywords)
            {
                result.Append(settings.EmitKeyword(GetString(type.Kind)));
            }

            result.Append(settings.EmitName(type, settings.UseFullName ? type.FullName : type.Name));

            int parameterCount = type.TypeParameters.Count;

            if (settings.IncludeGenerics && parameterCount > 0)
            {
                result.Append(settings.Markup("<"));
                if (!settings.HideGenericParameterNames)
                {
                    for (int i = 0; i < parameterCount; i++)
                    {
                        if (i > 0)
                        {
                            result.Append(settings.Markup(", "));
                        }
                        result.Append(type.TypeParameters [i].Name);
                    }
                }
                result.Append(settings.Markup(">"));
            }

            if (settings.IncludeBaseTypes && type.DirectBaseTypes.Any())
            {
                result.Append(settings.Markup(" : "));
                bool first = true;
                foreach (var baseType in type.DirectBaseTypes)
                {
                    if (baseType.Equals(type.Compilation.FindType(KnownTypeCode.Object)))
                    {
                        continue;
                    }
                    if (!first)
                    {
                        result.Append(settings.Markup(", "));
                    }
                    first = false;
                    result.Append(GetTypeReferenceString(baseType, settings));
                }
            }
            return(result.ToString());
        }
Пример #8
0
        protected override string GetPropertyString(IProperty property, OutputSettings settings)
        {
            var result = new StringBuilder();

            if (settings.IncludeModifiers)
            {
                AppendModifiers(result, settings, property);
            }
            result.Append(settings.EmitKeyword("Property"));
            result.Append(settings.EmitName(property, property.Name));
            if (settings.IncludeReturnType)
            {
                result.Append(settings.Markup(" : "));
                result.Append(GetTypeReferenceString(property.ReturnType, settings));
            }
            return(result.ToString());
        }
Пример #9
0
        protected override string GetFieldString(IField field, OutputSettings settings)
        {
            var result = new StringBuilder();

            if (settings.IncludeModifiers)
            {
                AppendModifiers(result, settings, field);
            }

            result.Append(settings.EmitKeyword("Field"));
            result.Append(settings.EmitName(field, field.Name));

            if (settings.IncludeReturnType)
            {
                result.Append(settings.Markup(" : "));
                result.Append(GetTypeReferenceString(field.ReturnType, settings));
            }
            return(result.ToString());
        }
Пример #10
0
        protected override string GetEventString(IEvent evt, OutputSettings settings)
        {
            var result = new StringBuilder();

            if (settings.IncludeModifiers)
            {
                AppendModifiers(result, settings, evt);
            }

            result.Append(settings.EmitKeyword("Event"));
            result.Append(settings.EmitName(evt, evt.Name));

            if (settings.IncludeReturnType)
            {
                result.Append(settings.Markup(" : "));
                result.Append(GetTypeReferenceString(evt.ReturnType, settings));
            }
            return(result.ToString());
        }
Пример #11
0
        protected override string GetFieldString(IField field, OutputSettings settings)
        {
            var result = new StringBuilder ();

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

            result.Append (settings.EmitKeyword ("Field"));
            result.Append (settings.EmitName (field, field.Name));

            if (settings.IncludeReturnType) {
                result.Append (settings.Markup (" : "));
                result.Append (GetTypeReferenceString (field.ReturnType, settings));
            }
            return result.ToString ();
        }
Пример #12
0
        protected override string GetEventString(IEvent evt, OutputSettings settings)
        {
            var result = new StringBuilder ();

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

            result.Append (settings.EmitKeyword ("Event"));
            result.Append (settings.EmitName (evt, evt.Name));

            if (settings.IncludeReturnType) {
                result.Append (settings.Markup (" : "));
                result.Append (GetTypeReferenceString (evt.ReturnType, settings));
            }
            return result.ToString ();
        }
Пример #13
0
        protected override string GetIndexerString(IProperty property, OutputSettings settings)
        {
            var result = new StringBuilder ();
            if (settings.IncludeModifiers)
                AppendModifiers (result, settings, property);
            result.Append (settings.EmitKeyword ("Indexer"));
            result.Append (settings.EmitName (property, property.Name));

            if (settings.IncludeParameters && property.Parameters.Count > 0) {
                result.Append (settings.Markup ("("));
                bool first = true;
                foreach (var parameter in property.Parameters) {
                    if (!first)
                        result.Append (settings.Markup (", "));
                    result.Append (GetParameterString (property, parameter, settings));
                    first = false;
                }
                result.Append (settings.Markup (")"));
            }
            if (settings.IncludeReturnType) {
                result.Append (settings.Markup (" : "));
                result.Append (GetTypeReferenceString (property.ReturnType, settings));
            }
            return result.ToString ();
        }
Пример #14
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 ();
		}
Пример #15
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 ();
        }
Пример #16
0
        protected override string GetOperatorString(IMethod method, OutputSettings settings)
        {
            var result = new StringBuilder ();

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

            result.Append (settings.EmitKeyword ("Operator"));
            result.Append (settings.EmitName (method, settings.UseFullName ? method.FullName : method.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 (")"));
            }

            if (settings.IncludeReturnType) {
                result.Append (settings.Markup (" : "));
                result.Append (GetTypeReferenceString (method.ReturnType, settings));
            }
            return result.ToString ();
        }
Пример #17
0
        protected override string GetTypeString(IType t, OutputSettings settings)
        {
            ITypeDefinition type = t.GetDefinition ();
            var result = new StringBuilder ();
            if (settings.IncludeModifiers)
                AppendModifiers (result, settings, type);
            if (settings.IncludeKeywords)
                result.Append (settings.EmitKeyword (GetString (type.Kind)));

            result.Append (settings.EmitName (type, settings.UseFullName ? type.FullName : type.Name));

            int parameterCount = type.TypeParameters.Count;

            if (settings.IncludeGenerics && parameterCount > 0) {
                result.Append (settings.Markup ("<"));
                if (!settings.HideGenericParameterNames) {
                    for (int i = 0; i < parameterCount; i++) {
                        if (i > 0)
                            result.Append (settings.Markup (", "));
                        result.Append (type.TypeParameters [i].Name);
                    }
                }
                result.Append (settings.Markup (">"));
            }

            if (settings.IncludeBaseTypes && type.DirectBaseTypes.Any ()) {
                result.Append (settings.Markup (" : "));
                bool first = true;
                foreach (var baseType in type.DirectBaseTypes) {
                    if (baseType.Equals (type.Compilation.FindType (KnownTypeCode.Object)))
                        continue;
                    if (!first)
                        result.Append (settings.Markup (", "));
                    first = false;
                    result.Append (GetTypeReferenceString (baseType, settings));
                }

            }
            return result.ToString ();
        }
Пример #18
0
 protected override string GetPropertyString(IProperty property, OutputSettings settings)
 {
     var result = new StringBuilder ();
     if (settings.IncludeModifiers)
         AppendModifiers (result, settings, property);
     result.Append (settings.EmitKeyword ("Property"));
     result.Append (settings.EmitName (property, property.Name));
     if (settings.IncludeReturnType) {
         result.Append (settings.Markup (" : "));
         result.Append (GetTypeReferenceString (property.ReturnType, settings));
     }
     return result.ToString ();
 }
Пример #19
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 ();
		}
Пример #20
0
 protected override string GetDestructorString(IMethod method, OutputSettings settings)
 {
     var result = new StringBuilder ();
     result.Append (settings.EmitKeyword ("Destructor"));
     result.Append (settings.EmitName (method, method.DeclaringType.Name));
     return result.ToString ();
 }