I don't know any tool like that, sincerely. Anyway I will try to answer your question. I'm not sure to understand you, so correct me if I'm wrong.
You want to take out methods & members of private section's of classes ? That will change class signature and nobody could link against your library !
Perhaps, you have to do a *manual* cleanup of your classes, putting all private ( or irrelevant to the final user ) members & methods in a private class & out of public headers. Have you heard about pimpl idiom ? See the wiki, It's a good beginning.
Using pimpl, It's a good approach to write libraries. I'm using an strategy like this in a big project I'm working on and makes me live happier . I usually create 3 files for each class :
* Class.h => Public interface, with the minimal includes I can put in it. That means : if I don't have to instantiate an object of that class, i don't have to #include it's header. As an example :
#include <BaseClass>
Class A;
Class B_Private;
Class B : public BaseClass // <== I HAVE TO #include, of course
{
// PIMPL zone...
B_Private * d_ptr;
Q_DECLARE_PRIVATE(B_Private);
public :
B();
~B();
void foo ( const A & Data ) const; // <== I DON'T HAVE TO #include
}
#include <BaseClass>
Class A;
Class B_Private;
Class B : public BaseClass // <== I HAVE TO #include, of course
{
// PIMPL zone...
B_Private * d_ptr;
Q_DECLARE_PRIVATE(B_Private);
public :
B();
~B();
void foo ( const A & Data ) const; // <== I DON'T HAVE TO #include
}
To copy to clipboard, switch view to plain text mode
* ClassB_p.h : declaration of private class, that hides implementation. Those headers doesn't have to be deployed, of course. And you can always put some code to forbid using those headers :
#if !defined(__INTO_MYLIBRARY__)
#error "This File is only for MYLIBRARY internal use !!"
#endif
#if !defined(__INTO_MYLIBRARY__)
#error "This File is only for MYLIBRARY internal use !!"
#endif
To copy to clipboard, switch view to plain text mode
Defining __INTO_MYLIBRARY__ into your library's .pro file it's enough to allow you to re-compile the library.
* Class.cpp : implementation of public & private parts of the class. Here I make the major part of #includes, as needed. At least, this pair
#include "ClassB.h"
#include "ClassB_p.h"
( ... implementation ... )
#include "ClassB.h"
#include "ClassB_p.h"
( ... implementation ... )
To copy to clipboard, switch view to plain text mode
Bookmarks