LibPkg
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
pkg::update Class Reference

A class for updating the package database. More...

#include <update.h>

Inheritance diagram for pkg::update:
pkg::thread

Classes

struct  progress
 A structure for monitoring the progress of one source. More...
 

Public Types

enum  state_type {
  state_srclist, state_download, state_build_sources, state_build_local,
  state_done, state_fail
}
 An enumeration for describing the state of the update operation. More...
 
typedef unsigned long long size_type
 A type for representing byte counts. More...
 

Public Member Functions

 update (pkgbase &pb)
 Construct update operation. More...
 
virtual ~update ()
 Destroy update operation. More...
 
state_type state () const
 Get current state. More...
 
size_type bytes_done () const
 Get number of bytes downloaded. More...
 
size_type bytes_total () const
 Get total number of bytes to download. More...
 
string message () const
 Get error message. More...
 
void log_to (log *use_log)
 Set the log to add to. More...
 
- Public Member Functions inherited from pkg::thread
 thread ()
 Construct thread. More...
 
virtual ~thread ()
 Destroy thread. More...
 

Static Public Attributes

static const size_type npos =static_cast<size_type>(-1)
 A null value for use in place of a byte count. More...
 

Protected Member Functions

void poll ()
 Poll this thread. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from pkg::thread
static void poll_all ()
 Poll all threads. More...
 

Detailed Description

A class for updating the package database.

Control files from remote sources take precedence over local packages because they contain more information (such as the download URL).

Member Typedef Documentation

typedef unsigned long long pkg::update::size_type

A type for representing byte counts.

Member Enumeration Documentation

An enumeration for describing the state of the update operation.

Enumerator
state_srclist 

The state in which the sources list is being read.

state_download 

The state in which the package indexes are being downloaded.

state_build_sources 

The state in which remote sources are incorporated into the available list.

state_build_local 

The state in which local packages are incorporated into the available list.

state_done 

The state in which the update operation has been successfully completed.

state_fail 

The state in which the update operation failed.

Constructor & Destructor Documentation

pkg::update::update ( pkgbase pb)

Construct update operation.

Parameters
pbthe package database
pkg::update::~update ( )
virtual

Destroy update operation.

Member Function Documentation

state_type pkg::update::state ( ) const
inline

Get current state.

Returns
the current state
size_type pkg::update::bytes_done ( ) const
inline

Get number of bytes downloaded.

Returns
the number of bytes downloaded
size_type pkg::update::bytes_total ( ) const
inline

Get total number of bytes to download.

Returns
the total number of bytes to download
string pkg::update::message ( ) const
inline

Get error message.

When state()==state_fail, this function returns a human-readable description of what went wrong.

Returns
the error message
void pkg::update::log_to ( log use_log)

Set the log to add to.

Parameters
use_loglog to use or 0 to stop logging
void pkg::update::poll ( )
protectedvirtual

Poll this thread.

This function will be called repeatedly until the thread ceases to exist. The amount of work done per invokation should be kept small, in order that multithreading (within the application) and multitasking (across RISC OS as a whole) operate smoothly.

Reimplemented from pkg::thread.

References pkg::LOG_ERROR_UPDATE_EXCEPTION, pkg::log::message(), and state_fail.

Member Data Documentation

const size_type pkg::update::npos =static_cast<size_type>(-1)
static

A null value for use in place of a byte count.


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

Reference Manual LibPkg Version 0.6.1 (28 Jan 2015)