Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. parsing C++ header file

parsing C++ header file

Scheduled Pinned Locked Moved C / C++ / MFC
c++designjsonquestion
10 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DevMentor org
    wrote on last edited by
    #1

    Does anyone know of any open-source code that will allow me to parse a C++ header file for all the class method signatures?

    --- Yours Truly, The One and Only! web: devmentor.org Design, Code, Test, Deploy

    H M 2 Replies Last reply
    0
    • D DevMentor org

      Does anyone know of any open-source code that will allow me to parse a C++ header file for all the class method signatures?

      --- Yours Truly, The One and Only! web: devmentor.org Design, Code, Test, Deploy

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      Can you more explain about parsing a header file,please?

      D D 2 Replies Last reply
      0
      • D DevMentor org

        Does anyone know of any open-source code that will allow me to parse a C++ header file for all the class method signatures?

        --- Yours Truly, The One and Only! web: devmentor.org Design, Code, Test, Deploy

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #3

        Doxygen

        --Mike-- Visual C++ MVP :cool: LINKS~! CP SearchBar v3.0 | C++ Forum FAQ Dunder-Mifflin, this is Pam.

        D 1 Reply Last reply
        0
        • H Hamid Taebi

          Can you more explain about parsing a header file,please?

          D Offline
          D Offline
          DevMentor org
          wrote on last edited by
          #4

          i am looking for simple code that will give me a list of all the class method signatures. i want to use these signatures for a tool to generate mock classes for a unit testing tool i have developed.

          --- Yours Truly, The One and Only! web: devmentor.org Design, Code, Test, Debug

          1 Reply Last reply
          0
          • M Michael Dunn

            Doxygen

            --Mike-- Visual C++ MVP :cool: LINKS~! CP SearchBar v3.0 | C++ Forum FAQ Dunder-Mifflin, this is Pam.

            D Offline
            D Offline
            DevMentor org
            wrote on last edited by
            #5

            i was just thinking about this project! i wonder if they have a few simple classes i can use to get a parse tree of only the method signature? ... i was looking for something more simple, don't got the energy to dive into larger projects and start ripping out what i need :laugh: possibly i can ask the developers to point me to the files i need. thanks

            --- Yours Truly, The One and Only! web: devmentor.org Design, Code, Test, Debug

            T B 2 Replies Last reply
            0
            • D DevMentor org

              i was just thinking about this project! i wonder if they have a few simple classes i can use to get a parse tree of only the method signature? ... i was looking for something more simple, don't got the energy to dive into larger projects and start ripping out what i need :laugh: possibly i can ask the developers to point me to the files i need. thanks

              --- Yours Truly, The One and Only! web: devmentor.org Design, Code, Test, Debug

              T Offline
              T Offline
              toxcct
              wrote on last edited by
              #6

              just a guess, but what are you trying to accomplish here ? forget this, i've just seen your reply[^] to Hamid.


              [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

              1 Reply Last reply
              0
              • H Hamid Taebi

                Can you more explain about parsing a header file,please?

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                What part of "parse a C++ header file for all the class method signatures" is troubling you? That's fairly self-explanatory, yes?


                "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

                "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                H 1 Reply Last reply
                0
                • D David Crow

                  What part of "parse a C++ header file for all the class method signatures" is troubling you? That's fairly self-explanatory, yes?


                  "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

                  "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                  H Offline
                  H Offline
                  Hamid Taebi
                  wrote on last edited by
                  #8

                  Yeah I see. BTW(I saw your signature they are nice sentences).

                  1 Reply Last reply
                  0
                  • D DevMentor org

                    i was just thinking about this project! i wonder if they have a few simple classes i can use to get a parse tree of only the method signature? ... i was looking for something more simple, don't got the energy to dive into larger projects and start ripping out what i need :laugh: possibly i can ask the developers to point me to the files i need. thanks

                    --- Yours Truly, The One and Only! web: devmentor.org Design, Code, Test, Debug

                    B Offline
                    B Offline
                    Bram van Kampen
                    wrote on last edited by
                    #9

                    DevMentor.org wrote:

                    i was looking for something more simple

                    Unfortunately, this is not a simple problem.The parser has to be able to handle everything that the CPP language can throw at it, and has to start with trigraph conversion and pre-processing. If all you need is a tool to fish methods out of classes, something simpler may do. Kernighan and Ritchie give an excelent example of a function declaration parser in their book which you can possibly expand upon for CPP. But, then again, you need to know the names of the types. They are often declared in previously included headers. Maybe hard code in a basic symbol table? Regards and success :doh:

                    Bram van Kampen

                    D 1 Reply Last reply
                    0
                    • B Bram van Kampen

                      DevMentor.org wrote:

                      i was looking for something more simple

                      Unfortunately, this is not a simple problem.The parser has to be able to handle everything that the CPP language can throw at it, and has to start with trigraph conversion and pre-processing. If all you need is a tool to fish methods out of classes, something simpler may do. Kernighan and Ritchie give an excelent example of a function declaration parser in their book which you can possibly expand upon for CPP. But, then again, you need to know the names of the types. They are often declared in previously included headers. Maybe hard code in a basic symbol table? Regards and success :doh:

                      Bram van Kampen

                      D Offline
                      D Offline
                      DevMentor org
                      wrote on last edited by
                      #10

                      Thanks Bran for your reply. I have found a simply tool that someone from the Doxygen-Develop mailing list said I could use, it's called gcc-xml and designed for tool developers like me who don't want to read the "Red Dragon" book on parsing :)

                      --- Yours Truly, The One and Only! web: devmentor.org Design, Code, Test, Debug

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups