A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/download__job_8cpp_source.html below:

NCBI C++ ToolKit: src/gui/utils/download_job.cpp Source File

92  if

(dlcbdata->

CB

().

func

)

127

ios <<

"SIZE "

<< filename << endl;

128  if

(!(ios >> retval)) {

137

ios <<

"RETR "

<< filename << endl;

146  const string

& base_dir,

147  const string

& download_url,

148  bool

extract_archive)

152

m_ExtractArchives(extract_archive),

158  const string

& base_dir,

159  const string

& download_url,

160  const

vector<string>& files_to_load,

161  bool

extract_archive)

165

m_FilesToLoad(files_to_load),

166

m_ExtractArchives(extract_archive),

203  static const string

sizes[] = {

"Bytes"

,

"KB"

,

"MB"

,

"GB"

,

"TB"

,

"PB"

};

205  unsigned i

= (unsigned)floor(

log10

((

double

)bytes) / 3);

217  float

progress = 0.0;

225

progress = float(pos * 100.0) / (float)

size

;

226  if

(progress > 100.00)

266  size_t

pos =

m_URL

.rfind(

'/'

);

267  if

((string::npos == pos) || (pos == (

m_URL

.length() - 1))) {

277  string

fname =

m_URL

;

297  const char

* url = file_url.c_str();

300  string

err =

"Cannot parse URL \""

;

309  string

err =

"URL scheme must be FTP"

;

317  if

(!*net_info->

user

) {

318

strcpy(net_info->

user

,

"ftp"

);

329

<<

" from "

<< net_info->

host

<<

", " 330

<<

size

<<

" byte"

<< &

"s"

[

size

== 1]);

334

<<

" from "

<< net_info->

host

);

361  bool

download_ok =

false

;

365  static unsigned

s_cnt = 0;

372  const size_t

buff_size = 1;

373  char

*

buffer

=

new char

[buff_size];

379

ftp.read(

buffer

, buff_size);

381

os.write(

buffer

, ftp.gcount());

395  catch

(std::exception& e) {

420  const char

* url = file_url.c_str();

423  string

err =

"Cannot parse URL \""

;

432  string

err =

"URL scheme must be FTP"

;

440  if

(!*net_info->

user

) {

441

strcpy(net_info->

user

,

"ftp"

);

452

<<

" from "

<< net_info->

host

<<

", " 453

<<

size

<<

" byte"

<< &

"s"

[

size

== 1]);

456

<<

" from "

<< net_info->

host

);

484  bool

download_ok =

false

;

488  static unsigned

s_cnt = 0;

515

}

catch

(std::exception& e) {

534  CDir

dir(base_temp_dir);

537  string

entry = (*i)->GetPath();

550

}

catch

(std::exception& e) {

CAppJobError Default implementation for IAppJobError - encapsulates a text error message.

CAppJobProgress Default implementation for IAppJobProgress - the class encapsulates a text message an...

CConn_FtpStream is an elaborate FTP client, can be used for data downloading and/or uploading to and ...

SCONN_Callback * CB(void)

void SetPos(size_t pos) const

CAtomicCounter::TValue GetCancel() const

void AddTotalSize(size_t add)

size_t GetSize(void) const

string m_TaskName

Name of the task.

string m_URL

URL to download.

EJobState x_DownloadAndExtract(const string &url)

virtual bool IsCanceled() const

bool m_ExtractArchives

Flag, indicating whether to extract archives on download.

CFastMutex m_Mutex

Mutex for guarding state access.

virtual CRef< CObject > GetResult()

Returns the Job Result.

string m_BaseDir

Base directory to download and optionally unpack.

CRef< CAppJobError > m_Error

CDownloadJob(const string &desc, const string &base_dir, const string &download_url, bool extract_archive=true)

CNetBlastLoadingJob.

virtual string GetDescr() const

Returns a human readable description of the Job (optional)

virtual void RequestCancel()

RequestCancel() is called to notify the Job that it shall exit Run() function ASAP.

EJobState x_Download(const string &url, const string &file_name)

CDownloadCallbackData * m_DlcbData

string x_FormatSize(size_t bytes)

vector< string > m_FilesToLoad

List of files to load.

virtual CConstIRef< IAppJobProgress > GetProgress()

return progress object, the function shall be synchronized internally.

virtual CConstIRef< IAppJobError > GetError()

Returns IAppJobError object describing internal error that caused the Job to fail.

virtual EJobState Run()

Function that does all the useful work, called by the Engine.

CDownloadJob::CDownloadCallbackData * m_DlCbData

CTarCheckpointed(istream &is, CDownloadJob::CDownloadCallbackData *dlcbdata)

virtual bool Checkpoint(const CTarEntryInfo &current, bool)

Return false to skip the current entry when reading; the return code gets ignored when writing.

static size_t s_GetFtpFilesize(iostream &ios, const char *filename)

static EIO_Status s_FtpCallback(CONN conn, TCONN_Callback type, void *data)

static void s_InitiateFtpFileDownload(iostream &ios, const char *filename)

std::ofstream out("events_result.xml")

main entry point for tests

static CS_CONNECTION * conn

#define ITERATE(Type, Var, Cont)

ITERATE macro to sequence through container elements.

@ eGZipFile

.gz file (including concatenated files)

void SetBaseDir(const string &dirname)

Set base directory to use for files while extracting from/adding to the archive, and in the latter ca...

Uint8 GetSize(void) const

void SetFlags(TFlags flags)

Set processing flags.

void Close(void)

Close the archive making sure all pending output is flushed.

unique_ptr< TEntries > Extract(void)

Extract the entire archive (into either current directory or a directory otherwise specified by SetBa...

@ fOverwrite

Allow to overwrite destinations with entries from the archive.

virtual EIO_Status Close(void)

Close CONNection, free all internal buffers and underlying structures, and render the stream unusable...

ECONN_Callback

Set user callback function to be invoked upon an event specified by the callback type.

EIO_Status CONN_SetCallback(CONN conn, ECONN_Callback type, const SCONN_Callback *new_cb, SCONN_Callback *old_cb)

unsigned int TCONN_Callback

TNCBI_BigCount CONN_GetPosition(CONN conn, EIO_Event event)

Get read ("event" == eIO_Read) or write ("event" == eIO_Write) position within the connection.

void * data

data to pass to the callback as its last arg

FCONN_Callback func

function address to call on the event

@ eCONN_OnClose

NB: CONN has been flushed prior to the call.

@ eCONN_OnRead

Read from CONNECTOR is about to occur.

#define ERR_POST(message)

Error posting with file, line number information but without error codes.

string ReportAll(TDiagPostFlags flags=eDPF_Exception) const

Report all exceptions.

void Fatal(CExceptionArgs_Base &args)

void Info(CExceptionArgs_Base &args)

TEntries GetEntries(const string &mask=kEmptyStr, TGetEntriesFlags flags=0) const

Get directory entries based on the specified "mask".

static string CreateAbsolutePath(const string &path, ERelativeToWhat rtw=eRelativeToCwd)

Get an absolute path from some, possibly relative, path.

virtual bool Exists(void) const

Check the entry existence.

bool Rename(const string &new_path, TRenameFlags flags=fRF_Default)

Rename entry.

virtual bool Remove(TRemoveFlags flags=eRecursive) const

Remove a directory entry.

static string MakePath(const string &dir=kEmptyStr, const string &base=kEmptyStr, const string &ext=kEmptyStr)

Assemble a path from basic components.

static char GetPathSeparator(void)

Get path separator symbol specific for the current platform.

static string ConcatPath(const string &first, const string &second)

Concatenate two parts of the path for the current OS.

@ fRF_Overwrite

Remove destination if it exists.

@ fIgnoreRecursive

Suppress "self recursive" elements (the directories "." and "..").

EJobState

Job states (describe FSM)

TObjectType * GetPointer(void) THROWS_NONE

Get pointer,.

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

IO_PREFIX::fstream CNcbiFstream

Portable alias for fstream.

static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)

Convert double to string.

static string IntToString(int value, TNumToStringFlags flags=0, int base=10)

Convert int to string.

int ConnNetInfo_ParseURL(SConnNetInfo *net_info, const char *url)

SConnNetInfo * ConnNetInfo_Create(const char *service)

void ConnNetInfo_Destroy(SConnNetInfo *net_info)

@ eIO_Interrupt

signal arrival prevented any I/O to succeed

@ eIO_Success

everything is fine, no error occurred

@ eIO_Open

also serves as no-event indicator in SOCK_Poll

const struct ncbi::grid::netcache::search::fields::SIZE size

Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...

C++ I/O stream wrappers to compress/decompress data on-the-fly.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4