kpilot

Pilot Namespace Reference

The Pilot namespace holds constants that are global for the handheld data structures. More...


Classes

struct  dlp
struct  dlp< char * >
struct  dlp< char >
struct  dlp< long >
struct  dlp< short >

Typedefs

typedef QValueList< recordid_t > RecordIDList

Functions

QString category (const struct CategoryAppInfo *info, unsigned int i)
QString categoryName (const struct CategoryAppInfo *info, unsigned int i)
QStringList categoryNames (const struct CategoryAppInfo *info)
QString codecName ()
void dumpCategories (const struct CategoryAppInfo *info)
int findCategory (const struct CategoryAppInfo *info, const QString &name, bool unknownIsUnfiled)
QString fromPilot (const char *c)
QString fromPilot (const char *c, int len)
int insertCategory (struct CategoryAppInfo *info, const QString &label, bool unknownIsUnfiled)
static bool isResource (struct DBInfo *info)
bool setupPilotCodec (const QString &name)
int toPilot (const QString &s, unsigned char *buf, int len)
int toPilot (const QString &s, char *buf, int len)
QCString toPilot (const QString &s)
bool validCategory (int c)

Variables

static const unsigned int CATEGORY_COUNT = 16
static const unsigned int CATEGORY_SIZE = 16
static QTextCodeccodec = 0L
static const int MAX_APPINFO_SIZE = 8192
static const int MAX_RECORD_SIZE = 65535
static QMutexmutex = 0L
static const unsigned int PLUGIN_API = 20061118
static const int Unfiled = 0

Detailed Description

The Pilot namespace holds constants that are global for the handheld data structures.

Also contains some global functions that deal with pilot-link structures as well as mapping user-visible strings from UTF8 (KDE side) to the encoding used on the handheld.


Typedef Documentation

typedef QValueList<recordid_t> Pilot::RecordIDList

Definition at line 80 of file pilot.h.


Function Documentation

QString Pilot::category ( const struct CategoryAppInfo *  info,
unsigned int  i 
)

Definition at line 143 of file pilot.cc.

QString Pilot::categoryName ( const struct CategoryAppInfo *  info,
unsigned int  i 
) [inline]

Returns the QString for the requested category i in the category structure info.

Returns QString::null on error (bad pointer or bad category number). May also return QString::null if the category name is empty.

Definition at line 148 of file pilot.h.

QStringList Pilot::categoryNames ( const struct CategoryAppInfo *  info  )  [inline]

Returns a list of all the category names available on the handheld.

This list is neither ordered nor does it contain all sixteen categories -- empty category names on the handheld are skipped.

Definition at line 169 of file pilot.h.

QString Pilot::codecName (  ) 

Returns the name of the codec being used.

Definition at line 138 of file pilot.cc.

void Pilot::dumpCategories ( const struct CategoryAppInfo *  info  ) 

For debugging, display category names for the given AppInfo structure.

Called by dump(). You must pass a valid reference.

Definition at line 240 of file pilot.cc.

int Pilot::findCategory ( const struct CategoryAppInfo *  info,
const QString name,
bool  unknownIsUnfiled 
)

Search for the given category name in the list of categories; returns the category number.

If unknownIsUnfiled is true, then map unknown categories to Unfiled instead of returning an error number.

Returns:
>=0 is a specific category based on the text-to- category number mapping defined by the Pilot, where 0 is always the 'unfiled' category.

-1 means unknown category selected when unknownIsUnfiled is false.

0 == Unfiled means unknown category selected when unknownIsUnfiled is true.

Definition at line 158 of file pilot.cc.

QString Pilot::fromPilot ( const char *  c  ) 

Static translation function mapping a NUL-terminated string from the handheld's encoding to UTF-8.

Parameters:
c the NUL-terminated string to decode
Returns:
QString (UTF-8) value of c
Note:
NUL-terminated strings are rare on the handheld.

Definition at line 59 of file pilot.cc.

QString Pilot::fromPilot ( const char *  c,
int  len 
)

Static translation function that maps handheld native (8 bit, usually latin1 but sometimes someting else) encoded data to a Unicode string.

Converts the len characters in c to a Unicode string.

Definition at line 51 of file pilot.cc.

int Pilot::insertCategory ( struct CategoryAppInfo *  info,
const QString label,
bool  unknownIsUnfiled 
)

Search for the given category name in the list of categories; returns the category number.

If unknownIsUnfiled is true, then map unknown categories to Unfiled. If unknownIsUnfiled is false, insert a new category into the structure and return the category number of the new category. Return -1 if (and only if) unknownIsUnfiled is false and the category structure is already full.

Returns:
>=0 is a specific category based on the text-to- category number mapping defined by the Pilot, where 0 is always the 'unfiled' category.

0 Unknown category and unknownIsUnfiled is true

-1 means unknown category selected when unknownIsUnfiled is false and categories are all full.

Definition at line 196 of file pilot.cc.

static bool Pilot::isResource ( struct DBInfo *  info  )  [inline, static]

The handheld also holds data about each database in a DBInfo structure; check if the database described by this structure is a resource database.

Definition at line 227 of file pilot.h.

bool Pilot::setupPilotCodec ( const QString name  ) 

Create a codec for translating handheld native 8 bit to Unicode, using the given codec name -- this will often be latin1, but might be something else for, say, Russian-language Pilots.

If name is empty, use latin1.

Returns:
true on success, false otherwise

Definition at line 116 of file pilot.cc.

int Pilot::toPilot ( const QString s,
unsigned char *  buf,
int  len 
)

Definition at line 91 of file pilot.cc.

int Pilot::toPilot ( const QString s,
char *  buf,
int  len 
)

Static translation function that maps a QString onto the native 8 bit encoding of the handheld.

Writes the result into the buffer buf which has size len. Returns the length of the result. Zero-fills the buffer as needed.

Definition at line 75 of file pilot.cc.

QCString Pilot::toPilot ( const QString s  ) 

Static translation function that maps a QString onto the native 8 bit encoding of the handheld.

Parameters:
s String to encode
Returns:
Encoded string in a QCString

Definition at line 67 of file pilot.cc.

bool Pilot::validCategory ( int  c  )  [inline]

Check that a given category number is valid.

This restricts the range of integers to [0..CATEGORY_COUNT-1] (i.e. [0..15]) which is what the handheld supports.

Definition at line 134 of file pilot.h.


Variable Documentation

const unsigned int Pilot::CATEGORY_COUNT = 16 [static]

Maximum number of categories the handheld has.

Definition at line 69 of file pilot.h.

const unsigned int Pilot::CATEGORY_SIZE = 16 [static]

Maximum size of a category label.

Definition at line 72 of file pilot.h.

QTextCodec* Pilot::codec = 0L [static]

Definition at line 47 of file pilot.cc.

const int Pilot::MAX_APPINFO_SIZE = 8192 [static]

Maximum size of an AppInfo block, taken roughly from the pilot-link source.

Definition at line 66 of file pilot.h.

const int Pilot::MAX_RECORD_SIZE = 65535 [static]

Maximum size (in bytes) of a record's data.

Definition at line 78 of file pilot.h.

QMutex* Pilot::mutex = 0L [static]

Definition at line 48 of file pilot.cc.

const unsigned int Pilot::PLUGIN_API = 20061118 [static]

As the API for conduits may change in the course of time, identify them and refuse to load incompatible API versions.

Bump this number every release to the current YYYYMMDD value.

Definition at line 59 of file plugin.h.

const int Pilot::Unfiled = 0 [static]

Category number for unfiled records.

Definition at line 75 of file pilot.h.