public UxlDeclare(Source src, UxlDeclareType type, SourceValue key, SourceValue?cond) { Source = src; Type = type; Key = key; Condition = cond; }
void ParseDeclare(UxlDocument doc) { Source src = null; UxlDeclareType type = 0; SourceValue? key = null; SourceValue? cond = null; SourceValue? targetDir = null; ParseAttributes( name => { switch (name) { case "Condition": cond = GetValue(); return(true); case "TargetDirectory": targetDir = GetValue(); return(true); default: UxlDeclareType et; if (Enum.TryParse(name, out et) && et != UxlDeclareType.Unknown) { if (type != 0) { Log.Error(GetSource(), ErrorCode.E0000, "A (ElementType)=\"(Key)\" attribute was already found on <Declare>"); } src = GetSource(); type = et; key = GetValue(); return(true); } return(false); } }); if (type == 0) { Log.Error(GetSource(), ErrorCode.E0000, "Expected a (ElementType)=\"(Key)\" attribute on <Declare>"); } else { doc.Declarations.Add(new UxlDeclare(src, type, key ?? new SourceValue(), cond)); } if (targetDir != null && key != null) { doc.Elements.Add(new UxlElement(UxlElementType.Set, new SourceValue(targetDir.Value.Source, key.Value.String + ".TargetDirectory"), targetDir.Value, null, false)); } ParseEmptyElement(); }
HashSet <string> GetDeclarationSet(UxlDeclareType type) { switch (type) { case UxlDeclareType.Element: return(_root.ElementDefinitions); case UxlDeclareType.TypeElement: return(_root.TypeElementDefinitions); case UxlDeclareType.TypeProperty: return(_root.TypePropertyDefinitions); case UxlDeclareType.MethodProperty: return(_root.MethodPropertyDefinitions); default: return(null); } }