Exemple #1
0
bool ItemAttributes::hasAttribute(itemAttrTypes type) const
{
	if(!validateIntAttrType(type))
		return false;

	Attribute* attr = getAttrConst(type);
	if(attr){
		return true;
	}

	return false;
}
Exemple #2
0
uint32_t ItemAttributes::getIntAttr(itemAttrTypes type) const
{
	if (!validateIntAttrType(type)) {
		return 0;
	}

	Attribute* attr = getAttrConst(type);
	if (attr) {
		return static_cast<uint32_t>(0xFFFFFFFF & reinterpret_cast<ptrdiff_t>(attr->value));
	} else {
		return 0;
	}
}
Exemple #3
0
const std::string& ItemAttributes::getStrAttr(itemAttrTypes type) const
{
	if (!validateStrAttrType(type)) {
		return emptyString;
	}

	Attribute* attr = getAttrConst(type);
	if (attr) {
		return *(std::string*)attr->value;
	} else {
		return emptyString;
	}
}
Exemple #4
0
const std::string& ItemAttributes::getStrAttr(itemAttrTypes type) const
{
	if(!validateStrAttrType(type))
		return emptyString;

	//this will *NOT* create the attribute if it does not exist
	Attribute* attr = getAttrConst(type);
	if(attr){
		return *(std::string*)attr->value;
	}
	else{
		return emptyString;
	}
}
Exemple #5
0
const std::string& ItemAttributes::getStrAttr(const itemAttrTypes& type) const
{
	static const std::string EMPTY_STRING;

	if (!validateStrAttrType(type))
	{
		return EMPTY_STRING;
	}

	//this will *NOT* create the attribute if it does not exist
	Attribute* attr = getAttrConst(type);

	if (attr)
	{
		return *(std::string*)attr->value;
	}
	else
	{
		return EMPTY_STRING;
	}
}