本文整理汇总了C++中QTSSDictionaryMap::GetAttrFunction方法的典型用法代码示例。如果您正苦于以下问题:C++ QTSSDictionaryMap::GetAttrFunction方法的具体用法?C++ QTSSDictionaryMap::GetAttrFunction怎么用?C++ QTSSDictionaryMap::GetAttrFunction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTSSDictionaryMap
的用法示例。
在下文中一共展示了QTSSDictionaryMap::GetAttrFunction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QTSS_DoService
QTSS_Error QTSSCallbacks::QTSS_DoService(QTSS_ServiceID inID, QTSS_ServiceFunctionArgsPtr inArgs)
{
// Make sure that the service ID is in fact valid
QTSSDictionaryMap* theMap = QTSSDictionaryMap::GetMap(QTSSDictionaryMap::kServiceDictIndex);
SInt32 theIndex = theMap->ConvertAttrIDToArrayIndex(inID);
if (theIndex < 0)
return QTSS_IllegalService;
// Get the service function
QTSS_ServiceFunctionPtr theFunction = (QTSS_ServiceFunctionPtr)theMap->GetAttrFunction(theIndex);
// Invoke it, return the result.
return (theFunction)(inArgs);
}
示例2: GetValuePtr
QTSS_Error QTSSDictionary::GetValuePtr(QTSS_AttributeID inAttrID, UInt32 inIndex,
void** outValueBuffer, UInt32* outValueLen,
Bool16 isInternal)
{
// Check first to see if this is a static attribute or an instance attribute
QTSSDictionaryMap* theMap = fMap;
DictValueElement* theAttrs = fAttributes;
if (QTSSDictionaryMap::IsInstanceAttrID(inAttrID))
{
theMap = fInstanceMap;
theAttrs = fInstanceAttrs;
}
if (theMap == NULL)
return QTSS_AttrDoesntExist;
SInt32 theMapIndex = theMap->ConvertAttrIDToArrayIndex(inAttrID);
if (theMapIndex < 0)
return QTSS_AttrDoesntExist;
if (theMap->IsRemoved(theMapIndex))
return QTSS_AttrDoesntExist;
if ((!isInternal) && (!theMap->IsPreemptiveSafe(theMapIndex)) && !this->IsLocked())
return QTSS_NotPreemptiveSafe;
// An iterated attribute cannot have a param retrieval function
if ((inIndex > 0) && (theMap->GetAttrFunction(theMapIndex) != NULL))
return QTSS_BadIndex;
// Check to make sure the index parameter is legal
if ((inIndex > 0) && (inIndex >= theAttrs[theMapIndex].fNumAttributes))
return QTSS_BadIndex;
// Retrieve the parameter
char* theBuffer = theAttrs[theMapIndex].fAttributeData.Ptr;
*outValueLen = theAttrs[theMapIndex].fAttributeData.Len;
Bool16 cacheable = theMap->IsCacheable(theMapIndex);
if ( (theMap->GetAttrFunction(theMapIndex) != NULL) && ((cacheable && (*outValueLen == 0)) || !cacheable) )
{
// If function is cacheable:
// If the parameter doesn't have a value assigned yet, and there is an attribute
// retrieval function provided, invoke that function now.
// If function is *not* cacheable:
// always call the function
theBuffer = (char*)theMap->GetAttrFunction(theMapIndex)(this, outValueLen);
//If the param retrieval function didn't return an explicit value for this attribute,
//refetch the parameter out of the array, in case the function modified it.
if (theBuffer == NULL)
{
theBuffer = theAttrs[theMapIndex].fAttributeData.Ptr;
*outValueLen = theAttrs[theMapIndex].fAttributeData.Len;
}
}
#if DEBUG
else
// Make sure we aren't outside the bounds of attribute memory
Assert(theAttrs[theMapIndex].fAllocatedLen >=
(theAttrs[theMapIndex].fAttributeData.Len * (theAttrs[theMapIndex].fNumAttributes)));
#endif
// Return an error if there is no data for this attribute
if (*outValueLen == 0)
return QTSS_ValueNotFound;
theBuffer += theAttrs[theMapIndex].fAttributeData.Len * inIndex;
*outValueBuffer = theBuffer;
// strings need an extra dereference - moved it up
if ((theMap->GetAttrType(theMapIndex) == qtssAttrDataTypeCharArray) && (theAttrs[theMapIndex].fNumAttributes > 1))
{
char** string = (char**)theBuffer;
*outValueBuffer = *string;
//*outValueLen = strlen(*string) + 1;
*outValueLen = strlen(*string);
}
return QTSS_NoErr;
}