1 //===-- MIUtilFileStd.h -----------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #pragma once
11 
12 // In-house headers:
13 #include "MICmnBase.h"
14 #include "MIUtilString.h"
15 
16 //++
17 //============================================================================
18 // Details: MI common code utility class. File handling.
19 //--
20 class CMIUtilFileStd : public CMICmnBase {
21   // Static:
22 public:
23   static char GetSlash();
24 
25   // Methods:
26 public:
27   /* ctor */ CMIUtilFileStd();
28   //
29   bool CreateWrite(const CMIUtilString &vFileNamePath, bool &vwrbNewCreated);
30   bool Write(const CMIUtilString &vData);
31   bool Write(const char *vpData, const MIuint vCharCnt);
32   void Close();
33   bool IsOk() const;
34   bool IsFileExist(const CMIUtilString &vFileNamePath) const;
35   const CMIUtilString &GetLineReturn() const;
36   static CMIUtilString StripOffFileName(const CMIUtilString &vDirectoryPath);
37 
38   // Overridden:
39 public:
40   // From CMICmnBase
41   /* dtor */ ~CMIUtilFileStd() override;
42 
43   // Attributes:
44 private:
45   CMIUtilString m_fileNamePath;
46   FILE *m_pFileHandle;
47   CMIUtilString m_constCharNewLine;
48   bool m_bFileError; // True = have a file error ATM, false = all ok
49 };
50