namespace, forward class definitions (and "using")
René J.V. Bertin
rjvbertin at gmail.com
Tue Apr 10 07:57:16 UTC 2018
Hi,
I ran into a snag in my experiments with the topcontexts implementation which is almost certainly caused by something I still don't grasp in KDevelop's use of namespaces.
As mentioned, I started out by introducing a thin wrapper class (say, FooFile) to be used via an alias class declared as `using FooStorage = FooFile;`.
My intention was to hide the details as much as possible in the implementation file (foodynamicdata.cpp), putting only enough in the foodynamicdata.h to be able to use the new classes in the exported declarations (`void writeData(FooStorage* store);` instead of `void writeData(QFile* file)`):
// existing forward defs in namespace KDevelop
class FooFile;
class FooLMDB;
using FooStorage = FooFile;
//...
void writeData(FooStorage* store);
I also would like to avoid introducing a separate implementation file, for now.
The snag is that I cannot figure out where to put the FooFile class forward def and its implementation in foodynamicdata.cpp to avoid a confusion between FooFile and KDevelop::FooFile .
The rough outline of foodynamicdata.cpp is
#include "foodynamicdata.h"
using namespace KDevelop;
namespace {
// all code is here
}
In the end I've put a full instead of a forward definition of the FooFile class in the headerfile. What am I missing here?
Thanks,
R.
More information about the KDevelop-devel
mailing list