SNAP Library 2.1, User Reference  2013-09-25 10:47:25
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TFile Class Reference

#include <fl.h>

List of all members.

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 562 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 1032 of file fl.cpp.

                                                        {
  if (ThrowExceptP){
    EAssertR(
     remove(FNm.CStr())==0,
     "Error removing file '"+FNm+"'.");
  } else {
    remove(FNm.CStr());
  }
}
void TFile::DelWc ( const TStr WcStr,
const bool &  RecurseDirP = false 
) [static]

Definition at line 1042 of file fl.cpp.

                                                           {
  // collect file-names
  TStrV FNmV;
  TFFile FFile(WcStr, RecurseDirP); TStr FNm;
  while (FFile.Next(FNm)){
    FNmV.Add(FNm);}
  // delete files
  for (int FNmN=0; FNmN<FNmV.Len(); FNmN++){
    Del(FNmV[FNmN], false);}
}
bool TFile::Exists ( const TStr FNm) [static]

Definition at line 934 of file fl.cpp.

                                 {
  if (FNm.Empty()) { return false; }
  bool DoExists;
  TFIn FIn(FNm, DoExists);
  return DoExists;
}
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 1059 of file fl.cpp.

                                       {
  // <name>.#.txt --> <name>.<num>.txt
  int Cnt=1; int ch;
  TStr NewFNm; TStr TmpFNm=FNm;
  if (FNm.SearchCh('#') == -1) {
    for (ch = FNm.Len()-1; ch >= 0; ch--) if (FNm[ch] == '.') break;
    if (ch != -1) TmpFNm.InsStr(ch, ".#");
    else TmpFNm += ".#";
  }
  forever{
    NewFNm=TmpFNm;
    NewFNm.ChangeStr("#", TStr::Fmt("%03d", Cnt)); Cnt++;
    if (!TFile::Exists(NewFNm)){break;}
  }
  return NewFNm;
}
void TFile::Rename ( const TStr SrcFNm,
const TStr DstFNm 
) [static]

Definition at line 1053 of file fl.cpp.

                                                        {
  EAssertR(
   rename(SrcFNm.CStr(), DstFNm.CStr())==0,
   "Error renaming file '"+SrcFNm+"' to "+DstFNm+"'.");
}

Member Data Documentation

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

Definition at line 567 of file fl.h.

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

Definition at line 566 of file fl.h.

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

Definition at line 565 of file fl.h.

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

Definition at line 568 of file fl.h.

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

Definition at line 564 of file fl.h.


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