示例#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);
	}
}
示例#2
0
CString ExpBase::GetString() const
{
	switch (eType) {
	case EXPTYPE_INTEGER:
		{
			char strbuf[32];
			_i64toa(eData.iVal, strbuf, 10);
			return strbuf;
		}
	case EXPTYPE_FLOAT:
		{
			char strbuf[32];
			_gcvt(eData.fVal, DBL_DIG, strbuf);
			CString str = strbuf;
			if (str.Right(1) == ".")
				str.Delete(str.GetLength() - 1);
			return str;
		}
	case EXPTYPE_STRING:
		return (const char*)*(eData.str);
	case EXPTYPE_ARRAY:
		{
		// Build an expression style array string eg {1, 3, 5, 6}
		CString s = "{";

		ExpStore* ptr = eData.arr.pArray;
		ExpStore* end = eData.arr.pArray + eData.arr.size;
		ExpStore* last = end - 1;

		for ( ; ptr != end; ptr++) {

			bool isString = (ptr->Type() == EXPTYPE_STRING);

			if (isString)
				s += '"';

			s += (const char*)(ptr->GetString());

			if (isString)
				s += '"';

			if (ptr != last)
				s += ", ";
		}

		s += "}";

		return s;
		}
	default:
		return "";
	}
}