HLSL: add helper access methods to TAttributeMap

There was some code replication around getting string and integer
values out of an attribute map.  This adds new methods to the
TAttributeMap class to encapsulate some accessor details.
This commit is contained in:
LoopDawg
2017-10-10 14:59:40 -06:00
parent bb79abccb3
commit 52c087ff53
3 changed files with 85 additions and 56 deletions

View File

@@ -93,7 +93,16 @@ namespace glslang {
// True if entry exists in map (even if value is nullptr)
bool contains(TAttributeType) const;
// Obtain attribute as integer
bool getInt(TAttributeType attr, int& value, int argNum = 0) const;
// Obtain attribute as string, with optional to-lower transform
bool getString(TAttributeType attr, TString& value, int argNum = 0, bool convertToLower = true) const;
protected:
// Helper to get attribute const union
const TConstUnion* getConstUnion(TAttributeType attr, TBasicType, int argNum) const;
// Find an attribute enum given its name.
static TAttributeType attributeFromName(const TString& nameSpace, const TString& name);