本文整理汇总了C++中ArrayType::CountDimensions方法的典型用法代码示例。如果您正苦于以下问题:C++ ArrayType::CountDimensions方法的具体用法?C++ ArrayType::CountDimensions怎么用?C++ ArrayType::CountDimensions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayType
的用法示例。
在下文中一共展示了ArrayType::CountDimensions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: strerror
status_t
ArrayValueNodeChild::ResolveLocation(ValueLoader* valueLoader,
ValueLocation*& _location)
{
// get the parent (== array) location
ValueLocation* parentLocation = fParent->Location();
if (parentLocation == NULL)
return B_BAD_VALUE;
// create an array index path
ArrayType* arrayType = fParent->GetArrayType();
int32 dimensionCount = arrayType->CountDimensions();
// add dummy indices first -- we'll replace them on our way back through
// our ancestors
ArrayIndexPath indexPath;
for (int32 i = 0; i < dimensionCount; i++) {
if (!indexPath.AddIndex(0))
return B_NO_MEMORY;
}
AbstractArrayValueNodeChild* child = this;
for (int32 i = dimensionCount - 1; i >= 0; i--) {
indexPath.SetIndexAt(i, child->ElementIndex());
child = dynamic_cast<AbstractArrayValueNodeChild*>(
child->ArrayParent()->NodeChild());
}
// resolve the element location
ValueLocation* location;
status_t error = arrayType->ResolveElementLocation(indexPath,
*parentLocation, location);
if (error != B_OK) {
TRACE_LOCALS("ArrayValueNodeChild::ResolveLocation(): "
"ResolveElementLocation() failed: %s\n", strerror(error));
return error;
}
_location = location;
return B_OK;
}