本文整理汇总了C++中ExpressionResult::PrimitiveValue方法的典型用法代码示例。如果您正苦于以下问题:C++ ExpressionResult::PrimitiveValue方法的具体用法?C++ ExpressionResult::PrimitiveValue怎么用?C++ ExpressionResult::PrimitiveValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExpressionResult
的用法示例。
在下文中一共展示了ExpressionResult::PrimitiveValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setMessage
void
InspectorWindow::MessageReceived(BMessage* message)
{
switch (message->what) {
case MSG_THREAD_STATE_CHANGED:
{
::Thread* thread;
if (message->FindPointer("thread",
reinterpret_cast<void**>(&thread)) != B_OK) {
break;
}
BReference< ::Thread> threadReference(thread, true);
if (thread->State() == THREAD_STATE_STOPPED) {
if (fCurrentBlock != NULL) {
_SetCurrentBlock(NULL);
_SetToAddress(fCurrentAddress);
}
}
break;
}
case MSG_INSPECT_ADDRESS:
{
target_addr_t address = 0;
if (message->FindUInt64("address", &address) != B_OK) {
if (fAddressInput->TextView()->TextLength() == 0)
break;
fExpressionInfo->SetTo(fAddressInput->Text());
fListener->ExpressionEvaluationRequested(fLanguage,
fExpressionInfo);
} else
_SetToAddress(address);
break;
}
case MSG_EXPRESSION_EVALUATED:
{
BString errorMessage;
BReference<ExpressionResult> reference;
ExpressionResult* value = NULL;
if (message->FindPointer("value",
reinterpret_cast<void**>(&value)) == B_OK) {
reference.SetTo(value, true);
if (value->Kind() == EXPRESSION_RESULT_KIND_PRIMITIVE) {
Value* primitive = value->PrimitiveValue();
BVariant variantValue;
primitive->ToVariant(variantValue);
if (variantValue.Type() == B_STRING_TYPE) {
errorMessage.SetTo(variantValue.ToString());
} else {
_SetToAddress(variantValue.ToUInt64());
break;
}
}
} else {
status_t result = message->FindInt32("result");
errorMessage.SetToFormat("Failed to evaluate expression: %s",
strerror(result));
}
BAlert* alert = new(std::nothrow) BAlert("Inspect Address",
errorMessage.String(), "Close");
if (alert != NULL)
alert->Go();
break;
}
case MSG_NAVIGATE_PREVIOUS_BLOCK:
case MSG_NAVIGATE_NEXT_BLOCK:
{
if (fCurrentBlock != NULL) {
target_addr_t address = fCurrentBlock->BaseAddress();
if (message->what == MSG_NAVIGATE_PREVIOUS_BLOCK)
address -= fCurrentBlock->Size();
else
address += fCurrentBlock->Size();
BMessage setMessage(MSG_INSPECT_ADDRESS);
setMessage.AddUInt64("address", address);
PostMessage(&setMessage);
}
break;
}
case MSG_MEMORY_BLOCK_RETRIEVED:
{
TeamMemoryBlock* block = NULL;
status_t result;
if (message->FindPointer("block",
reinterpret_cast<void **>(&block)) != B_OK
|| message->FindInt32("result", &result) != B_OK) {
break;
}
if (result == B_OK) {
_SetCurrentBlock(block);
fPreviousBlockButton->SetEnabled(true);
fNextBlockButton->SetEnabled(true);
} else {
BString errorMessage;
//.........这里部分代码省略.........