Adding a context-sensitive c++ reference lookup in TextPad

Usage tips, posted by users. No questions here please.

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
shaqmeister
Posts: 18
Joined: Sun Feb 15, 2009 12:50 pm

Adding a context-sensitive c++ reference lookup in TextPad

Post by shaqmeister »

If you are using TextPad to code in c++ and find that you are regularly using books or internet resources to look up references to things like standard class library functions and classes, the following will show you how it is possible to link to one particular resource directly from your code with a single click on a suitably set-up tool.

The resource in question is CPlusPlus.com (www.cplusplus.com) which provides, amongst other things, separate listings together with example usage for all the main elements of the c++ library.

These are all stored in a hierarchy under www.cplusplus.com/reference/. So, for instance, the url for std::bad_exception is www.cplusplus.com/reference/std/excepti ... exception/ whilst that for the string class is www.cplusplus.com/reference/string/string/.

These are not very helpful in themselves when it comes to setting up a tool. However, what the site also provides is a keyword transformation that means that any url entered as www.cplusplus.com/{keyword_here} is automatically expanded to the correct url, so that it is possible to ignore the hierarchy of paths altogether. So, for example, we could request information on the C function (also valid c++) strlen, used to find the length of a c-style string, by entering only www.cplusplus.com/strlen, and this will be automatically expanded to the correct www.cplusplus.com/reference/clibrary/cstring/strlen/ for us.

This is ideal for setting up a tool in TextPad that will enable the user to merely place the cursor in the middle of any c++ library identifier such as "string" or "vector" and, with the click of a button, open a new web browser tab at the correct page for that resource.

These are the settings for the TextPad tool. (Note, I am using Google Chrome here, simply because it is very lightweight and loads quickly. Any other browser will do just as well, of course.)

Code: Select all

Command: C:\Users\{User}\AppData\Local\Google\Chrome\Application\chrome.exe
Parameters: http://www.cplusplus.com/$SelWord
Initial Folder: {blank}
Check boxes: all UNchecked
Then, suppose you are writing your code and you've just added a vector, and you are wanting to refresh your memory on the methods made available by the vector class, merely set the cursor somewhere within the word vector and click on the tool.

What it doesn't work for are the basic language constructs such as the main keywords, e.g., class, switch, throw. Neither can it locate methods directly from the method name; it is necessary, rather, to launch from the library function or class name itself, and the page loaded will list all overloads and member methods in one view.
edward23
Posts: 2
Joined: Mon Jun 08, 2009 8:51 am

Post by edward23 »

thanks I Try it :D
Post Reply