Ejemplo n.º 1
0
        /// <summary>
        /// Adds all of the specified preprocessor definitions to this VCProject's list of preprocessor definitions for all modules in the project
        /// </summary>
        /// <param name="NewPreprocessorDefinitions">List of preprocessor definitons to add</param>
        public void AddIntelliSensePreprocessorDefinitions(List <string> NewPreprocessorDefinitions)
        {
            foreach (var CurDef in NewPreprocessorDefinitions)
            {
                if (KnownIntelliSensePreprocessorDefinitions.Add(CurDef))
                {
                    // Make sure that it doesn't exist already
                    var AlreadyExists  = false;
                    var CurDefAndValue = SplitDefinitionAndValue(CurDef);
                    for (int DefineIndex = 0; DefineIndex < IntelliSensePreprocessorDefinitions.Count; ++DefineIndex)
                    {
                        var ExistingDefAndValue = SplitDefinitionAndValue(IntelliSensePreprocessorDefinitions[DefineIndex]);
                        if (ExistingDefAndValue.Key == CurDefAndValue.Key)
                        {
                            // Favor defines that set their value to 1 and replace the old one if it was set to "0"
                            if (CurDefAndValue.Value == "1" && ExistingDefAndValue.Value == "0")
                            {
                                IntelliSensePreprocessorDefinitions[DefineIndex] = CurDef;
                            }
                            AlreadyExists = true;
                            break;
                        }
                    }

                    if (!AlreadyExists)
                    {
                        IntelliSensePreprocessorDefinitions.Add(CurDef);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds all of the specified preprocessor definitions to this VCProject's list of preprocessor definitions for all modules in the project
        /// </summary>
        /// <param name="NewPreprocessorDefinitions">List of preprocessor definitons to add</param>
        public void AddIntelliSensePreprocessorDefinitions(List <string> NewPreprocessorDefinitions)
        {
            if (ProjectFileGenerator.OnlyGenerateIntelliSenseDataForProject == null ||
                ProjectFileGenerator.OnlyGenerateIntelliSenseDataForProject == this)
            {
                foreach (string CurDef in NewPreprocessorDefinitions)
                {
                    // Don't add definitions and value combinations that have already been added for this project
                    if (KnownIntelliSensePreprocessorDefinitions.Add(CurDef))
                    {
                        // Go ahead and check to see if the definition already exists, but the value is different
                        bool AlreadyExists = false;

                        string Def, Value;
                        SplitDefinitionAndValue(CurDef, out Def, out Value);
                        for (int DefineIndex = 0; DefineIndex < IntelliSensePreprocessorDefinitions.Count; ++DefineIndex)
                        {
                            string ExistingDef, ExistingValue;
                            SplitDefinitionAndValue(IntelliSensePreprocessorDefinitions[DefineIndex], out ExistingDef, out ExistingValue);
                            if (ExistingDef == Def)
                            {
                                // Already exists, but the value is changing.  We don't bother clobbering values for existing defines for this project.
                                AlreadyExists = true;
                                break;
                            }
                        }

                        if (!AlreadyExists)
                        {
                            IntelliSensePreprocessorDefinitions.Add(CurDef);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds all of the specified preprocessor definitions to this VCProject's list of preprocessor definitions for all modules in the project
        /// </summary>
        /// <param name="NewPreprocessorDefinitions">List of preprocessor definitons to add</param>
        public void AddIntelliSensePreprocessorDefinitions(List <string> NewPreprocessorDefinitions)
        {
            foreach (string NewPreprocessorDefinition in NewPreprocessorDefinitions)
            {
                // Don't add definitions and value combinations that have already been added for this project
                string CurDef = NewPreprocessorDefinition;
                if (KnownIntelliSensePreprocessorDefinitions.Add(CurDef))
                {
                    // Go ahead and check to see if the definition already exists, but the value is different
                    bool AlreadyExists = false;

                    string Def, Value;
                    SplitDefinitionAndValue(CurDef, out Def, out Value);

                    // Ignore any API macros being import/export; we'll assume they're valid across the whole project
                    if (Def.EndsWith("_API", StringComparison.Ordinal))
                    {
                        CurDef = Def + "=";
                        CurDef = Def + "_TYPE=";
                        Value  = "";
                    }

                    for (int DefineIndex = 0; DefineIndex < IntelliSensePreprocessorDefinitions.Count; ++DefineIndex)
                    {
                        string ExistingDef, ExistingValue;
                        SplitDefinitionAndValue(IntelliSensePreprocessorDefinitions[DefineIndex], out ExistingDef, out ExistingValue);
                        if (ExistingDef == Def)
                        {
                            // Already exists, but the value is changing.  We don't bother clobbering values for existing defines for this project.
                            AlreadyExists = true;
                            break;
                        }
                    }

                    if (!AlreadyExists)
                    {
                        IntelliSensePreprocessorDefinitions.Add(CurDef);
                    }
                }
            }
        }