Beispiel #1
0
        private static void ParseMethodDefinition(TypeInfo context, string ReturnType, string Signature, string Summary)
        {
            Summary = Summary.Replace(" ", " ").Trim();

            // <CODE><B><A HREF="../../../org/w3c/dom/Document.html#createAttributeNS(java.lang.String, java.lang.String)">createAttributeNS</A></B>(<A HREF="../../../java/lang/String.html" title="class in java.lang">String</A>&nbsp;namespaceURI,
            // <A HREF="../../../java/lang/String.html" title="class in java.lang">String</A>&nbsp;qualifiedName)</CODE>

            var ParametersHint  = "</B>";
            var ParametersStart = "(";
            var ParametersEnd   = ")";

            var i  = Signature.IndexOf(ParametersStart, Signature.IndexOf(ParametersHint));
            var ic = Signature.IndexOf(ParametersEnd, i);

            var value = new MethodDefinitionInfo();

            value.Name            = Signature.Substring(0, i).ToElementText();
            value.ReturnParameter = new ParameterInfo {
                Type = new TypeInfo()
            };
            value.Summary = Summary;

            Action IsAbstract  = () => { value.IsAbstract = true; context.IsAbstract = true; };
            Action IsProtected = () => value.IsProtected = true;
            Action IsStatic    = () => value.IsStatic = true;

            // <FONT SIZE=\"-1\">\n<CODE>&nbsp;boolean</CODE></FONT>
            ParseParameter(ReturnType, value.ReturnParameter, IsProtected, IsStatic, IsAbstract);

            var Parameters = Signature.Substring(i + ParametersStart.Length, ic - i - ParametersStart.Length).Trim();

            if (Parameters.Length > 0)
            {
                foreach (var Parameter in Parameters.Split(','))
                {
                    // "<A HREF=\"../../../java/lang/String.html\" title=\"class in java.lang\">String</A>&nbsp;namespaceURI"

                    var p = new ParameterInfo();

                    ParseParameter(Parameter, p, null, null, null);

                    value.Add(p);
                }
            }


            context.AddMethod(value);
        }
Beispiel #2
0
 public void AddConstructor(MethodDefinitionInfo Constructor)
 {
     Constructors[ConstructorsCount] = Constructor;
     ConstructorsCount++;
 }
Beispiel #3
0
 public void AddMethod(MethodDefinitionInfo Method)
 {
     Methods[MethodsCount] = Method;
     MethodsCount++;
 }
 public void AddMethod(MethodDefinitionInfo Method)
 {
     Methods[MethodsCount] = Method;
     MethodsCount++;
 }
 public void AddConstructor(MethodDefinitionInfo Constructor)
 {
     Constructors[ConstructorsCount] = Constructor;
     ConstructorsCount++;
 }
        private static void ParseMethodDefinition(TypeInfo context, string ReturnType, string Signature, string Summary)
        {
            Summary = Summary.Replace("&nbsp;", " ").Trim();

            // <CODE><B><A HREF="../../../org/w3c/dom/Document.html#createAttributeNS(java.lang.String, java.lang.String)">createAttributeNS</A></B>(<A HREF="../../../java/lang/String.html" title="class in java.lang">String</A>&nbsp;namespaceURI,
            // <A HREF="../../../java/lang/String.html" title="class in java.lang">String</A>&nbsp;qualifiedName)</CODE>

            var ParametersHint = "</B>";
            var ParametersStart = "(";
            var ParametersEnd = ")";

            var i = Signature.IndexOf(ParametersStart, Signature.IndexOf(ParametersHint));
            var ic = Signature.IndexOf(ParametersEnd, i);

            var value = new MethodDefinitionInfo();
            value.Name = Signature.Substring(0, i).ToElementText();
            value.ReturnParameter = new ParameterInfo { Type = new TypeInfo() };
            value.Summary = Summary;

            Action IsAbstract = () => { value.IsAbstract = true; context.IsAbstract = true; };
            Action IsProtected = () => value.IsProtected = true;
            Action IsStatic = () => value.IsStatic = true;
            // <FONT SIZE=\"-1\">\n<CODE>&nbsp;boolean</CODE></FONT>
            ParseParameter(ReturnType, value.ReturnParameter, IsProtected, IsStatic, IsAbstract);

            var Parameters = Signature.Substring(i + ParametersStart.Length, ic - i - ParametersStart.Length).Trim();

            if (Parameters.Length > 0)
                foreach (var Parameter in Parameters.Split(','))
                {
                    // "<A HREF=\"../../../java/lang/String.html\" title=\"class in java.lang\">String</A>&nbsp;namespaceURI"

                    var p = new ParameterInfo();

                    ParseParameter(Parameter, p, null, null, null);

                    value.Add(p);
                }

            context.AddMethod(value);
        }