public static string TryParse(string code, out ChartColumnType type) { if (fromCodes.TryGetValue(code, out type)) { return(null); } return("{0} is not a valid type code, use {1} instead".FormatWith(code, fromCodes.Keys.CommaOr())); }
public static bool IsChartColumnType(QueryToken token, ChartColumnType ct) { if (token == null) return false; var type = token.GetChartColumnType(); if(type == null) return false; return Flag(ct, type.Value); }
public static string GetComposedCode(this ChartColumnType columnType) { var result = columnType.GetCode(); if (result.HasText()) { return(result); } return(EnumExtensions.GetValues <ChartColumnType>() .Where(a => (int)a < ChartColumnTypeUtils.GroupMargin && columnType.HasFlag(a)) .ToString(GetCode, ",")); }
public static string?TryParseComposed(string code, out ChartColumnType type) { type = default(ChartColumnType); foreach (var item in code.Split(',')) { string?error = TryParse(item, out ChartColumnType temp); if (error.HasText()) { return(error); } type |= temp; } return(null); }
public static bool IsChartColumnType(QueryToken token, ChartColumnType ct) { if (token == null) { return(false); } var type = token.GetChartColumnType(); if (type == null) { return(false); } return(Flag(ct, type.Value)); }
public ChartScriptColumn(string displayName, ChartColumnType columnType) { this.DisplayName = displayName; this.ColumnType = columnType; }
public static string GetCode(this ChartColumnType columnType) { return(codes.GetOrThrow(columnType)); }
public static bool Flag(ChartColumnType ct, ChartColumnType flag) { return((ct & flag) == flag); }
public static string TryParseComposed(string code, out ChartColumnType type) { type = default(ChartColumnType); foreach (var item in code.Split(',')) { ChartColumnType temp; string error = TryParse(item, out temp); if (error.HasText()) return error; type |= temp; } return null; }
public static string TryParse(string code, out ChartColumnType type) { if (fromCodes.TryGetValue(code, out type)) return null; return "{0} is not a valid type code, use {1} instead".FormatWith(code, fromCodes.Keys.CommaOr()); }
public static bool Flag(ChartColumnType ct, ChartColumnType flag) { return (ct & flag) == flag; }