Example #1
0
 public void add_method(Method_ method)
 {
     this.methods.Add(method);
     //method.visibility = Method_.Visibilities.PRIVATE;
 }
Example #2
0
        private Classifier_ get_classifier_info(XmlNode node)
        {
            Classifier_ classifier;
            if (node.Name.ToUpper() == "CLASS")
            { classifier = new Classifier_(node.Attributes["name"].Value, ClassifierType.CLASS);}

            else if (node.Name.ToUpper() == "INTERFACE")
            {  classifier = new Classifier_(node.Attributes["name"].Value, ClassifierType.INTERFACE);}
            else
            {  return null;}

            if ((node.Attributes["visibility"] == null) || (node.Attributes["visibility"].Value == ""))
            { classifier.Visibility = Top_Level_Visibility.PACKAGE_PRIVATE; }
            else if (node.Attributes["visibility"].Value.ToUpper() == "PUBLIC")
            { classifier.Visibility = Top_Level_Visibility.PUBLIC;}

            foreach (XmlNode child_node in node.ChildNodes)
            {
                if (child_node.Name.ToUpper() == "FIELD")
                {
                    Field_ field = new Field_(child_node.Attributes["name"].Value, child_node.Attributes["type"].Value);

                    if (child_node.Attributes["visibility"] != null)
                    {
                        if (child_node.Attributes["visibility"].Value.ToUpper() == "PRIVATE")
                        { field.Visibility = Member_Level_Visibility.PRIVATE; }
                        else if (child_node.Attributes["visibility"].Value.ToUpper() == "PUBLIC")
                        { field.Visibility = Member_Level_Visibility.PUBLIC; }
                        else if (child_node.Attributes["visibility"].Value.ToUpper() == "PROTECTED")
                        { field.Visibility = Member_Level_Visibility.PROTECTED; }
                    }

                    if (child_node.Attributes["isstatic"] != null)
                    {
                        if (child_node.Attributes["isstatic"].Value == "false")
                        { field.IsStatic = false; }
                        else
                        { field.IsStatic = true; }
                    }
                    classifier.add_field(field);
                }

                if (child_node.Name.ToUpper() == "METHOD")
                {
                    Method_ method = new Method_(child_node.Attributes["name"].Value,child_node.Attributes["returntype"].Value );

                    if (child_node.Attributes["visibility"] != null)
                    {
                        if (child_node.Attributes["visibility"].Value.ToUpper() == "PRIVATE")
                        { method.Visibility = Member_Level_Visibility.PRIVATE; }
                        else if (child_node.Attributes["visibility"].Value.ToUpper() == "PUBLIC")
                        { method.Visibility = Member_Level_Visibility.PUBLIC; }
                        else if (child_node.Attributes["visibility"].Value.ToUpper() == "PROTECTED")
                        { method.Visibility = Member_Level_Visibility.PROTECTED; }
                    }

                    if (child_node.Attributes["isstatic"] != null)
                    {
                        if (child_node.Attributes["isstatic"].Value == "false")
                        { method.IsStatic = false; }
                        else
                        { method.IsStatic = true; }
                    }

                    foreach (XmlNode parameter in child_node.ChildNodes)
                    {
                        if (parameter.Name.ToUpper() == "PARAMETER")
                        {
                            method.add_parameter( new Variable_(parameter.Attributes["name"].Value,parameter.Attributes["type"].Value));
                        }

                    }

                    classifier.add_method(method);
                }

            }

            return classifier;
        }