Ejemplo n.º 1
0
 public Parameter(int number, string value, TypeParam type, string description)
 {
     this.Number      = number;
     this.Value       = value;
     this.Type        = type;
     this.Description = description;
 }
Ejemplo n.º 2
0
 public void Add(int number, string value, TypeParam type, string description)
 {
     if (IsContainsKey(number))
     {
         mParameters.Add(number, new Parameter(number, value, type, description));
     }
 }
Ejemplo n.º 3
0
 public override void VisitTypeParam(TypeParam typeParam)
 {
     using (var ch = this.Change(this.paramStr)) {
         this.Write(" * <" + typeParam.Name + ">: ");
         base.VisitTypeParam(typeParam);
         this.WriteLine("\r\n\r\n");
     }
 }
Ejemplo n.º 4
0
        public string WriteConstraints(ClassData classData, AssemblyData assemblyData)
        {
            string str = "";

            for (int i = 0; i < classData.TypeParams.Count; i++)
            {
                TypeParam tp = classData.TypeParams[i];
                str += WriteTypeConstraints(tp.Constraints, i, classData.TypeParams, assemblyData);
            }

            return(str);
        }
Ejemplo n.º 5
0
        public static void Implements(this TypeParam param, Type typeToImplement)
        {
            var type = param.Type;

            if (!typeToImplement.IsAssignableFrom(type))
            {
                Exceptions.ThrowArgumentException(
                    param.Name,
                    param.Type,
                    param.OptsFn,
                    $"The type must implement {typeToImplement}");
            }
        }
Ejemplo n.º 6
0
        public bool Equals(CppTypeName other)
        {
            if (other == null)
            {
                return(false);
            }

            if (IsConst != other.IsConst)
            {
                return(false);
            }

            if (Name != other.Name)
            {
                return(false);
            }

            if (TypeParam == null || TypeParam.Count == 0)
            {
                if (other.TypeParam != null && other.TypeParam.Count != 0)
                {
                    return(false);
                }
            }
            else
            {
                if (!TypeParam.SequenceEqual(other.TypeParam))
                {
                    return(false);
                }
            }

            if (PtrInfos == null || PtrInfos.Count == 0)
            {
                if (other.PtrInfos != null && other.PtrInfos.Count != 0)
                {
                    return(false);
                }
            }
            else
            {
                if (!PtrInfos.SequenceEqual(other.PtrInfos))
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 7
0
        public IReadOnlyList <TypeParam> GetTypeParams(IReadOnlyList <Type> typeArgs)
        {
            Check.Ref(typeArgs);

            TypeParam[] typeParams = new TypeParam[typeArgs.Count];

            for (int i = 0; i < typeArgs.Count; i++)
            {
                ParamModifier modifier = GetGenericParamModifier(typeArgs[i].GenericParameterAttributes);
                IReadOnlyList <TypeConstraint> constraints = GetTypeParamConstraints(typeArgs[i]);
                typeParams[i] = new TypeParam(typeArgs[i].Name, modifier, constraints);
            }

            return(typeParams);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Добавить запись в таблицу или документ
        /// </summary>
        /// <param name="key"></param>
        /// <param name="inValue"></param>
        /// <param name="typeValue"></param>
        public void AddRow(string key, string inValue, TypeParam typeValue = TypeParam.String)
        {
            string[] EditValue = { inValue, typeValue.ToString() };

            if (whoIsUpdated == WhoIsUpdate.DataView)
            {
                //RowValue(key) = EditValue;
                SetRowValue(key, EditValue);
            }
            else
            {
                //ValuePathQuery(key) = EditValue;
                SetValuePathQuery(key, EditValue);
            }
        }
Ejemplo n.º 9
0
 protected static void AssertReturnedAsExpected(TypeParam returned, Type expected)
 {
     Assert.Equal(ParamName, returned.Name);
     Assert.Equal(expected, returned.Type);
 }
Ejemplo n.º 10
0
 public static void Extends(this TypeParam param, Type typeToImplement)
 {
     Implements(param, typeToImplement);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Visits the <c>typeparam</c> documentation element.
 /// </summary>
 public virtual void VisitTypeParam(TypeParam typeParam)
 {
     VisitContainer(typeParam);
 }
 public override void VisitTypeParam(TypeParam param)
 {
     _builder.AppendFormat("`{0}`: ", param.Name);
     base.VisitTypeParam(param);
     _builder.AppendLine();
 }
Ejemplo n.º 13
0
 public static void IsOfTypeOrSubtype(this TypeParam param, Type typeToImplement)
 {
     Implements(param, typeToImplement);
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Reads all supported documentation elements.
        /// </summary>
        private static IEnumerable<Element> ReadContent(XElement xml)
        {
            foreach (var node in xml.Nodes())
            {
                var element = default(Element);
                switch (node.NodeType)
                {
                    case System.Xml.XmlNodeType.Element:
                        var elementNode = (XElement)node;
                        switch (elementNode.Name.LocalName)
                        {
                            case "summary":
                                element = new Summary(ReadContent(elementNode));
                                break;
                            case "remarks":
                                element = new Remarks(ReadContent(elementNode));
                                break;
                            case "example":
                                element = new Example(ReadContent(elementNode));
                                break;
                            case "para":
                                element = new Para(ReadContent(elementNode));
                                break;
                            case "param":
                                element = new Param(FindAttribute(elementNode, "name"), ReadContent(elementNode));
                                break;
                            case "paramref":
                                element = new ParamRef(FindAttribute(elementNode, "name"));
                                break;
                            case "typeparam":
                                element = new TypeParam(FindAttribute(elementNode, "name"), ReadContent(elementNode));
                                break;
                            case "typeparamref":
                                element = new TypeParamRef(FindAttribute(elementNode, "name"));
                                break;
                            case "code":
                                element = new Code(TrimCode(elementNode.Value));
                                break;
                            case "c":
                                element = new C(elementNode.Value);
                                break;
                            case "see":
                                element = new See(FindAttribute(elementNode, "cref"), FindAttribute(elementNode, "langword"), elementNode.Value, ReadContent(elementNode));
                                break;
                            case "seealso":
                                element = new SeeAlso(FindAttribute(elementNode, "cref"), elementNode.Value, ReadContent(elementNode));
                                break;
                            case "list":
                                element = new List(FindAttribute(elementNode, "type"), ReadContent(elementNode));
                                break;
                            case "listheader":
                                element = new ListHeader(ReadContent(elementNode));
                                break;
                            case "term":
                                element = new Term(ReadContent(elementNode));
                                break;
                            case "description":
                                element = new Description(ReadContent(elementNode));
                                break;
                            case "item":
                                element = new Item(ReadContent(elementNode));
                                break;
                            case "exception":
                                element = new Exception(FindAttribute(elementNode, "cref"), ReadContent(elementNode));
                                break;
                            case "value":
                                element = new Value(ReadContent(elementNode));
                                break;
                            case "returns":
                                element = new Returns(ReadContent(elementNode));
                                break;
                            default:
                                element = new UnknownElement(elementNode, ReadContent(elementNode));
                                break;
                        }
                        break;
                    case System.Xml.XmlNodeType.Text:
                        element = new Text(TrimText(((XText)node).Value));
                        break;
                    default:
                        break;
                }

                if (element != null)
                {
                    element.SetLineInfo(xml as IXmlLineInfo);
                    yield return element;
                }
            }
        }
Ejemplo n.º 15
0
 public override void VisitTypeParam(TypeParam typeParam)
 {
     using (var ch = this.Change(this.paramStr)) {
     this.Write(" * &lt;" + typeParam.Name + "&gt;: ");
     base.VisitTypeParam(typeParam);
     this.WriteLine("\r\n\r\n");
       }
 }
Ejemplo n.º 16
0
        /// <summary>
        /// See <see cref="Visitor.VisitTypeParam"/>.
        /// </summary>
        public override void VisitTypeParam(TypeParam typeParam)
        {
            if (delegates.VisitTypeParam != null)
                delegates.VisitTypeParam(typeParam);

            base.VisitTypeParam(typeParam);
        }
Ejemplo n.º 17
0
 public override void VisitTypeParam(TypeParam param)
 {
     _builder.AppendFormat("`{0}`: ", param.Name);
     base.VisitTypeParam(param);
     _builder.AppendLine();
 }
Ejemplo n.º 18
0
 void AssertTypeParam(TypeParam expected, TypeParam actual)
 {
     Assert.AreEqual(expected.Name, actual.Name);
     Assert.AreEqual(expected.Modifier, actual.Modifier);
     AssertTypeConstraints(expected.Constraints, actual.Constraints);
 }