bool SetCommand::execute(const String& command, InputStream* in, OutputStream* out) { if (in == nullptr || out == nullptr) { return false; } if (command != "SET") { return false; } String path(in->readStringUntil(' ')); String data(in->readLine()); std::unique_ptr<FirebaseSet> set(fbase().setPtr(path, EncodeForJson(data))); if (set->error()) { out->print("-FAIL "); out->println(set->error().message()); return false; } else { out->println("+OK"); return true; } }
bool GetCommand::execute(const String& command, InputStream* in, OutputStream* out) { if (in == nullptr || out == nullptr) { return false; } if (command != "GET") { return false; } String path = in->readLine(); std::unique_ptr<FirebaseGet> get(fbase().getPtr(path)); if (get->error()) { out->print("-FAIL "); out->println(get->error().message()); return false; } String value(get->response()); // TODO implement json parsing to pull and process value. out->print("+"); out->println(value); return true; }
bool PushCommand::execute(const String& command, InputStream* in, OutputStream* out) { if (in == nullptr || out == nullptr) { return false; } if (command != "PUSH") { return false; } std::string path(in->readStringUntil(' ').c_str()); std::string data(in->readLine().c_str()); std::unique_ptr<FirebasePush> push( fbase().pushPtr(path, EncodeForJson(data))); if (push->error()) { out->print("-FAIL "); out->println(push->error().message().c_str()); return false; } else { out->println("+OK"); return true; } }
static void se_savePixelsData(JNIEnv *env, jobject obj, jstring savePath, jstring imageKey) { const char* imageKey8 = env->GetStringUTFChars(imageKey, 0); const char* savePath8 = env->GetStringUTFChars(savePath, 0); SE_ImageDataID imageDataid(imageKey8); SE_ResourceManager *resourceManager = SE_Application::getInstance()->getResourceManager(); SE_ImageData* imgd = resourceManager->getImageData(imageDataid); if (imgd) { SE_File fbase(savePath8, SE_File::WRITE); fbase.write(imgd->getData(), imgd->getHeight() * imgd->getBytesPerRow()); LOGI("SEHome:#################savePixelsData success!!!"); } env->ReleaseStringUTFChars(imageKey, imageKey8); env->ReleaseStringUTFChars(savePath, savePath8); }
void ASE_Loader::Write(const char* dataPath, const char* outFileName) { SE_BufferOutput outBase, outScene; SE_BufferOutput outBaseHeader, outSceneHeader; Write(outBase, outScene, dataPath); writeHeader(outBaseHeader, outBase.getDataLen()); writeHeader(outSceneHeader, outScene.getDataLen()); std::string outBaseFileName(outFileName); outBaseFileName = outBaseFileName + "_basedata.cbf"; SE_File fbase(outBaseFileName.c_str(), SE_File::WRITE); fbase.write(outBaseHeader); fbase.write(outBase); std::string outSceneFileName(outFileName); outSceneFileName = outSceneFileName + "_scene.cbf"; SE_File fscene(outSceneFileName.c_str(), SE_File::WRITE); fscene.write(outSceneHeader); fscene.write(outScene); }
/** * @brief Returns template expression that generates Rrectangular window of length @c size */ KFR_FUNCTION internal::expression_rectangular<fbase> window_rectangular(size_t size) { return internal::expression_rectangular<fbase>(size, fbase()); }