static string GetValueExpression(XmlBindings.EnumValue xmlData) { // // Value and NumericalValue seem like they should be the same, but they're not. // // Value may be an int literal, or some other symbol. // NumericalValue is always an int literal (may be hex or dec) // // NumericalValue is used for Direct2D's internal codegen, in cases where the // symbol used for Value can't be referenced in the event manifest. // // And so, the int literal is decided according to the following priority // 1. NumericalValue if avail // 2. Value, must always be parseable as int literal // if (xmlData.NumericalValue != null) { return(xmlData.NumericalValue); } else { Debug.Assert(xmlData.Value != null); return(xmlData.Value); } }
public EnumValue(XmlBindings.EnumValue xmlData, Overrides.XmlBindings.EnumValue overrides) { m_nativeName = xmlData.Name; m_stylizedName = Formatter.StylizeNameFromUnderscoreSeparators(xmlData.Name); m_shouldProject = true; if (overrides != null) { if (overrides.ProjectedNameOverride != null) { m_stylizedName = overrides.ProjectedNameOverride; } m_shouldProject = overrides.ShouldProject; } m_valueExpression = GetValueExpression(xmlData); }
public EnumValue(XmlBindings.EnumValue xmlData, string containingEnumName, Overrides.XmlBindings.EnumValue overrides) { m_rawNameComponent = xmlData.Name; m_nativeName = containingEnumName + "_" + m_rawNameComponent; m_stylizedName = Formatter.StylizeNameFromUnderscoreSeparators(xmlData.Name); m_shouldProject = true; m_valueExpression = GetValueExpression(xmlData); if (overrides != null) { if (overrides.ProjectedNameOverride != null) { m_stylizedName = overrides.ProjectedNameOverride; } if (overrides.ProjectedValueOverride != null) { m_valueExpression = overrides.ProjectedValueOverride; } m_shouldProject = overrides.ShouldProject; } }