C++ Offline Documentation
Introduction
Sometimes when I was traveling on the airplane and there is no Internet access, programming, especially programming using C++, became hard for me since there is no documentation for me to look up. So I started to look for C++ documentation that can be used offline.
cppreference.com provides several ways of viewing C++ documentation offline. I tried some of them and noticed that each of them has advantages and drawbacks.
In this blog post, I am going to document what I thought about those methods of viewing C++ documentation offline, and recommend a better way to do in practice.
Methods
HTML Book
We could download a HTML book from the archives on cppreference.com. When we browse it using Chrome or Firefox, the format and display would be almost exactly the same as what is on the online website.
The drawback of HTML Book is that we could only use the index provided by the book to look for what we want. Searching the content is not possible.
Devhelp Book
Devhelp is a documentation browser for GTK/Gnome. We could install Devhelp and the HTML book which Devhelp would load using the following commands.
1 | $ sudo apt-get update |
The HTML book installed via apt-get
would be installed to /usr/share/cppreference/doc/html/
. However, it might not be up-to-date. Although I have not tried it myself, my expectation is that we could replace the entire book to the latest one we could download from the archives on cppreference.com. Simply run the following command to start Devhelp and the C++ HTML book will be on the list.
1 | $ devhelp |
The rendering and display are actually very close to the HTML book. The drawback is Devhelp is not portable. It is not available in Windows and the Linux distributions which do not use GTK/Gnome. It does not have search engine either. The “search” is entirely based on index.
Qt Help Book
qch
is a documentation format for use in the Qt tools. There is a qch
format C++ reference book we could download from the archives on cppreference.com. We also need to install Qt Assistant to view the C++ Qt help book.
1 | $ sudo apt-get update |
After installation, we start Qt Assistant using the following command.
1 | $ assistant |
The we load the the C++ Qt help book by clicking Edit
-> Preferences
-> Documentation
-> Add
.
The rendering and display in the Qt Assistant are bad. The advantages of Qt Assistant is that it is available on Windows and different Linux distributions. Qt Assistant also comes with a search engine which is very attractive to users.
The following recommended installation method from cppreference.com does not work quite well. It comes with Qt Assistant 4 instead of 5. Some characters could not display correctly somehow. The C++ Qt Help Book it comes with, which is in the /usr/share/cppreference/doc/qch/
, is also out-of-date.
1 | $ sudo apt-get update |
Conclusions
I would recommend installing at least the HTML book for reading and the Qt help book for searching.
References
C++ Offline Documentation