Logo Search packages:      
Sourcecode: kchmviewer version File versions  Download package

CHMFile Class Reference

#include <xchmfile.h>

List of all members.


Detailed Description

Mostly a C++ wrapper around the CHMLIB facilities. Concrete class.

Definition at line 91 of file xchmfile.h.


Public Member Functions

QString ArchiveName () const
 Gets the filename of the currently opened .chm file.
 CHMFile (const QString &archiveName)
 This constructor attempts to open the .chm file passed as it's argument. If it fails, IsOk() will return false.
 CHMFile ()
 Default constructor.
void CloseCHM ()
 Closes the currently opened .chm, or does nothing if none opened.
QString DefaultFont () const
 Gets the name of the default font.
bool enumerateArchive (QValueVector< QString > &files)
CHMFilegetCHMfilePointer (const QString &filename)
 Gets the CHM file pointer. Used when more than one CHM file is loaded (i.e. cross-links in CHM files).
const
KCHMTextEncoding::text_encoding_t * 
getCurrentEncoding ()
 Returns current CHM file text encoding.
bool GetFileContentAsString (QString &str, QString filename, QString location)
bool GetFileContentAsString (QString &str, QString location, bool internal_encoding=false)
 Puts in the str parameter the contents of the file referred by location.
bool GetFileContentAsString (QString &str, const chmUnitInfo *ui, bool internal_encoding=false)
 Puts in the str parameter the contents of the file referred by ui.
void GetSearchResults (const KCHMSearchProgressResults_t &tempres, KCHMSearchResults_t &results, unsigned int limit_results=500)
 Finalize the search, resolves all the and generate the results.
QString getTopicByUrl (const QString &url)
 Returns the topic from TOPICS.
KCHMMainTreeViewItemgetTreeItem (const QString &url) const
QString HomePage () const
 Gets the name of the default page in the archive.
QString IndexFile () const
 Gets name of the .hhk file in the archive that could potentially be used to generate content information from.
bool IsOk () const
 Checks if the last attempt to load a .chm file was succesful.
bool isSearchAvailable ()
 Returns true if built-in search tree is present.
bool LoadCHM (const QString &archiveName)
 Attempts to load a .chm file from disk.
bool ParseAndFillIndex (QListView *indexlist)
 Attempts to fill a QListView by parsing the index file.
bool ParseAndFillTopicsTree (QListView *toBuild)
 Attempts to fill a QListView by parsing the topics file.
bool ResolveObject (const QString &fileName, chmUnitInfo *ui)
 Looks up fileName in the archive.
size_t RetrieveObject (const chmUnitInfo *ui, unsigned char *buffer, LONGUINT64 fileOffset, LONGINT64 bufferSize)
 Retrieves an uncompressed chunk of a file in the .chm.
bool SearchWord (const QString &word, bool wholeWords, bool titlesOnly, KCHMSearchProgressResults_t &results, bool phrase_search)
 Fast search using the $FIftiMain file in the .chm.
bool setCurrentEncoding (const KCHMTextEncoding::text_encoding_t *enc)
 Sets the CHM file text encoding.
QString Title () const
 Gets the name of the opened .chm.
QString TopicsFile () const
 Gets name of the .hhc file in the archive that could potentially be used to generate content information from.
 ~CHMFile ()
 Destructor. If a file has been succesfully opened, it closes it.

Private Types

typedef QMap< QString, CHMFile * > chm_loaded_files_t
typedef QMap< QString,
KCHMMainTreeViewItem * > 
KCHMTreeUrlMap_t

Private Member Functions

bool changeFileEncoding (const char *qtencoding)
 CHMFile (const CHMFile &)
 No copy construction allowed.
QCString convertSearchWord (const QString &src)
 Convert the word, so it has an appropriate encoding.
QString encodeInternalWithCurrentCodec (const char *str) const
QString encodeInternalWithCurrentCodec (const QString &str) const
QString encodeWithCurrentCodec (const char *str) const
 Encode the string with the currently selected text codec, if possible. Or return as-is, if not.
QString encodeWithCurrentCodec (const QString &str) const
 Encode the string with the currently selected text codec, if possible. Or return as-is, if not.
int findStringInQuotes (const QString &tag, int offset, QString &value, bool firstquote, bool decodeentities)
const char * GetFontEncFromCharSet (const QString &font) const
 Helper. Translates from Win32 encodings to generic wxWidgets ones.
u_int32_t GetLeafNodeOffset (const QString &text, u_int32_t initalOffset, u_int32_t buffSize, u_int16_t treeDepth)
 Helper. Returns the $FIftiMain offset of leaf node or 0.
bool guessTextEncoding ()
 Guess used text encoding, using m_detectedLCID and m_font. Set up m_textCodec.
bool InfoFromSystem ()
 Looks up as much information as possible from SYSTEM.
bool InfoFromWindows ()
 Looks up as much information as possible from WINDOWS/STRINGS.
CHMFileoperator= (const CHMFile &)
 No assignments.
bool ParseChmIndexFile (const QString &file, bool asIndex, KCHMParsedIndexEntry_t &cont)
 Parse the HHC or HHS file, and fill the data.
bool ParseHhcAndFillTree (const QString &file, QListView *tree, bool asIndex)
 Parse the HHC or HHS file, and fill the context (asIndex is false) or index (asIndex is true) tree.
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, KCHMSearchProgressResults_t &results, bool phrase_search)
 Helper. Processes the word location code entries while searching.
void setupTextCodec (const char *name)
 Sets up textCodec.

Private Attributes

chmUnitInfo m_chmFIftiMain
 pointer to /$FIftiMain
chmFile * m_chmFile
 Pointer to the chmlib structure.
chm_loaded_files_t m_chmLoadedFiles
 Loaded chm files.
chmUnitInfo m_chmSTRINGS
 pointer to /STRINGS
chmUnitInfo m_chmTOPICS
 pointer to /TOPICS
chmUnitInfo m_chmURLSTR
 pointer to /URLSTR
chmUnitInfo m_chmURLTBL
 pointer to /URLTBL
const
KCHMTextEncoding::text_encoding_t * 
m_currentEncoding
 Current encoding.
short m_detectedLCID
 LCID from CHM file, used in encoding detection.
QMap< QString, QString > m_entityDecodeMap
 Map to decode HTML entitles like based on current encoding.
QString m_filename
 Opened file name.
QString m_font
 font charset from CHM file, used in encoding detection
QString m_home
 Home url, got from CHM file.
QString m_indexFile
 Index filename. Got from CHM file.
bool m_lookupTablesValid
 TRUE if /TOPICS, /STRINGS, /URLTBL and /URLSTR are resolved, and the members below are valid.
bool m_searchAvailable
QTextCodec * m_textCodec
 Chosen text codec.
QTextCodec * m_textCodecForSpecialFiles
QString m_title
 Chm Title. Got from CHM file.
QString m_topicsFile
 Context tree filename. Got from CHM file.
KCHMTreeUrlMap_t m_treeUrlMap
 Used by getTreeItem() to find the tree element quickly.

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

Generated by  Doxygen 1.6.0   Back to index