LibPkg
Classes | Public Types | Public Member Functions | List of all members
pkg::component Class Reference

A class to represent a component of a package. More...

#include <component.h>

Classes

class  parse_error
 An exception class for reporting parse errors. More...
 

Public Types

enum  flag_type { movable, look_at, run, add_to_apps }
 The options available/selected for this component. More...
 

Public Member Functions

 component ()
 Empty constructor, unnamed component with no flags. More...
 
 component (std::string::const_iterator first, std::string::const_iterator last)
 Construct a component from a sequence. More...
 
 component (const std::string &compstr)
 Construct component from string. More...
 
 ~component ()
 Destroy component. More...
 
bool operator== (const component &other) const
 Check if it is the same as another component. More...
 
bool operator!= (const component &other) const
 Check if it is different from another component. More...
 
 operator std::string () const
 Convert component to string. More...
 
const std::string & name () const
 Get the name of the component The name is the same as the logical path to the component. More...
 
unsigned int flags () const
 Get the bit field containing the component flags. More...
 
bool flag (flag_type flag) const
 Get component flag. More...
 
void flag (flag_type flag, bool value)
 Set component flag. More...
 
const std::string & path () const
 Get the installation path. More...
 
void path (const std::string &path)
 Set the installation path. More...
 

Detailed Description

A class to represent a component of a package.

A component is a file or folder that has extra metadata associated with it to configure it at install time.

From LibPkg 0.4 any path that can be set at install time should have a component included with the Moveable flag set.

Member Enumeration Documentation

The options available/selected for this component.

Enumerator
movable 

A flag to indicate this component can have it's install location changed and it may be moved after install.

look_at 

A flag to indicate this component should be added to the RISC OS boot look at file, so it is booted when the desktop starts.

run 

A flag to indicate this component should be added to the RISC OS boot run file, so it is run when the desktop starts.

add_to_apps 

A flag to indicate this component should be added to the RISC OS application pseudo folder.

Constructor & Destructor Documentation

pkg::component::component ( )

Empty constructor, unnamed component with no flags.

Referenced by pkg::operator>>().

pkg::component::component ( std::string::const_iterator  first,
std::string::const_iterator  last 
)

Construct a component from a sequence.

This is the name followed by space separated options in brackets

Parameters
firstbeginning of sequence
lastend of sequence
pkg::component::component ( const std::string &  compstr)

Construct component from string.

Parameters
compstrthe component string
pkg::component::~component ( )

Destroy component.

Member Function Documentation

bool pkg::component::operator== ( const component other) const

Check if it is the same as another component.

bool pkg::component::operator!= ( const component other) const

Check if it is different from another component.

pkg::component::operator std::string ( ) const

Convert component to string.

Does not include the path

Returns
the component as a string

References pkg::ComponentFlagNames.

const std::string& pkg::component::name ( ) const
inline

Get the name of the component The name is the same as the logical path to the component.

Returns
the component name

Referenced by pkg::component_update::insert(), and pkg::commit::poll().

unsigned int pkg::component::flags ( ) const
inline

Get the bit field containing the component flags.

bool pkg::component::flag ( flag_type  flag) const
inline

Get component flag.

Parameters
flagthe flag to be read
Returns
the value of the flag

Referenced by flag(), and pkg::commit::poll().

void pkg::component::flag ( flag_type  flag,
bool  value 
)

Set component flag.

Parameters
flagthe flag to be altered
valuethe required value

References flag().

const std::string& pkg::component::path ( ) const
inline

Get the installation path.

Returns
path or empty string for the default path.

Referenced by pkg::operator<<(), pkg::operator>>(), and pkg::commit::poll().

void pkg::component::path ( const std::string &  path)
inline

Set the installation path.

Parameters
paththe new installation path for the component

References path().

Referenced by path().


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

Reference Manual LibPkg Version 0.6.1 (28 Jan 2015)