Ejemplo n.º 1
0
        private static CMakeItemDeclarations CreateGetXPropertyDeclarations(
            CMakeCommandId id, ParseRequest req, Source source,
            List <string> priorParameters)
        {
            int priorParameterCount =
                priorParameters != null ? priorParameters.Count : 0;

            if (priorParameterCount == CMakeProperties.GetPropertyParameterIndex(id))
            {
                IEnumerable <string> properties = CMakeProperties.GetPropertiesForCommand(id);
                if (properties != null)
                {
                    CMakeItemDeclarations decls = new CMakeItemDeclarations();
                    decls.AddItems(properties, CMakeItemDeclarations.ItemType.Property);
                    if (id == CMakeCommandId.GetDirectoryProperty)
                    {
                        // The DIRECTORY keyword can be specified before the property
                        // to set a property of a different directory.
                        decls.AddItem("DIRECTORY",
                                      CMakeItemDeclarations.ItemType.Command);
                    }
                    return(decls);
                }
            }
            else if (priorParameterCount == CMakeProperties.GetObjectParameterIndex(id))
            {
                CMakePropertyType type = CMakeProperties.GetPropertyTypeFromCommand(id);
                if (_propObjMethods.ContainsKey(type))
                {
                    CMakeItemDeclarations decls = _propObjMethods[type](id, req, source,
                                                                        priorParameters);
                    return(decls);
                }
            }
            else if (id == CMakeCommandId.GetDirectoryProperty &&
                     priorParameterCount == 2 && priorParameters[1] == "DIRECTORY")
            {
                return(CreateSubdirectoryDeclarations(id, req, source, priorParameters));
            }
            else if (id == CMakeCommandId.GetDirectoryProperty &&
                     priorParameterCount == 3 && priorParameters[1] == "DIRECTORY")
            {
                IEnumerable <string> properties = CMakeProperties.GetPropertiesForCommand(
                    CMakeCommandId.GetDirectoryProperty);
                if (properties != null)
                {
                    CMakeItemDeclarations decls = new CMakeItemDeclarations();
                    decls.AddItems(properties, CMakeItemDeclarations.ItemType.Property);
                    return(decls);
                }
            }
            return(null);
        }
Ejemplo n.º 2
0
        private static CMakeItemDeclarations CreateGetPropertyDeclarations(
            CMakeCommandId id, ParseRequest req, Source source,
            List <string> priorParameters)
        {
            CMakeItemDeclarations decls = null;

            if (priorParameters != null)
            {
                if (priorParameters.Count == 1)
                {
                    decls = new CMakeItemDeclarations();
                    decls.AddItems(CMakeProperties.GetPropertyTypeKeywords(),
                                   CMakeItemDeclarations.ItemType.Command);
                }
                else if (priorParameters.Count > 2 &&
                         priorParameters[priorParameters.Count - 1] == "PROPERTY")
                {
                    IEnumerable <string> properties = CMakeProperties.GetPropertiesOfType(
                        CMakeProperties.GetPropertyTypeFromKeyword(
                            priorParameters[1]));
                    decls = new CMakeItemDeclarations();
                    decls.AddItems(properties, CMakeItemDeclarations.ItemType.Property);
                }
                else if (priorParameters.Count == 2)
                {
                    CMakePropertyType type = CMakeProperties.GetPropertyTypeFromKeyword(
                        priorParameters[1]);
                    if (_propObjMethods.ContainsKey(type))
                    {
                        decls = _propObjMethods[type](id, req, source, priorParameters);
                    }
                    else
                    {
                        decls = new CMakeItemDeclarations();
                    }
                    if (!CMakeProperties.IsObjectRequired(type))
                    {
                        decls.AddItem("PROPERTY",
                                      CMakeItemDeclarations.ItemType.Command);
                    }
                }
                else if (priorParameters.Count == 3)
                {
                    decls = new CMakeItemDeclarations();
                    decls.AddItem("PROPERTY", CMakeItemDeclarations.ItemType.Command);
                }
            }
            return(decls);
        }