SNAP Library 6.0, Developer Reference  2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
xfl.h
Go to the documentation of this file.
1 #include "bd.h"
2 
4 // Find-File-Descriptor
6 public:
7 #ifdef GLib_WIN
8  WIN32_FIND_DATA FDesc;
9  HANDLE FFileH;
10 #else
11  DIR* FDesc;
12  dirent* DirEnt;
13 #endif
14 public:
15  TFFileDesc();
16  static PFFileDesc New(){return PFFileDesc(new TFFileDesc());}
17  ~TFFileDesc();
19  static PFFileDesc Load(TSIn& SIn){return new TFFileDesc(SIn);}
20  void Save(TSOut&){Fail;}
21 
22  TFFileDesc& operator=(const TFFileDesc&){Fail; return *this;}
23 
24  TStr GetFBase() const;
25  bool IsDir() const;
26 };
27 
29 // Find-File
31 private:
32  TStrV FPathV, FExtV;
33  TStr FBaseWc;
34  bool CsImpP;
35  bool RecurseP;
36  int FPathN;
37  PFFileDesc FFileDesc;
38  PFFile SubFFile;
39  TStr CurFNm;
40  int CurFNmN;
42 public:
43  TFFile(const TStr& _FNmWc, const bool& _RecurseP=false);
44  TFFile(const TStr& _FPath, const TStr& _FExt, const bool& _RecurseP=false);
45  TFFile(const TStrV& _FPathV, const TStrV& _FExtV,
46  const TStr& _FBaseWc, const bool& _RecurseP);
47  static PFFile New(const TStr& FNmWc, const bool& RecurseP){
48  return PFFile(new TFFile(FNmWc, RecurseP));}
49  static PFFile New(const TStrV& FPathV, const TStrV& FExtV,
50  const TStr FBaseWc, const bool& RecurseP){
51  return PFFile(new TFFile(FPathV, FExtV, FBaseWc, RecurseP));}
52  static PFFile New(const TStr& FPath, const TStr& FExt, const bool& RecurseP){
53  return PFFile(new TFFile(FPath, FExt, RecurseP));}
54  ~TFFile();
56  static PFFile Load(TSIn& SIn){return new TFFile(SIn);}
57  void Save(TSOut&){Fail;}
58 
59  bool Next(TStr& FNm);
60  bool Next(){TStr FNm; return Next(FNm);}
61  TStr GetFNm() const {return CurFNm;}
62  int GetFNmN() const {return CurFNmN;}
63 
64  static void GetFNmV(
65  const TStr& FPath, const TStrV& FExtV, const bool& RecurseP, TStrV& FNmV);
66 
67  bool IsDir() const {
68  return FFileDesc->IsDir();}
69 };
70 
72 // Directories
73 class TDir{
74 public:
75  static TStr GetCurDir();
76  static TStr GetExeDir();
77  static bool Exists(const TStr& FPathFNm);
78  static bool GenDir(const TStr& FPathFNm);
79  static bool DelDir(const TStr& FPathFNm);
80 };
81 
83 // File-Path-Log
84 class TFPathNotify : public TNotify {
85 private:
91 
92 private:
93  void UpdateSOut(const TTm& NowTm);
95 
96 public:
97  TFPathNotify(const TStr& _LogFPath, const TStr& _PrefixFNm, const bool& _FlushP);
98  static PNotify New(const TStr& LogFPath, const TStr& PrefixFNm, const bool& FlushP) {
99  return PNotify(new TFPathNotify(LogFPath, PrefixFNm, FlushP));}
100 
101  void OnStatus(const TStr& MsgStr);
102 };
static TStr GetCurDir()
Definition: xfl.cpp:233
Definition: xfl.h:30
bool IsDir() const
Definition: xfl.h:67
#define UndefDefaultCopyAssign(TNm)
Definition: bd.h:203
static PFFile New(const TStrV &FPathV, const TStrV &FExtV, const TStr FBaseWc, const bool &RecurseP)
Definition: xfl.h:49
TStr PrefixFNm
Definition: xfl.h:87
bool Next()
Definition: xfl.h:60
#define Fail
Definition: bd.h:238
TPt< TNotify > PNotify
Definition: ut.h:30
TPt< TFFileDesc > PFFileDesc
Definition: xfl.h:5
static PFFileDesc New()
Definition: xfl.h:16
void Save(TSOut &)
Definition: xfl.h:20
static bool DelDir(const TStr &FPathFNm)
Definition: xfl.cpp:262
TStr LogFPath
Definition: xfl.h:86
TFPathNotify(const TStr &_LogFPath, const TStr &_PrefixFNm, const bool &_FlushP)
Definition: xfl.cpp:275
dirent * DirEnt
Definition: xfl.h:12
Definition: fl.h:58
static PFFile Load(TSIn &SIn)
Definition: xfl.h:56
static PFFileDesc Load(TSIn &SIn)
Definition: xfl.h:19
TFFile(TSIn &)
Definition: xfl.h:55
#define ClassTP(TNm, PNm)
Definition: bd.h:126
void Save(TSOut &)
Definition: xfl.h:57
UndefDefaultCopyAssign(TFPathNotify)
int GetFNmN() const
Definition: xfl.h:62
Definition: ut.h:30
static PNotify New(const TStr &LogFPath, const TStr &PrefixFNm, const bool &FlushP)
Definition: xfl.h:98
Definition: fl.h:128
Definition: tm.h:213
static bool Exists(const TStr &FPathFNm)
Definition: xfl.cpp:249
static PFFile New(const TStr &FPath, const TStr &FExt, const bool &RecurseP)
Definition: xfl.h:52
TTm LastTm
Definition: xfl.h:88
TPt< TFFile > PFFile
Definition: xfl.h:30
Definition: dt.h:412
void OnStatus(const TStr &MsgStr)
Definition: xfl.cpp:283
TFFileDesc & operator=(const TFFileDesc &)
Definition: xfl.h:22
void UpdateSOut(const TTm &NowTm)
Definition: xfl.cpp:268
TFFileDesc(TSIn &)
Definition: xfl.h:18
Definition: xfl.h:73
Definition: xfl.h:5
Definition: dt.h:974
static bool GenDir(const TStr &FPathFNm)
Definition: xfl.cpp:258
TBool FlushP
Definition: xfl.h:90
DIR * FDesc
Definition: xfl.h:11
static TStr GetExeDir()
Definition: xfl.cpp:241
TStr GetFNm() const
Definition: xfl.h:61
PSOut LogSOut
Definition: xfl.h:89