Beispiel #1
0
void CObjectsPage::AddPrivateVariableInspectItems()
{
	// Inspecting private variables: if no pointer, get and update.  We only need to get the pointer once.
	if (pCurrentVars == NULL) {
		pMyObject->DebuggerUpdateDisplay(pCurrentVars);

		// Still null:  quit.
		if (pCurrentVars == NULL)
			return;
	}

	int numVars = pMyObject->pType->privateVars.size();

	ExpStore* i = pCurrentVars;
	ExpStore* end = i + numVars;
	int index = 0;

	for ( ; i != end; i++, index++) {
		CString s;
		s.Format("'%s'", pMyObject->pType->privateVars[index].name);

		if (i->Type() == EXPTYPE_STRING)
			pRuntime->AddDebuggerItem(s, (const char*)*(i->GetStringPtr()), false);
		else
			pRuntime->AddDebuggerItem(s, i->GetString(), false);
	}
}
ExpStore::ExpStore(const ExpStore& r) {
	switch (r.Type()) {
	case EXPTYPE_STRING:
		eData.str = new CString;
		*(eData.str) = (const char*)*(r.GetStringPtr());
		break;
	case EXPTYPE_ARRAY:
		{
			const int size = eData.arr.size = r.eData.arr.size;
			eData.arr.pArray = new ExpStore[size];
			for( int i = 0; i < eData.arr.size; i++)
				eData.arr.pArray[i] = ExpStore( r.eData.arr.pArray[i] );
		}
		break;
	default:
		// Other types can simply copy the eData union content
		eData.iVal = r.eData.iVal;
	}

	eType = r.Type();
}