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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user