SNAP Library 2.0, Developer Reference  2013-05-13 16:33:57
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>

Collaboration diagram for TFile:

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.

References TStr::CStr(), and EAssertR.

Referenced by DelWc().

                                                        {
  if (ThrowExceptP){
    EAssertR(
     remove(FNm.CStr())==0,
     "Error removing file '"+FNm+"'.");
  } else {
    remove(FNm.CStr());
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TFile::DelWc ( const TStr WcStr,
const bool &  RecurseDirP = false 
) [static]

Definition at line 1042 of file fl.cpp.

References TVec< TVal, TSizeTy >::Add(), Del(), TVec< TVal, TSizeTy >::Len(), and TFFile::Next().

Referenced by TMBlobBs::TMBlobBs().

                                                           {
  // 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);}
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool TFile::Exists ( const TStr FNm) [static]

Definition at line 934 of file fl.cpp.

References TStr::Empty().

Referenced by GetUniqueFNm(), TUniChDb::Test(), TMBlobBs::TMBlobBs(), and TZipIn::TZipIn().

                                 {
  if (FNm.Empty()) { return false; }
  bool DoExists;
  TFIn FIn(FNm, DoExists);
  return DoExists;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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.

References TStr::ChangeStr(), Exists(), TStr::Fmt(), forever, TStr::InsStr(), TStr::Len(), and TStr::SearchCh().

Referenced by TForestFire::PlotFire().

                                       {
  // <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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TFile::Rename ( const TStr SrcFNm,
const TStr DstFNm 
) [static]

Definition at line 1053 of file fl.cpp.

References TStr::CStr(), and EAssertR.

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

Here is the call graph for this function:


Member Data Documentation

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

Definition at line 567 of file fl.h.

Referenced by THttp::IsGifFExt().

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

Definition at line 566 of file fl.h.

Referenced by THttp::IsHtmlFExt().

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

Definition at line 565 of file fl.h.

Referenced by THttp::IsHtmlFExt().

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: