Author Topic: Help - Add pre-defined function/file description by shortcut key  (Read 4451 times)

Offline eraser

  • Single posting newcomer
  • *
  • Posts: 3
I need this feature in Code::Blocks edit environment. It maybe like this:

   // File Name: Current file.cc
   // Description:
[blank]
   
   #include .....
   ...
   
   // Function Name: myFun
   // Description:
[blank]
   // input1: int
   // input2: char
   // output: void

   void myFun(int input1, char input2) {
   ...
   }

I hope the BLUE part, which style is defined in advance and can acquire the FILENAME and function declaration, is inserted automatically by a shortcut key. Does anyone has a solution?  A similar implementation can also be accepted. Thanks.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Help - Add pre-defined function/file description by shortcut key
« Reply #1 on: May 21, 2010, 07:13:38 am »
Quote
I hope the BLUE part, which style is defined in advance and can acquire the FILENAME and function declaration, is inserted automatically by a shortcut key.

Ha, this function should be implemented in CodeCompletion plugin. Because the CC can understand where your current caret is. This is the same feature as the CC's ToolBar( in Which, when you caret moved, the Toolbar information get updated too).

It can be regard as a "feature request".  :D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline eraser

  • Single posting newcomer
  • *
  • Posts: 3
Re: Help - Add pre-defined function/file description by shortcut key
« Reply #2 on: May 21, 2010, 10:44:29 am »
I took a look at the configuration of CodeCompletion plugin in "Settings"->"Editor"->"Code-completion and symbols browser". I couldn't find the appropriate options. So, can you teach me hand by hand how to realize this feature? Thank you very much.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Help - Add pre-defined function/file description by shortcut key
« Reply #3 on: May 21, 2010, 11:02:26 am »
can you teach me hand by hand how to realize this feature? Thank you very much.
Well, If you want to implement this function, you should dig into the source code of "CodeCompletion plugin", this is the only way if you want to implement this function. If you really want to do that, I can give more advice.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Help - Add pre-defined function/file description by shortcut key
« Reply #4 on: May 21, 2010, 11:17:12 am »
The second can be done with the DoxyBlocks-plugin : http://forums.codeblocks.org/index.php/topic,12052.msg85232.html#msg85232,
the first is not implemented (as far as I know), but should not be too hard to do.

Offline eraser

  • Single posting newcomer
  • *
  • Posts: 3
Re: Help - Add pre-defined function/file description by shortcut key
« Reply #5 on: May 22, 2010, 02:26:57 am »
I'm a freash man, and just start to learn C++ days before.  I tried Doxygen plugin last night and couldn't make it work. l'm willing to do something on CC. I can learn more and effectively. So please help me!

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Help - Add pre-defined function/file description by shortcut key
« Reply #6 on: May 22, 2010, 04:10:20 am »
I'm a freash man, and just start to learn C++ days before.  I tried Doxygen plugin last night and couldn't make it work. l'm willing to do something on CC. I can learn more and effectively. So please help me!
AHa, CC has a sub forum, see CodeCompletion redesign

Also, there are some wiki page like :Code Completion Design and Code::Completion Rewriteand

Also, you should read the source of the code completion plugin. (learn how to build codeblocks first, some wiki pages will tell you the steps, for Windows, see Installing Code::Blocks from source on Windows)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.