Esempio n. 1
0
        public override string GenerateInheritImplementString(IReadOnlyDictionary <string, ArticleItemYaml> articleDict, ArticleItemYaml yaml)
        {
            if (yaml.ImplementsOrInherits == null || yaml.ImplementsOrInherits.Count == 0)
            {
                return(string.Empty);
            }
            List <string> extends = new List <string>();

            foreach (var ele in yaml.ImplementsOrInherits)
            {
                ArticleItemYaml eleYaml;
                if (articleDict.TryGetValue(ele.Type, out eleYaml))
                {
                    string parent = eleYaml.Parent != null ? articleDict[eleYaml.Parent].FullName : string.Empty;
                    string name   = YamlUtility.ParseNameFromFullName(HierarchyType.Class, parent, ele.SpecializedFullName);
                    extends.Add(name);
                }
            }

            var builder = new StringBuilder();

            if (extends.Count > 0)
            {
                builder.Append($" : public {extends[0]}");
                foreach (var ex in extends.Skip(1))
                {
                    builder.Append($", public {ex}");
                }
            }

            return(builder.ToString());
        }
Esempio n. 2
0
        public override string GenerateTypeName(NameGeneratorContext context, XElement node, bool withTypeParameters)
        {
            string name = YamlUtility.RegularizeName(YamlUtility.ParseNameFromFullName(context.CurrentChange.Type, context.ParentChange?.Name, context.CurrentChange.Name), Constants.Dot);

            if (node != null && withTypeParameters)
            {
                name += GetTypeParameterString(node);
            }
            return(name);
        }
Esempio n. 3
0
 public override string GenerateTypeName(NameGeneratorContext context, XElement node, bool withTypeParameters)
 {
     return(YamlUtility.ParseNameFromFullName(context.CurrentChange.Type, context.ParentChange?.Name, context.CurrentChange.Name));
 }