63 lines
1.8 KiB
C++
63 lines
1.8 KiB
C++
/*********************************************************************
|
|
*
|
|
* 文 件: FileStream.h 文件读写
|
|
*
|
|
* 版权所有: Shanghai Baosight Software Co., Ltd.
|
|
*
|
|
* 概述:
|
|
* :
|
|
* :
|
|
*
|
|
* 版本历史
|
|
* 1.0 2022-11-21
|
|
*********************************************************************/
|
|
#ifndef _FILESTREAM_H_
|
|
#define _FILESTREAM_H_
|
|
#include <string>
|
|
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
#define CS_S_ENVIRONMENT "CRGS"
|
|
|
|
|
|
namespace baosight{
|
|
/*********************************************************************
|
|
* 类 名: FileStream
|
|
* 版权所有: Shanghai Baosight Software Co., Ltd.
|
|
* 类 职 责:复制配置文件管理,读取配置文件中某项的值
|
|
* :
|
|
* :
|
|
* 版本历史
|
|
*
|
|
*********************************************************************/
|
|
class FileStream{
|
|
public:
|
|
FileStream(void);
|
|
~FileStream();
|
|
/**********************************************************************
|
|
* 概述: 读取项目路径
|
|
**********************************************************************/
|
|
std::string getEnvPath(const std::string& env = "CRGS");
|
|
|
|
/**********************************************************************
|
|
* 概述: 判定目录是不是存在,不存在则创建目录
|
|
**********************************************************************/
|
|
std::string getPath(const string& path = "");
|
|
|
|
/**********************************************************************
|
|
* 概述: 读取文件内容
|
|
**********************************************************************/
|
|
int read(const std::string& file, std::string& outstr);
|
|
|
|
/**********************************************************************
|
|
* 概述: 写内容到文件
|
|
**********************************************************************/
|
|
int write(const std::string& file, const std::string& instr);
|
|
private:
|
|
string m_envpath;
|
|
};
|
|
|
|
}
|
|
#endif
|