1/*
2 * Copyright (C) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#ifndef HIVIEWDFX_UTILS_NATIVE_FILE_UTILS_H_
16#define HIVIEWDFX_UTILS_NATIVE_FILE_UTILS_H_
17#include <cstdio>
18#include <cstdlib>
19#include <cstring>
20#include <string>
21#include <fstream>
22#include <sstream>
23#include <iostream>
24#include <chrono>
25#include <unistd.h>
26#include <sys/types.h>
27#include <sys/stat.h>
28#include <dirent.h>
29#include <vector>
30
31bool CheckInfo(std::vector<std::string> &para, std::string eventinfo);
32int ExecCmdWithRet(std::string cmd, std::vector<std::string> &resvec);
33std::string ReadFile(std::string filename);
34void RedirecthiLog(std::string &hilogredirect, std::string &timeout);
35void ExeCmd(std::string cmd);
36void CmdRun(std::string cmd, std::string &result);
37std::string ExecuteCmd(std::string cmd);
38bool CompareString(const std::string& x, const std::string& y);
39int GetTxtLine(std::string filename);
40std::string ReadFile(std::string filename);
41void CleanCmd();
42std::string ReadOneLine(std::string m_path, char* rBuf, int n);
43void SaveCmdOutput(std::string cmd, std::string saveFile);
44std::vector<std::string> getfileinpath(std::string path);
45#endif // HIVIEWDFX_UTILS_NATIVE_FILE_UTILS_H_
46