2014-05-16 18:51:01 +08:00
|
|
|
//===-- MIUtilFileStd.h -----------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// In-house headers:
|
2014-11-18 02:06:21 +08:00
|
|
|
#include "MIUtilString.h"
|
2014-05-16 18:51:01 +08:00
|
|
|
#include "MICmnBase.h"
|
|
|
|
|
|
|
|
//++ ============================================================================
|
2014-11-18 02:06:21 +08:00
|
|
|
// Details: MI common code utility class. File handling.
|
2014-05-16 18:51:01 +08:00
|
|
|
//--
|
|
|
|
class CMIUtilFileStd : public CMICmnBase
|
|
|
|
{
|
2014-11-18 02:06:21 +08:00
|
|
|
// Static:
|
|
|
|
public:
|
2015-08-04 18:24:20 +08:00
|
|
|
static char GetSlash();
|
2014-06-25 00:35:50 +08:00
|
|
|
|
2014-11-18 02:06:21 +08:00
|
|
|
// Methods:
|
|
|
|
public:
|
2015-08-04 18:24:20 +08:00
|
|
|
/* ctor */ CMIUtilFileStd();
|
2014-11-18 02:06:21 +08:00
|
|
|
//
|
|
|
|
bool CreateWrite(const CMIUtilString &vFileNamePath, bool &vwrbNewCreated);
|
|
|
|
bool Write(const CMIUtilString &vData);
|
2015-07-03 21:45:34 +08:00
|
|
|
bool Write(const char *vpData, const MIuint vCharCnt);
|
2015-08-04 18:24:20 +08:00
|
|
|
void Close();
|
|
|
|
bool IsOk() const;
|
2014-11-18 02:06:21 +08:00
|
|
|
bool IsFileExist(const CMIUtilString &vFileNamePath) const;
|
2015-08-04 18:24:20 +08:00
|
|
|
const CMIUtilString &GetLineReturn() const;
|
2015-04-01 00:30:29 +08:00
|
|
|
static CMIUtilString StripOffFileName(const CMIUtilString &vDirectoryPath);
|
2014-05-16 18:51:01 +08:00
|
|
|
|
2014-11-18 02:06:21 +08:00
|
|
|
// Overridden:
|
|
|
|
public:
|
|
|
|
// From CMICmnBase
|
2015-08-04 18:24:20 +08:00
|
|
|
/* dtor */ ~CMIUtilFileStd() override;
|
2014-05-16 18:51:01 +08:00
|
|
|
|
2014-11-18 02:06:21 +08:00
|
|
|
// Attributes:
|
|
|
|
private:
|
|
|
|
CMIUtilString m_fileNamePath;
|
|
|
|
FILE *m_pFileHandle;
|
|
|
|
CMIUtilString m_constCharNewLine;
|
|
|
|
bool m_bFileError; // True = have a file error ATM, false = all ok
|
|
|
|
};
|