bool NFCRecord::SetVector3(const int nRow, const int nCol, const NFVector3& value) { if (!ValidPos(nRow, nCol)) { return false; } if (TDATA_VECTOR3 != GetColType(nCol)) { return false; } if (!IsUsed(nRow)) { return false; } NFData var; var.SetVector3(value); NF_SHARE_PTR<NFData>& pVar = mtRecordVec.at(GetPos(nRow, nCol)); //must have memory if (nullptr == pVar) { return false; } if (var == *pVar) { return false; } if (mtRecordCallback.size() == 0) { pVar->SetVector3(value); } else { NFData oldValue; oldValue.SetVector3(pVar->GetVector3()); pVar->SetVector3(value); RECORD_EVENT_DATA xEventData; xEventData.nOpType = RECORD_EVENT_DATA::Update; xEventData.nRow = nRow; xEventData.nCol = nCol; xEventData.strRecordName = mstrRecordName; OnEventHandler(mSelf, xEventData, oldValue, *pVar); } return true; }
NFDATA_TYPE NFCClassModule::ComputerType(const char* pstrTypeName, NFData& var) { if (0 == strcmp(pstrTypeName, "int")) { var.SetInt(NULL_INT); return var.GetType(); } else if (0 == strcmp(pstrTypeName, "string")) { var.SetString(NULL_STR); return var.GetType(); } else if (0 == strcmp(pstrTypeName, "float")) { var.SetFloat(NULL_FLOAT); return var.GetType(); } else if (0 == strcmp(pstrTypeName, "object")) { var.SetObject(NULL_OBJECT); return var.GetType(); } else if (0 == strcmp(pstrTypeName, "vector2")) { var.SetVector2(NULL_VECTOR2); return var.GetType(); } else if (0 == strcmp(pstrTypeName, "vector3")) { var.SetVector3(NULL_VECTOR3); return var.GetType(); } return TDATA_UNKNOWN; }