Exemple #1
0
        public override string GenerateMemberFullName(NameGeneratorContext context, XElement node)
        {
            string memberDefName           = YamlUtility.RegularizeName(YamlUtility.ParseMemberName(node.NullableElement("definition").NullableValue(), node.NullableElement("argsstring").NullableValue()), Constants.Dot);
            string regularizedCompoundName = YamlUtility.RegularizeName(context.CurrentChange.Name, Constants.Dot);
            int    indexOfMemberFullName   = memberDefName.IndexOf(regularizedCompoundName);

            return(String.IsNullOrEmpty(regularizedCompoundName) || String.IsNullOrEmpty(memberDefName) || indexOfMemberFullName == -1 ? memberDefName : memberDefName.Substring(indexOfMemberFullName));
        }
Exemple #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);
        }
 protected void FillImplementsOrInherits(ArticleItemYaml yaml, XElement node)
 {
     foreach (var basenode in node.Elements("basecompoundref"))
     {
         string refId = basenode.NullableAttribute("refid").NullableValue();
         string specializedFullName = YamlUtility.RegularizeName(basenode.NullableValue(), Constants.Dot);
         if (refId != null)
         {
             yaml.ImplementsOrInherits.Add(new SpecializedType {
                 Type = refId, SpecializedFullName = specializedFullName
             });
         }
     }
 }
        public override string GenerateMemberDeclaration(XElement node)
        {
            StringBuilder sb   = new StringBuilder();
            string        prot = node.NullableAttribute("prot").NullableValue();

            if (prot != null && !prot.Contains("package"))
            {
                sb.Append($"{prot} ");
            }
            string virt = node.NullableAttribute("virt").NullableValue();

            if (virt == "virtual" || virt == "pure-virtual")
            {
                sb.Append("virtual ");
            }
            string statics = node.NullableAttribute("static").NullableValue();

            if (statics == "yes")
            {
                sb.Append("static ");
            }
            string typeStr = node.NullableElement("type").NullableValue();

            if (typeStr != null)
            {
                sb.Append(typeStr + " ");
            }
            string name = YamlUtility.RegularizeName(node.NullableElement("name").NullableValue(), Constants.Dot);

            if (name != null)
            {
                sb.Append(name);
            }
            var args = node.NullableElement("argsstring").NullableValue();

            if (args != null)
            {
                sb.Append(args);
            }

            var initializer = node.NullableElement("initializer").NullableValue();

            if (initializer != null)
            {
                sb.Append(initializer);
            }

            return(sb.ToString());
        }
        public override string GenerateTypeDeclaration(XElement node)
        {
            StringBuilder sb   = new StringBuilder();
            string        prot = node.NullableAttribute("prot").NullableValue();

            if (prot != null && !prot.Contains("package"))
            {
                sb.Append($"{prot} ");
            }
            string virt = node.NullableAttribute("virt").NullableValue();

            if (virt == "virtual" || virt == "pure-virtual")
            {
                sb.Append("virtual ");
            }
            string statics = node.NullableAttribute("static").NullableValue();

            if (statics == "yes")
            {
                sb.Append("static ");
            }
            string kind = node.NullableAttribute("kind").NullableValue();

            if (kind != null)
            {
                sb.Append(string.Format("{0} ", kind == "namespace" ? "package" : kind));
            }
            var    name      = YamlUtility.RegularizeName(node.NullableElement("compoundname").Value, Constants.Dot);
            int    index     = name.LastIndexOf(Constants.Dot);
            string innerName = name.Substring(index < 0 ? 0 : index + Constants.Dot.Length);

            sb.Append(kind == "namespace" ? name : innerName);
            var typeParams = node.XPathSelectElements("templateparamlist/param").ToList();

            if (typeParams.Count > 0)
            {
                var count = new StrongBox <int>(1);
                sb.Append($"<{ParseTypeParameterString(typeParams[0], count)}");
                foreach (var param in typeParams.Skip(1))
                {
                    sb.Append($",{ParseTypeParameterString(param, count)}");
                }
                Debug.Assert(count.Value >= 0);
                sb.Append(new string('>', count.Value));
            }

            return(sb.ToString());
        }
Exemple #6
0
 public override string GenerateLabel(NameGeneratorContext context, XElement node)
 {
     return(YamlUtility.RegularizeName(node.NullableElement("label").NullableValue(), Constants.Dot));
 }
Exemple #7
0
 public override string GenerateMemberName(NameGeneratorContext context, XElement node)
 {
     return(YamlUtility.RegularizeName(YamlUtility.ParseMemberName(node.NullableElement("name").NullableValue(), node.NullableElement("argsstring").NullableValue()), Constants.Dot));
 }