Example #1
0
        private void TranslateEnumGroups(XmlSpecData spec, DotNetApiData api, Options options)
        {
            foreach (var specEnumGroup in spec.EnumGroups.Where(x => options.EnumGroupFilter(x.Name)))
            {
                var enumGroupData = new DotNetEnumGroupData()
                {
                    Name = specEnumGroup.Name,
                };

                foreach (var enumName in specEnumGroup.Enums.Distinct())
                {
                    var xmlEnumData = spec.Enums.SingleOrDefault(x => x.Name == enumName);

                    if (xmlEnumData == null || !options.EnumFilter(xmlEnumData))
                        continue;

                    var enumData = api.Enums.SingleOrDefault(x => x.OriginalName == enumName);

                    if (enumData == null)
                        continue;

                    enumGroupData.Enums.Add(enumData);

                    if (spec.Enums.Single(x => x.Name == enumName).Type == "bitmask")
                        enumGroupData.IsFlags = true;
                }

                api.EnumGroups.Add(enumGroupData);
            }
        }