SNAP Library 6.0, User Reference  2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
TFile Class Reference

#include <fl.h>

Static Public Member Functions

static bool Exists (const TStr &FNm)
 
static void Copy (const TStr &SrcFNm, const TStr &DstFNm, const bool &ThrowExceptP=true, const bool &FailIfExistsP=false)
 
static void Del (const TStr &FNm, const bool &ThrowExceptP=true)
 
static void DelWc (const TStr &WcStr, const bool &RecurseDirP=false)
 
static void Rename (const TStr &SrcFNm, const TStr &DstFNm)
 
static TStr GetUniqueFNm (const TStr &FNm)
 
static uint64 GetSize (const TStr &FNm)
 
static uint64 GetCreateTm (const TStr &FNm)
 
static uint64 GetLastAccessTm (const TStr &FNm)
 
static uint64 GetLastWriteTm (const TStr &FNm)
 

Static Public Attributes

static const TStr TxtFExt =".Txt"
 
static const TStr HtmlFExt =".Html"
 
static const TStr HtmFExt =".Htm"
 
static const TStr GifFExt =".Gif"
 
static const TStr JarFExt =".Jar"
 

Detailed Description

Definition at line 640 of file fl.h.

Member Function Documentation

static void TFile::Copy ( const TStr SrcFNm,
const TStr DstFNm,
const bool &  ThrowExceptP = true,
const bool &  FailIfExistsP = false 
)
static
void TFile::Del ( const TStr FNm,
const bool &  ThrowExceptP = true 
)
static

Definition at line 1254 of file fl.cpp.

1254  {
1255  if (ThrowExceptP){
1256  EAssertR(
1257  remove(FNm.CStr())==0,
1258  "Error removing file '"+FNm+"'.");
1259  } else {
1260  remove(FNm.CStr());
1261  }
1262 }
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
char * CStr()
Definition: dt.h:479
void TFile::DelWc ( const TStr WcStr,
const bool &  RecurseDirP = false 
)
static

Definition at line 1264 of file fl.cpp.

1264  {
1265  // collect file-names
1266  TStrV FNmV;
1267  TFFile FFile(WcStr, RecurseDirP); TStr FNm;
1268  while (FFile.Next(FNm)){
1269  FNmV.Add(FNm);}
1270  // delete files
1271  for (int FNmN=0; FNmN<FNmV.Len(); FNmN++){
1272  Del(FNmV[FNmN], false);}
1273 }
Definition: xfl.h:30
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
static void Del(const TStr &FNm, const bool &ThrowExceptP=true)
Definition: fl.cpp:1254
Definition: dt.h:412
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:602
bool TFile::Exists ( const TStr FNm)
static

Definition at line 1156 of file fl.cpp.

1156  {
1157  if (FNm.Empty()) { return false; }
1158  bool DoExists;
1159  TFIn FIn(FNm, DoExists);
1160  return DoExists;
1161 }
Definition: fl.h:275
bool Empty() const
Definition: dt.h:491
static uint64 TFile::GetCreateTm ( const TStr FNm)
static
static uint64 TFile::GetLastAccessTm ( const TStr FNm)
static
static uint64 TFile::GetLastWriteTm ( const TStr FNm)
static
static uint64 TFile::GetSize ( const TStr FNm)
static
TStr TFile::GetUniqueFNm ( const TStr FNm)
static

Definition at line 1281 of file fl.cpp.

1281  {
1282  // <name>.#.txt --> <name>.<num>.txt
1283  int Cnt=1; int ch;
1284  TStr NewFNm; TStr TmpFNm=FNm;
1285  if (FNm.SearchCh('#') == -1) {
1286  for (ch = FNm.Len()-1; ch >= 0; ch--) if (FNm[ch] == '.') break;
1287  if (ch != -1) TmpFNm.InsStr(ch, ".#");
1288  else TmpFNm += ".#";
1289  }
1290  forever{
1291  NewFNm=TmpFNm;
1292  NewFNm.ChangeStr("#", TStr::Fmt("%03d", Cnt)); Cnt++;
1293  if (!TFile::Exists(NewFNm)){break;}
1294  }
1295  return NewFNm;
1296 }
int SearchCh(const char &Ch, const int &BChN=0) const
Definition: dt.cpp:1043
int Len() const
Definition: dt.h:490
static bool Exists(const TStr &FNm)
Definition: fl.cpp:1156
#define forever
Definition: bd.h:6
Definition: dt.h:412
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
void InsStr(const int &BChN, const TStr &Str)
Definition: dt.cpp:825
int ChangeStr(const TStr &SrcStr, const TStr &DstStr, const int &BChN=0)
Definition: dt.cpp:1130
void TFile::Rename ( const TStr SrcFNm,
const TStr DstFNm 
)
static

Definition at line 1275 of file fl.cpp.

1275  {
1276  EAssertR(
1277  rename(SrcFNm.CStr(), DstFNm.CStr())==0,
1278  "Error renaming file '"+SrcFNm+"' to "+DstFNm+"'.");
1279 }
#define EAssertR(Cond, MsgStr)
Definition: bd.h:283
char * CStr()
Definition: dt.h:479

Member Data Documentation

const TStr TFile::GifFExt =".Gif"
static

Definition at line 645 of file fl.h.

const TStr TFile::HtmFExt =".Htm"
static

Definition at line 644 of file fl.h.

const TStr TFile::HtmlFExt =".Html"
static

Definition at line 643 of file fl.h.

const TStr TFile::JarFExt =".Jar"
static

Definition at line 646 of file fl.h.

const TStr TFile::TxtFExt =".Txt"
static

Definition at line 642 of file fl.h.


The documentation for this class was generated from the following files: