#include <chmfile.h>
Public Member Functions | |
CHMFile () | |
Default constructor. | |
CHMFile (const wxString &archiveName) | |
This constructor attempts to open the .chm file passed as it's argument. If it fails, IsOk() will return false. | |
~CHMFile () | |
Destructor. If a file has been succesfully opened, it closes it. | |
wxString | HomePage () const |
Gets the name of the default page in the archive. | |
wxString | TopicsFile () const |
Gets name of the .hhc file in the archive that could potentially be used to generate content information from. | |
wxString | ArchiveName () const |
Gets the filename of the currently opened .chm file. | |
wxString | IndexFile () const |
Gets name of the .hhk file in the archive that could potentially be used to generate content information from. | |
wxString | Title () const |
Gets the name of the opened .chm. | |
bool | IsOk () const |
Checks if the last attempt to load a .chm file was succesful. | |
bool | HasChanged () |
Checks if a 'ms-its' link has been clicked and the chm changed. | |
wxFontEncoding | DesiredEncoding () const |
Determines the encoding that the CHM creator would like me to use. To be used in combination with DefaultFont(). | |
wxString | DefaultFont () const |
Determines the font to use for special charsets. | |
bool | LoadCHM (const wxString &archiveName) |
Attempts to load a .chm file from disk. | |
void | CloseCHM () |
Closes the currently opened .chm, or does nothing if none opened. | |
bool | GetTopicsTree (wxTreeCtrl *toBuild) |
Attempts to fill a wxTreeCtrl by parsing the topics file. | |
bool | GetIndex (CHMListCtrl *toBuild) |
Attempts to fill a CHMListCtrl by parsing the index file. | |
bool | LoadContextIDs () |
Attempts to build an index of context-ID/page pairs from the file. | |
bool | IsValidCID (const int contextID) |
Checks whether or not the context ID is valid for the loaded file. | |
wxString | GetPageByCID (const int contextID) |
Looks up the page referred to by the context-ID. | |
bool | AreContextIDsLoaded () const |
Have the context-IDs been loaded into memory or not. | |
bool | IndexSearch (const wxString &text, bool wholeWords, bool titlesOnly, CHMSearchResults *results) |
Fast search using the $FIftiMain file in the .chm. | |
bool | ResolveObject (const wxString &fileName, chmUnitInfo *ui) |
Looks up fileName in the archive. | |
size_t | RetrieveObject (chmUnitInfo *ui, unsigned char *buffer, off_t fileOffset, size_t bufferSize) |
Retrieves an uncompressed chunk of a file in the .chm. | |
Private Member Functions | |
wxFontEncoding | GetFontEncFromCharSet (int cs) |
Helper. Translates from Win32 encodings to generic wxWidgets ones. | |
wxFontEncoding | GetFontEncFromLCID (u_int32_t lcid) |
Helper. Translates from MS-specific LCID. | |
bool | GetArchiveInfo () |
Helper. Initializes most of the private data members. | |
u_int32_t | GetLeafNodeOffset (const wxString &text, u_int32_t initalOffset, u_int32_t buffSize, u_int16_t treeDepth, chmUnitInfo *ui) |
Helper. Returns the $FIftiMain offset of leaf node or 0. | |
bool | ProcessWLC (u_int64_t wlc_count, u_int64_t wlc_size, u_int32_t wlc_offset, unsigned char ds, unsigned char dr, unsigned char cs, unsigned char cr, unsigned char ls, unsigned char lr, chmUnitInfo *uifmain, chmUnitInfo *uitbl, chmUnitInfo *uistrings, chmUnitInfo *topics, chmUnitInfo *urlstr, CHMSearchResults *results) |
Helper. Processes the word location code entries while searching. | |
bool | InfoFromWindows () |
Looks up as much information as possible from WINDOWS/STRINGS. | |
bool | InfoFromSystem () |
Looks up as much information as possible from SYSTEM. | |
bool | BinaryTOC (wxTreeCtrl *toBuild, const wxCSConv &cv) |
Load binary TOC (if available). | |
void | RecurseLoadBTOC (UCharPtr &topidx, UCharPtr &topics, UCharPtr &strings, UCharPtr &urltbl, UCharPtr &urlstr, u_int32_t offset, const wxCSConv &cv, wxTreeCtrl *toBuild, int level) |
Try to recursively load the binary topics tree. | |
bool | GetItem (UCharPtr &topics, UCharPtr &strings, UCharPtr &urltbl, UCharPtr &urlstr, u_int32_t index, wxTreeCtrl *toBuild, CHMListCtrl *toBuild, const wxString &idxName, const wxCSConv &cv, int level, bool local) |
Retrieve the data (name/URL) for a single entry (TOC or index). | |
bool | BinaryIndex (CHMListCtrl *toBuild, const wxCSConv &cv) |
Get the binary index (if available). | |
bool | ConvertFromUnicode (std::string &value, unsigned char *buffer, size_t bufferLength) |
Get a regular string from a generic buffer of length bufferLength. | |
CHMFile (const CHMFile &) | |
No copy construction allowed. | |
CHMFile & | operator= (const CHMFile &) |
No assignments. | |
Private Attributes | |
chmFile * | _chmFile |
wxString | _filename |
wxString | _home |
wxString | _topicsFile |
wxString | _indexFile |
wxString | _title |
wxString | _font |
wxFontEncoding | _enc |
CHMIDMap | _cidMap |
CHMFile::CHMFile | ( | const wxString & | archiveName | ) |
This constructor attempts to open the .chm file passed as it's argument. If it fails, IsOk() will return false.
archiveName | The .chm filename on disk. |
wxString CHMFile::ArchiveName | ( | ) | const [inline] |
Gets the filename of the currently opened .chm file.
bool CHMFile::AreContextIDsLoaded | ( | ) | const [inline] |
Have the context-IDs been loaded into memory or not.
wxString CHMFile::DefaultFont | ( | ) | const [inline] |
Determines the font to use for special charsets.
wxFontEncoding CHMFile::DesiredEncoding | ( | ) | const [inline] |
Determines the encoding that the CHM creator would like me to use. To be used in combination with DefaultFont().
bool CHMFile::GetIndex | ( | CHMListCtrl * | toBuild | ) |
Attempts to fill a CHMListCtrl by parsing the index file.
toBuild | Pointer to the list control to be filled. If the index file is not available, the list control is unmodified. The lost must be empty before passing it to this function. |
wxString CHMFile::GetPageByCID | ( | const int | contextID | ) |
Looks up the page referred to by the context-ID.
contextID | The context-ID to look up |
bool CHMFile::GetTopicsTree | ( | wxTreeCtrl * | toBuild | ) |
Attempts to fill a wxTreeCtrl by parsing the topics file.
toBuild | Pointer to the tree to be filled. If the topics file is not available, the tree is unmodified. The tree must be empty before passing it to this function. |
wxString CHMFile::HomePage | ( | ) | const [inline] |
Gets the name of the default page in the archive.
wxString CHMFile::IndexFile | ( | ) | const [inline] |
Gets name of the .hhk file in the archive that could potentially be used to generate content information from.
bool CHMFile::IndexSearch | ( | const wxString & | text, | |
bool | wholeWords, | |||
bool | titlesOnly, | |||
CHMSearchResults * | results | |||
) |
Fast search using the $FIftiMain file in the .chm.
text | The text we're looking for. | |
wholeWords | Are we looking for whole words only? | |
titlesOnly | Are we looking for titles only? | |
results | A string-string hashmap that will hold the results in case of successful search. The keys are the URLs and the values are the page titles. |
bool CHMFile::IsOk | ( | ) | const [inline] |
Checks if the last attempt to load a .chm file was succesful.
bool CHMFile::IsValidCID | ( | const int | contextID | ) |
Checks whether or not the context ID is valid for the loaded file.
contextID | The context-ID to check. |
bool CHMFile::LoadCHM | ( | const wxString & | archiveName | ) |
Attempts to load a .chm file from disk.
archiveName | The .chm filename on disk. |
bool CHMFile::LoadContextIDs | ( | ) |
Attempts to build an index of context-ID/page pairs from the file.
bool CHMFile::ResolveObject | ( | const wxString & | fileName, | |
chmUnitInfo * | ui | |||
) |
Looks up fileName in the archive.
fileName | The file name to look up in the archive, qualified with '/' standing for the root of the archive filesystem. | |
ui | A pointer to CHMLIB specific data about the file. The parameter gets filled with useful data if the lookup was succesful. |
size_t CHMFile::RetrieveObject | ( | chmUnitInfo * | ui, | |
unsigned char * | buffer, | |||
off_t | fileOffset, | |||
size_t | bufferSize | |||
) |
Retrieves an uncompressed chunk of a file in the .chm.
ui | Pointer to a CHMLIB specific data structure obtained from a succesful call to ResolveObject(). | |
buffer | The buffer to place the chunk into. | |
fileOffset | Where does the chunk we want begin in the file? | |
bufferSize | The size of the buffer. |
wxString CHMFile::Title | ( | ) | const [inline] |
Gets the name of the opened .chm.
wxString CHMFile::TopicsFile | ( | ) | const [inline] |
Gets name of the .hhc file in the archive that could potentially be used to generate content information from.