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); }
private static CMakeItemDeclarations CreateSetXPropertyDeclarations( CMakeCommandId id, ParseRequest req, Source source, List <string> priorParameters) { bool afterPropsKeyword = false; if (priorParameters != null) { int index = priorParameters.FindIndex(x => x.Equals("PROPERTIES")); if (index >= 0) { afterPropsKeyword = true; if ((priorParameters.Count - index) % 2 == 1) { IEnumerable <string> properties = CMakeProperties.GetPropertiesForCommand(id); if (properties != null) { CMakeItemDeclarations decls = new CMakeItemDeclarations(); decls.AddItems(properties, CMakeItemDeclarations.ItemType.Property); return(decls); } } } } if (!afterPropsKeyword) { CMakeItemDeclarations decls; CMakePropertyType type = CMakeProperties.GetPropertyTypeFromCommand(id); if (_propObjMethods.ContainsKey(type)) { decls = _propObjMethods[type](id, req, source, priorParameters); } else { decls = new CMakeItemDeclarations(); } if ((priorParameters != null && priorParameters.Count > 0) || id == CMakeCommandId.SetSourceFilesProperties || id == CMakeCommandId.SetDirectoryProperties) { // The PROPERTIES can appear in the SET_SOURCE_FILES_PROPERTIES and // SET_DIRECTORY_PROPERTIES command without another parameter before // it. decls.AddItem("PROPERTIES", CMakeItemDeclarations.ItemType.Command); } return(decls); } return(null); }
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); }
private static CMakeItemDeclarations CreateSetPropertyDeclarations( CMakeCommandId id, ParseRequest req, Source source, List <string> priorParameters) { CMakeItemDeclarations decls = null; int propertyIndex = priorParameters.IndexOf("PROPERTY"); if (propertyIndex < 0) { CMakePropertyType type = CMakeProperties.GetPropertyTypeFromKeyword( priorParameters[0]); if (_propObjMethods.ContainsKey(type) && !priorParameters.Any(x => _setPropertyKeywords.Contains(x))) { decls = _propObjMethods[type](id, req, source, priorParameters); } else { decls = new CMakeItemDeclarations(); } if (priorParameters.Count > 1 || type == CMakePropertyType.Global) { decls.AddItems(_setPropertyKeywords, CMakeItemDeclarations.ItemType.Command); } decls.ExcludeItems(priorParameters.Skip(1)); } else if (propertyIndex == priorParameters.Count - 1) { CMakePropertyType type = CMakeProperties.GetPropertyTypeFromKeyword( priorParameters[0]); IEnumerable <string> properties = CMakeProperties.GetPropertiesOfType( type); decls = new CMakeItemDeclarations(); decls.AddItems(properties, CMakeItemDeclarations.ItemType.Property); } return(decls); }