Lines Matching refs:content
36 bool RustLoadStringFromFile(const rust::String& filePath, rust::String& content)
39 std::string tmpContent(content);
41 content = tmpContent;
47 bool RustLoadStringFromFd(int fd, rust::String& content)
49 std::string tmpContent(content);
51 content = tmpContent;
57 bool RustLoadBufferFromFile(const rust::String& filePath, rust::vec<char>& content)
60 std::vector<char> tmpContent(content.begin(), content.end());
62 std::copy(tmpContent.begin(), tmpContent.end(), std::back_inserter(content));
68 bool RustSaveBufferToFile(const rust::String& filePath, const rust::vec<char>& content, bool truncated)
71 std::vector<char> tmpContent(content.begin(), content.end());
75 bool RustSaveStringToFile(const rust::String& filePath, const rust::String& content, bool truncated)
78 std::string tmpContent(content);
82 bool RustSaveStringToFd(int fd, const rust::String& content)
84 std::string tmpContent(content);
110 bool LoadStringFromFile(const string& filePath, string& content)
125 content.clear();
127 copy(istreambuf_iterator<char>(file), istreambuf_iterator<char>(), back_inserter(content));
149 bool LoadStringFromFdToFile(int fd, string& content)
157 if (!LoadStringFromFile(fileName, content)) {
164 bool LoadStringFromFd(int fd, string& content)
179 return LoadStringFromFdToFile(fd, content);
186 content.resize(fileLength);
193 const ssize_t len = read(fd, content.data(), fileLength);
203 bool SaveStringToFile(const std::string& filePath, const std::string& content, bool truncated /*= true*/)
205 if (content.empty()) {
206 UTILS_LOGI("content is empty, no need to save!");
222 file.write(content.c_str(), content.length());
224 UTILS_LOGE("write content to file failed!file:%{private}s, content:%{private}s",
225 filePath.c_str(), content.c_str());
231 bool SaveStringToFd(int fd, const std::string& content)
238 if (content.empty()) {
239 UTILS_LOGI("content is empty, no need to save!");
243 const ssize_t len = write(fd, content.c_str(), content.length());
249 if (static_cast<unsigned long>(len) != content.length()) {
251 len, content.length());
258 bool LoadBufferFromNodeFile(const string& filePath, vector<char>& content)
279 content.clear();
283 content.push_back(ch);
294 bool LoadBufferFromFile(const string& filePath, vector<char>& content)
312 return LoadBufferFromNodeFile(filePath, content);
316 content.clear();
326 content.resize(fileLength);
327 file.read(&content[0], fileLength);
331 bool SaveBufferToFile(const string& filePath, const vector<char>& content, bool truncated /*= true*/)
333 if (content.empty()) {
334 UTILS_LOGI("content is empty, no need to save!");
347 file.write(&content[0], content.size());