PPD Class Reference

#include <PPDdb.h>

List of all members.

Public Types

typedef string VendorKey
typedef string ModelKey
typedef string DriverFile
typedef map< DriverFile, DriverInfoDrivers
typedef map< ModelKey, ModelInfoModels
typedef map< VendorKey, VendorInfoVendors
typedef map< string, PpdFileInfoPpdFiles
typedef map< VendorKey, set<
string > > 
ModelLabels
typedef set< string > VendorLabels

Public Member Functions

 PPD (const char *ppddir=PPD_DIR, const char *ppddb=PPD_DB)
 ~PPD ()
bool createdb ()
void * createdbThread (const char *filename)
int creationStatus ()
bool changed (int *count)
string getVendorId (string vendor)
string getModelId (string vendor, string model)
string removeVendorFromModel (string vendor, string model)
bool fileinfo (const char *file, PPDInfo *info)
bool setCheckMethod (YCPSymbol method)
YCPList sortItems (const YCPMap &items)

Static Public Member Functions

static void * startCreatedbThread (void *instance)

Protected Member Functions

string strupper (const string s)
string killchars (const string s, const string chr)
string killspaces (const string s)
string killbraces (const string s)
string addbrace (const string s)
string first (const string s, const string sep=" -/")
string clean (const char *s)
string filternotchars (const string s, const string chr)
string regexpsub (const string input, const string pattern, const string result)
bool validateModel (const string vendor, const string printer)

Private Types

typedef map< string, string > VendorsMap
typedef map< string, vector<
pair< string, string > > > 
ModelsMap

Private Member Functions

bool mtimes (const char *dirname, time_t mtime, int *count)
int countFiles (const char *dirname)
bool process_dir (const char *dirname)
bool process_file (const char *filename, PPDInfo *newinfo=NULL)
void preprocess (PPDInfo info, PPDInfo *newinfo)
void addAdditionalInfo ()
void debugdb () const
bool loadPrebuiltDatabase ()
bool createFileList (const char *dirname, time_t mtime)
bool cleanupLists ()
bool processNewFiles ()
bool cleanupEmptyEntries ()
string fileChecksum (const string &filename)
off_t fileSize (const string &filename)
string updateLabel (const string &label)

Private Attributes

Vendors db
PpdFiles ppdfiles
ModelLabels modellabels
VendorLabels vendorlabels
string datadir
string var_datadir
char ppd_dir [MAX]
char ppd_db [MAX]
time_t mtime
VendorsMap vendors_map
ModelsMap models_map
volatile int creation_status
volatile int total_files
volatile int done_files
bool fast_check

Friends

class PPDfile

Classes

class  DriverInfo
class  ModelInfo
class  PpdFileInfo
class  PPDInfo
class  VendorInfo


Member Typedef Documentation

typedef string PPD::VendorKey

typedef string PPD::ModelKey

typedef string PPD::DriverFile

typedef map<DriverFile, DriverInfo> PPD::Drivers

typedef map<ModelKey, ModelInfo> PPD::Models

typedef map<VendorKey, VendorInfo> PPD::Vendors

typedef map<string, PpdFileInfo> PPD::PpdFiles

typedef map<VendorKey, set<string> > PPD::ModelLabels

typedef set<string> PPD::VendorLabels

typedef map<string, string> PPD::VendorsMap [private]

typedef map<string, vector<pair <string, string> > > PPD::ModelsMap [private]


Constructor & Destructor Documentation

PPD::PPD ( const char *  ppddir = PPD_DIR,
const char *  ppddb = PPD_DB 
)

Constructor

Array of all known vendors

Array of all known string->vendor mappings

PPD::~PPD (  ) 

Destructor


Member Function Documentation

bool PPD::createdb (  ) 

Create database of printers Just start a thread and return immediately

void * PPD::startCreatedbThread ( void *  instance  )  [static]

void * PPD::createdbThread ( const char *  filename  ) 

Create a database of all ppd files in the /var/lib/YaST2/ppd_db.ycp

Returns:
operation succeeded

int PPD::creationStatus (  ) 

bool PPD::changed ( int *  count  ) 

Check if any ppd file has changed

string PPD::getVendorId ( string  vendor  ) 

Transform vendor name from PPD file/detection to key in database

string PPD::getModelId ( string  vendor,
string  model 
)

Transform model name from PPD file/detection to key in database

string PPD::removeVendorFromModel ( string  vendor,
string  model 
)

Remove the vendor name from the beginning of the model if present

Parameters:
vendor string vendor id
model string model label/id
Returns:
string model label/id with removed vendor from the begining

bool PPD::fileinfo ( const char *  file,
PPDInfo info 
)

Return info from the given file

bool PPD::setCheckMethod ( YCPSymbol  method  ) 

YCPList PPD::sortItems ( const YCPMap items  ) 

bool PPD::mtimes ( const char *  dirname,
time_t  mtime,
int *  count 
) [private]

Check modification times in the given directory

int PPD::countFiles ( const char *  dirname  )  [private]

Count files to process

bool PPD::process_dir ( const char *  dirname  )  [private]

Search given directory for ppd files and update the ppd database

Parameters:
dirname directory to be processed
Returns:
operation succeeded

bool PPD::process_file ( const char *  filename,
PPDInfo newinfo = NULL 
) [private]

Process one PPD file

Parameters:
filename the file to be processed
Returns:
operation succeeded

void PPD::preprocess ( PPD::PPDInfo  info,
PPDInfo newinfo 
) [private]

Preprocess the strings, apply hacks and update the db.

void PPD::addAdditionalInfo (  )  [private]

void PPD::debugdb (  )  const [private]

Debug whole ppd db to the y2log

bool PPD::loadPrebuiltDatabase (  )  [private]

bool PPD::createFileList ( const char *  dirname,
time_t  mtime 
) [private]

Creates a list of files with attrubutes about modification dates

bool PPD::cleanupLists (  )  [private]

bool PPD::processNewFiles (  )  [private]

bool PPD::cleanupEmptyEntries (  )  [private]

string PPD::fileChecksum ( const string &  filename  )  [private]

off_t PPD::fileSize ( const string &  filename  )  [private]

string PPD::updateLabel ( const string &  label  )  [private]

string PPD::strupper ( const string  s  )  [protected]

Convert string to upper characters

string PPD::killchars ( const string  s,
const string  chr 
) [protected]

Kill the given chars from the start and end of the string

string PPD::killspaces ( const string  s  )  [protected]

Kill all spaces from the start and end of the string

string PPD::killbraces ( const string  s  )  [protected]

Kill braces (and other bad characters) from the start and end of the string

string PPD::addbrace ( const string  s  )  [protected]

Add a right brace if there is one left brace alone.

string PPD::first ( const string  s,
const string  sep = " -/" 
) [protected]

Return the first word from the string

string PPD::clean ( const char *  s  )  [protected]

Make s string from the char* and clean it from spaces and braces

string PPD::filternotchars ( const string  s,
const string  chr 
) [protected]

Filter characters, leavo only listed ones

string PPD::regexpsub ( const string  input,
const string  pattern,
const string  result 
) [protected]

the same as YCP regexpsub builtin

bool PPD::validateModel ( const string  vendor,
const string  printer 
) [protected]


Friends And Related Function Documentation

friend class PPDfile [friend]


Member Data Documentation

Vendors PPD::db [private]

PpdFiles PPD::ppdfiles [private]

ModelLabels PPD::modellabels [private]

VendorLabels PPD::vendorlabels [private]

string PPD::datadir [private]

string PPD::var_datadir [private]

char PPD::ppd_dir[MAX] [private]

char PPD::ppd_db[MAX] [private]

time_t PPD::mtime [private]

VendorsMap PPD::vendors_map [private]

ModelsMap PPD::models_map [private]

volatile int PPD::creation_status [private]

volatile int PPD::total_files [private]

volatile int PPD::done_files [private]

bool PPD::fast_check [private]


The documentation for this class was generated from the following files:
Generated on Tue Nov 28 18:14:51 2006 for yast2-printer by  doxygen 1.5.0