public APIFunctionIndex(APIPage InParent, IEnumerable<APIFunction> Functions) : base(InParent, "Functions", "Alphabetical list of all functions")
		{
			// Create the operators category
			Category OperatorsCategory = new Category("Operators");
			Categories.Add(OperatorsCategory);

			// Separate out all the functions by their unique names
			Dictionary<APIFunctionKey, List<APIFunction>> KeyedFunctions = new Dictionary<APIFunctionKey, List<APIFunction>>();
			foreach(APIFunction Function in Functions)
			{
				APIFunctionKey Key = new APIFunctionKey(Function.FullName, Function.FunctionType);
				Utility.AddToDictionaryList(Key, Function, KeyedFunctions);
			}

			// Build a list of all the members, creating function groups where necessary
			List<KeyValuePair<APIFunctionKey, APIMember>> KeyedMembers = new List<KeyValuePair<APIFunctionKey, APIMember>>();
			foreach (KeyValuePair<APIFunctionKey, List<APIFunction>> KeyedFunction in KeyedFunctions)
			{
				if (KeyedFunction.Value.Count == 1)
				{
					KeyedMembers.Add(new KeyValuePair<APIFunctionKey,APIMember>(KeyedFunction.Key, KeyedFunction.Value[0]));
				}
				else
				{
					// Check if all the members have the same function group
					APIFunctionGroup FunctionGroup = KeyedFunction.Value[0].Parent as APIFunctionGroup;
					for(int Idx = 1; Idx < KeyedFunction.Value.Count; Idx++)
					{
						if(KeyedFunction.Value[Idx].Parent != FunctionGroup)
						{
							FunctionGroup = null;
							break;
						}
					}

					// If there was no common function group, create a new one
					if (FunctionGroup == null)
					{
						FunctionGroup = new APIFunctionGroup(this, KeyedFunction.Key, KeyedFunction.Value);
						FunctionGroups.Add(FunctionGroup);
					}

					// Add the function group to the member list
					KeyedMembers.Add(new KeyValuePair<APIFunctionKey, APIMember>(KeyedFunction.Key, FunctionGroup));
				}
			}

			// Separate all the functions into different categories
			foreach (KeyValuePair<APIFunctionKey, APIMember> KeyedMember in KeyedMembers)
			{
				if (KeyedMember.Key.Type == APIFunctionType.UnaryOperator || KeyedMember.Key.Type == APIFunctionType.BinaryOperator)
				{
					OperatorsCategory.Entries.Add(new Entry(KeyedMember.Value));
				}
				else
				{
					AddToDefaultCategory(new Entry(KeyedMember.Value));
				}
			}
		}
示例#2
0
        public APIFunction(APIPage InParent, DoxygenEntity InEntity, APIFunctionKey InKey, string InLinkPath)
            : base(InParent, InEntity.Name, InLinkPath)
        {
            Entity = InEntity;
            Node   = Entity.Node;

            Protection   = ParseProtection(Node);
            FunctionType = InKey.Type;
            AddRefLink(Entity.Node.Attributes["id"].Value, this);

            bIsTemplateSpecialization = Name.Contains('<');
            if (Node.SelectSingleNode("templateparamlist") != null && !bIsTemplateSpecialization && !TemplateFunctions.ContainsKey(FullName))
            {
                TemplateFunctions.Add(FullName, this);
            }
        }
示例#3
0
		public APIFunctionGroup(APIPage InParent, APIFunctionKey InKey, IEnumerable<DoxygenEntity> InEntities) 
			: base(InParent, InKey.Name, Utility.MakeLinkPath(InParent.LinkPath, InKey.GetLinkName()))
		{
			FunctionType = InKey.Type;

			// Build a list of prototypes for each function node, to be used for sorting
			List<DoxygenEntity> Entities = new List<DoxygenEntity>(InEntities.OrderBy(x => x.Node.SelectNodes("param").Count));

			// Create the functions
			int LinkIndex = 1;
			foreach(DoxygenEntity Entity in Entities)
			{
				string NewLinkPath = Utility.MakeLinkPath(LinkPath, String.Format("{0}", LinkIndex));
				APIFunction Function = new APIFunction(this, Entity, InKey, NewLinkPath);
				Children.Add(Function);
				LinkIndex++;
			}
		}
示例#4
0
        public APIFunctionGroup(APIPage InParent, APIFunctionKey InKey, IEnumerable <DoxygenEntity> InEntities)
            : base(InParent, InKey.Name, Utility.MakeLinkPath(InParent.LinkPath, InKey.GetLinkName()))
        {
            FunctionType = InKey.Type;

            // Build a list of prototypes for each function node, to be used for sorting
            List <DoxygenEntity> Entities = new List <DoxygenEntity>(InEntities.OrderBy(x => x.Node.SelectNodes("param").Count));

            // Create the functions
            int LinkIndex = 1;

            foreach (DoxygenEntity Entity in Entities)
            {
                string      NewLinkPath = Utility.MakeLinkPath(LinkPath, String.Format("{0}", LinkIndex));
                APIFunction Function    = new APIFunction(this, Entity, InKey, NewLinkPath);
                Children.Add(Function);
                LinkIndex++;
            }
        }
示例#5
0
		public APIFunctionGroup(APIPage InParent, APIFunctionKey InKey, IEnumerable<APIFunction> InFunctions)
			: base(InParent, InKey.Name, Utility.MakeLinkPath(InParent.LinkPath, InKey.GetLinkName()))
		{
			FunctionType = InKey.Type;
			Children.AddRange(InFunctions);
		}
示例#6
0
        public APIFunction(APIPage InParent, DoxygenEntity InEntity, APIFunctionKey InKey, string InLinkPath)
            : base(InParent, InEntity.Name, InLinkPath)
        {
            Entity = InEntity;
            Node = Entity.Node;

            Protection = ParseProtection(Node);
            FunctionType = InKey.Type;
            AddRefLink(Entity.Node.Attributes["id"].Value, this);

            bIsTemplateSpecialization = Name.Contains('<');
            if (Node.SelectSingleNode("templateparamlist") != null && !bIsTemplateSpecialization && !TemplateFunctions.ContainsKey(FullName))
            {
                TemplateFunctions.Add(FullName, this);
            }
        }
示例#7
0
 public APIFunction(APIPage InParent, DoxygenEntity InEntity, APIFunctionKey InKey)
     : this(InParent, InEntity, InKey, Utility.MakeLinkPath(InParent.LinkPath, InKey.GetLinkName()))
 {
 }
示例#8
0
        public static List <APIMember> CreateChildren(APIPage Parent, IEnumerable <DoxygenEntity> Entities)
        {
            List <APIMember> Children = new List <APIMember>();
            Dictionary <APIFunctionKey, List <DoxygenEntity> > PendingFunctionGroups = new Dictionary <APIFunctionKey, List <DoxygenEntity> >();

            // List of autogenerated structs
            List <DoxygenEntity> GeneratedEntities = new List <DoxygenEntity>();

            // Parse the entities
            foreach (DoxygenEntity Entity in Entities)
            {
                if (Entity.Kind == "class" || Entity.Kind == "struct" || Entity.Kind == "union")
                {
                    if (Entity.Kind == "struct" && Entity.Name.Contains("_event") && Entity.Name.EndsWith("_Parms"))
                    {
                        GeneratedEntities.Add(Entity);
                    }
                    else
                    {
                        APIRecord Record = new APIRecord(Parent, Entity);
                        Record.Children.AddRange(CreateChildren(Record, Entity.Members));
                        Children.Add(Record);
                    }
                }
                else if (Entity.Kind == "function")
                {
                    APIFunctionKey FunctionKey = APIFunctionKey.FromEntity(Parent, Entity);
                    if (!Program.IgnoredFunctionMacros.Contains(FunctionKey.Name))
                    {
                        List <DoxygenEntity> EntityList;
                        if (!PendingFunctionGroups.TryGetValue(FunctionKey, out EntityList))
                        {
                            EntityList = new List <DoxygenEntity>();
                            PendingFunctionGroups.Add(FunctionKey, EntityList);
                        }
                        EntityList.Add(Entity);
                    }
                }
                else if (Entity.Kind == "variable")
                {
                    if (IsConstantVariable(Entity))
                    {
                        Children.Add(new APIConstantVariable(Parent, Entity));
                    }
                    else
                    {
                        Children.Add(new APIVariable(Parent, Entity.Node));
                    }
                }
                else if (Entity.Kind == "typedef")
                {
                    Children.Add(new APITypeDef(Parent, Entity));
                }
                else if (Entity.Kind == "enum")
                {
                    if (Entity.Name != null && Entity.Name.StartsWith("@"))
                    {
                        // It's an enum constant
                        Children.AddRange(APIConstantEnum.Read(Parent, Entity));
                    }
                    else
                    {
                        // It's an enum
                        Children.Add(new APIEnum(Parent, Entity, Entity.Name));
                    }
                }
            }

            // Fixup the functions
            foreach (KeyValuePair <APIFunctionKey, List <DoxygenEntity> > PendingFunctionGroup in PendingFunctionGroups)
            {
                if (PendingFunctionGroup.Value.Count == 1)
                {
                    APIFunction Function = new APIFunction(Parent, PendingFunctionGroup.Value[0], PendingFunctionGroup.Key);
                    Children.Add(Function);
                }
                else
                {
                    APIFunctionGroup FunctionGroup = new APIFunctionGroup(Parent, PendingFunctionGroup.Key, PendingFunctionGroup.Value);
                    Children.Add(FunctionGroup);
                }
            }

            // Attach all the autogenerated structures to their parent functions
            foreach (DoxygenEntity Entity in GeneratedEntities)
            {
                if (!CreateParametersStruct(Parent, Children, Entity))
                {
                    APIRecord Record = new APIRecord(Parent, Entity);
                    Record.Children.AddRange(CreateChildren(Record, Entity.Members));
                    Children.Add(Record);
                }
            }

            // Sort the children by name
            Children.Sort((x, y) => String.Compare(x.Name, y.Name));
            return(Children);
        }
示例#9
0
 public APIFunction(APIPage InParent, DoxygenEntity InEntity, APIFunctionKey InKey)
     : this(InParent, InEntity, InKey, Utility.MakeLinkPath(InParent.LinkPath, InKey.GetLinkName()))
 {
 }
示例#10
0
        public APIFunctionIndex(APIPage InParent, IEnumerable <APIFunction> Functions) : base(InParent, "Functions", "Alphabetical list of all functions")
        {
            // Create the operators category
            Category OperatorsCategory = new Category("Operators");

            Categories.Add(OperatorsCategory);

            // Separate out all the functions by their unique names
            Dictionary <APIFunctionKey, List <APIFunction> > KeyedFunctions = new Dictionary <APIFunctionKey, List <APIFunction> >();

            foreach (APIFunction Function in Functions)
            {
                APIFunctionKey Key = new APIFunctionKey(Function.FullName, Function.FunctionType);
                Utility.AddToDictionaryList(Key, Function, KeyedFunctions);
            }

            // Build a list of all the members, creating function groups where necessary
            List <KeyValuePair <APIFunctionKey, APIMember> > KeyedMembers = new List <KeyValuePair <APIFunctionKey, APIMember> >();

            foreach (KeyValuePair <APIFunctionKey, List <APIFunction> > KeyedFunction in KeyedFunctions)
            {
                if (KeyedFunction.Value.Count == 1)
                {
                    KeyedMembers.Add(new KeyValuePair <APIFunctionKey, APIMember>(KeyedFunction.Key, KeyedFunction.Value[0]));
                }
                else
                {
                    // Check if all the members have the same function group
                    APIFunctionGroup FunctionGroup = KeyedFunction.Value[0].Parent as APIFunctionGroup;
                    for (int Idx = 1; Idx < KeyedFunction.Value.Count; Idx++)
                    {
                        if (KeyedFunction.Value[Idx].Parent != FunctionGroup)
                        {
                            FunctionGroup = null;
                            break;
                        }
                    }

                    // If there was no common function group, create a new one
                    if (FunctionGroup == null)
                    {
                        FunctionGroup = new APIFunctionGroup(this, KeyedFunction.Key, KeyedFunction.Value);
                        FunctionGroups.Add(FunctionGroup);
                    }

                    // Add the function group to the member list
                    KeyedMembers.Add(new KeyValuePair <APIFunctionKey, APIMember>(KeyedFunction.Key, FunctionGroup));
                }
            }

            // Separate all the functions into different categories
            foreach (KeyValuePair <APIFunctionKey, APIMember> KeyedMember in KeyedMembers)
            {
                if (KeyedMember.Key.Type == APIFunctionType.UnaryOperator || KeyedMember.Key.Type == APIFunctionType.BinaryOperator)
                {
                    OperatorsCategory.Entries.Add(new Entry(KeyedMember.Value));
                }
                else
                {
                    AddToDefaultCategory(new Entry(KeyedMember.Value));
                }
            }
        }
示例#11
0
 public APIFunctionGroup(APIPage InParent, APIFunctionKey InKey, IEnumerable <APIFunction> InFunctions)
     : base(InParent, InKey.Name, Utility.MakeLinkPath(InParent.LinkPath, InKey.GetLinkName()))
 {
     FunctionType = InKey.Type;
     Children.AddRange(InFunctions);
 }
 public APIFunctionGroup(APIPage InParent, APIFunctionKey InKey, IEnumerable<DoxygenEntity> InEntities)
     : this(InParent, InKey, InEntities.Select(x => x.Node))
 {
 }
示例#13
0
 public APIFunction(APIPage InParent, XmlNode InNode, APIFunctionKey InKey)
     : this(InParent, InNode, InKey, Utility.MakeLinkPath(InParent.LinkPath, InKey.GetLinkName()))
 {
 }
示例#14
0
 public APIFunction(APIPage InParent, DoxygenEntity InEntity, APIFunctionKey InKey)
     : this(InParent, InEntity.Node, InKey)
 {
 }