Results 1 to 9 of 9

Thread: Develop C++ IDE

  1. #1
    Join Date
    Jun 2010
    Posts
    97
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Develop C++ IDE

    I am working on IDE which will write C++ code in editor. I have advanced quite but has facing problems of showing functions, variables or any other declarations in popup list while typing in text editor from header files. This will be exactly like we declares a method in .h file QT and while implementing in .cpp we type dot key and gets its details in list box.

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Develop C++ IDE

    And what's your problem exactly ? You don't know how to create a list of all variables available in the current scope of the cursor ? This doesn't surprise me, you'll need to write a kind of C++ grammar parser for that
    Suppose that user writes
    Qt Code:
    1. #include <iostream>
    To copy to clipboard, switch view to plain text mode 
    After the file is saved, a good IDE should now parse the included file and extract all available classes, symbols and methods (if its not done already). Writing such editor is not trivial task, for example, imagine an user writing an implementation of a method. Depending on the cursor position, you'll need to provide different lists of available variables:
    Qt Code:
    1. void MyClass::method(){
    2. int x, y;
    3. //pos1 - all symbols from global scope, MyClass scope, and variables x,y
    4. {
    5. #ifdef SYMBOL_1
    6. int scopedVar;
    7. // pos2 - all symbols from pos1 and scopedVar, but only if SYMBOL_1 is defined !
    8. ...
    9. #else
    10. ...
    11. #endif
    12. }
    13. }
    To copy to clipboard, switch view to plain text mode 
    Ok, but what was your question anyway ?

  3. #3
    Join Date
    Jun 2010
    Posts
    97
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Develop C++ IDE

    The question is how do I get list of functions and variables from header file. I know how to populate in list and show whenever dot key is pressed. I was just checking if there is any methodology to parse header file to list its contents.

  4. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Develop C++ IDE

    If you want to have full list, you won't escape writing a kind of C++ preprocessor, because some variables (or even whole classes) can be declared using some of its features, like macro expansion or new line splitting.
    Next thing is parse the C++ code itself - you need to be familiar with context free grammars. Parsing C++ code is a really tough task if you ask me.
    Try to google for "writing a C++ parser" or something like that, and see for yourself.
    In your case it could be easier than a "real" C++ parser, because you don't really have to care about syntax errors in general, as you are only interested in declarations - but a good IDE will warn about syntax errors as well
    I don't really know how to help you, try to use google, maybe you can find some code samples or something.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Develop C++ IDE

    You can get away with some of the work by using ctags.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Develop C++ IDE

    Or maybe you can get inspiration from Qt Creator, since it's open source, here is a link to Qt Creator 2.1 source

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Develop C++ IDE

    Or you can drop your project and instead extend QtCreator. Many people would benefit from that.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Develop C++ IDE

    What you need to ask yourself is "Does anyone want yet another C++ editor?". There are lots of editors already out there, why do want to put the time and effort into something that has already been done multiple times?

    For example, Qt Creator does what you want and is free.
    Netbeans does what you want and is free, cross platform, and multi language.
    CodeLite does what you want and is free.
    Visual Studio Express does what you want and is free.
    etc...

    If you want specific features that other editors don't have, then implement them via plugins. No need to write yet another editor from scratch.

  9. #9
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Develop C++ IDE

    why do want to put the time and effort into something that has already been done multiple times?
    I second that. Writing yet another text/code editor makes very little sense.
    But if you simply enjoy doing it and/or you feel that you can learn a lot, then just do it.
    What you need to ask yourself is "Does anyone want yet another C++ editor?"
    Correct. And continue with your project if the answer is "Yes, I want it".

Similar Threads

  1. Video Conference Develop
    By Ricardo_arg in forum Qt Programming
    Replies: 4
    Last Post: 9th January 2014, 22:35
  2. How to develop Dll in Qt ?
    By semaphore in forum General Discussion
    Replies: 5
    Last Post: 13th August 2010, 16:00
  3. How to develop on window and deploy on mac.
    By Tarun in forum Installation and Deployment
    Replies: 3
    Last Post: 14th January 2010, 14:53
  4. develop a tree.
    By tkms in forum Qt Programming
    Replies: 1
    Last Post: 8th January 2009, 05:18
  5. Should I develop my own model and view?
    By dandanch in forum Qt Programming
    Replies: 1
    Last Post: 20th November 2006, 07:09

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.