本文整理汇总了C#中MonoDevelop.Ide.TypeSystem.OutputSettings类的典型用法代码示例。如果您正苦于以下问题:C# OutputSettings类的具体用法?C# OutputSettings怎么用?C# OutputSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OutputSettings类属于MonoDevelop.Ide.TypeSystem命名空间,在下文中一共展示了OutputSettings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: AppendType
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 (">"));
}
//.........这里部分代码省略.........
开发者ID:txdv,项目名称:monodevelop,代码行数:101,代码来源:CSharpAmbience.cs
示例17: GetTypeReferenceString
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 ();
}
开发者ID:txdv,项目名称:monodevelop,代码行数:31,代码来源:CSharpAmbience.cs
示例18: GetDestructorString
protected abstract string GetDestructorString (IMethod destructor, OutputSettings settings);
开发者ID:rajeshpillai,项目名称:monodevelop,代码行数:1,代码来源:Ambience.cs
示例19: InternalGetMethodString
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 ();
}
开发者ID:txdv,项目名称:monodevelop,代码行数:56,代码来源:CSharpAmbience.cs
示例20: GetOperatorString
protected abstract string GetOperatorString (IMethod op, OutputSettings settings);
开发者ID:rajeshpillai,项目名称:monodevelop,代码行数:1,代码来源:Ambience.cs
注:本文中的MonoDevelop.Ide.TypeSystem.OutputSettings类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论