Community
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    Community Forum Index -> Tips
View previous topic :: View next topic  
Author Message
shaqmeister



Joined: 15 Feb 2009
Posts: 18

PostPosted: Thu Apr 23, 2009 10:46 pm    Post subject: Adding a context-sensitive c++ reference lookup in TextPad Reply with quote

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/exception/bad_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:
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.
Back to top
View user's profile Send private message
edward23



Joined: 08 Jun 2009
Posts: 2

PostPosted: Mon Jun 08, 2009 8:55 am    Post subject: Reply with quote

thanks I Try it Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Community Forum Index -> Tips All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB