//------------------------------------------------------------------------------------- PyObject* Space::__py_GetSpaceData(PyObject* self, PyObject* args) { SPACE_ID spaceID = 0; if(PyTuple_Size(args) != 2) { PyErr_Format(PyExc_AssertionError, "KBEngine::getSpaceData: (argssize != (spaceID, key)) is error!"); PyErr_PrintEx(0); return 0; } char* key = NULL; if(PyArg_ParseTuple(args, "Is", &spaceID, &key) == -1) { PyErr_Format(PyExc_AssertionError, "KBEngine::getSpaceData: args is error!"); PyErr_PrintEx(0); return 0; } if(key == NULL) { PyErr_Format(PyExc_AssertionError, "KBEngine::getSpaceData: key not is string!"); PyErr_PrintEx(0); return 0; } if(strlen(key) == 0) { PyErr_Format(PyExc_AssertionError, "KBEngine::getSpaceData: key is empty!"); PyErr_PrintEx(0); return 0; } Space* space = Spaces::findSpace(spaceID); if(space == NULL) { PyErr_Format(PyExc_AssertionError, "KBEngine::getSpaceData: (spaceID=%u) not found!", spaceID); PyErr_PrintEx(0); return 0; } if(!space->hasSpaceData(key)) { PyErr_Format(PyExc_AssertionError, "KBEngine::getSpaceData: (spaceID=%u, key=%s) not found!", spaceID, key); PyErr_PrintEx(0); return 0; } return PyUnicode_FromString(space->getSpaceData(key).c_str()); }
//------------------------------------------------------------------------------------- PyObject* Space::__py_DelSpaceData(PyObject* self, PyObject* args) { SPACE_ID spaceID = 0; if(PyTuple_Size(args) != 2) { PyErr_Format(PyExc_AssertionError, "KBEngine::delSpaceData: (argssize != (spaceID, key)) is error!"); PyErr_PrintEx(0); return 0; } char* key = NULL; if(PyArg_ParseTuple(args, "Is", &spaceID, &key) == -1) { PyErr_Format(PyExc_AssertionError, "KBEngine::delSpaceData: args is error!"); PyErr_PrintEx(0); return 0; } if(key == NULL) { PyErr_Format(PyExc_AssertionError, "KBEngine::delSpaceData: key not is string!"); PyErr_PrintEx(0); return 0; } if(strlen(key) == 0) { PyErr_Format(PyExc_AssertionError, "KBEngine::delSpaceData: key is empty!"); PyErr_PrintEx(0); return 0; } Space* space = Spaces::findSpace(spaceID); if(space == NULL) { PyErr_Format(PyExc_AssertionError, "KBEngine::delSpaceData: (spaceID=%u) not found!", spaceID); PyErr_PrintEx(0); return 0; } if(!space->hasSpaceData(key)) { PyErr_Format(PyExc_AssertionError, "KBEngine::delSpaceData: (spaceID=%u, key=%s) not found!", spaceID, key); PyErr_PrintEx(0); return 0; } if(kbe_stricmp(key, "_mapping") == 0) { PyErr_Format(PyExc_AssertionError, "KBEngine::delSpaceData: key{_mapping} is protected!", spaceID); PyErr_PrintEx(0); return 0; } space->delSpaceData(key); S_Return; }