kpilot/lib
Pilot Namespace Reference
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.
|
Typedefs |
typedef QValueList< recordid_t > | RecordIDList |
Functions |
QString | fromPilot (const char *c, int len) |
QString | fromPilot (const char *c) |
QCString | toPilot (const QString &s) |
int | toPilot (const QString &s, char *buf, int len) |
int | toPilot (const QString &s, unsigned char *buf, int len) |
bool | setupPilotCodec (const QString &name) |
QString | codecName () |
QString | category (const struct CategoryAppInfo *info, unsigned int i) |
int | findCategory (const struct CategoryAppInfo *info, const QString &name, bool unknownIsUnfiled) |
int | insertCategory (struct CategoryAppInfo *info, const QString &label, bool unknownIsUnfiled) |
void | dumpCategories (const struct CategoryAppInfo *info) |
QString | categoryName (const struct CategoryAppInfo *info, unsigned int i) |
QStringList | categoryNames (const struct CategoryAppInfo *info) |
static bool | isResource (struct DBInfo *info) |
Variables |
static QTextCodec * | codec = 0L |
static const int | MAX_APPINFO_SIZE = 8192 |
static const unsigned int | CATEGORY_COUNT = 16 |
static const unsigned int | CATEGORY_SIZE = 16 |
static const int | Unfiled = 0 |
static const int | MAX_RECORD_SIZE = 65535 |
static const unsigned int | PLUGIN_API = 20061118 |
Function Documentation
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 133 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 150 of file pilot.h.
QString Pilot::codecName |
( |
|
) |
|
Returns the name of the codec being used.
Definition at line 120 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 218 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 136 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 54 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 49 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 174 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 208 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 101 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 64 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:
-
- Returns:
- Encoded string in a QCString
Definition at line 59 of file pilot.cc.
Variable Documentation
Maximum number of categories the handheld has.
Definition at line 67 of file pilot.h.
Maximum size of a category label.
Definition at line 70 of file pilot.h.
Maximum size of an AppInfo block, taken roughly from the pilot-link source.
Definition at line 64 of file pilot.h.
Maximum size (in bytes) of a record's data.
Definition at line 76 of file pilot.h.
Category number for unfiled records.
Definition at line 73 of file pilot.h.
|