Hi everyone!
I've been searching for the solution to the following question for a while with no success. Hopefully you will be able to help or clear me out.
So the situation is this:
There is this library RapidXML for XML processing, which is basically (for what i need) just one .hpp file. It has some standart includes and all the code that is needed for XML processing.
Now I am writing sort of xml reader library (which uses RapidXML) for specific xml files. This library reads xml file and creates array of stuctures which would be much more convienient to use later than RapidXML library directly.
And there's of course the main program which uses the actual array of structures.
This project has 4 files:
rapidxml.hpp
1 2 3 4 5
|
#define something
#include <some_basic_includes_for_rapidxml>
//actual classes and code
|
MyLibrary.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
#include "rapidxml.hpp"
struct MyStructure {
int a, b, c;
};
class MyClass {
private:
rapidxml::xml_document<> *doc;
//other private rapidxml namespace variables
public:
MyClass();
~MyClass();
int getNodeAmmount();
int getNodes(MyStructure *nodes, int length);
}
|
MyLibrary.cpp
|
//just the actual code for MyClass functions
|
Main.cpp
1 2 3 4 5 6 7 8 9 10 11 12
|
#include "MyLibrary.h"
int main() {
//some irrelevant code...
MyClass *myclass = new MyClass();
int num = myclass->getNodeAmmount();
MyStructure *nodes = new MyStructure[num];
myclass->getNodes(nodes, num);
//further proccessing
}
|
At the moment I could add something like
using namespace rapidxml
to the main file and that would compile. The problem is that I dont want that main program (or any other that includes MyLibrary.h) could see rapidxml and especially includes from rapidxml.hpp (altough those are more or less standard includes). Is there a way to do this. I've tried placing
#include "rapidxml.hpp"
inside MyClass definition, but that doesnt really compile. What I want to do is make MyLibrary like an interface or wrapper and programs which use MyLibrary shouldn't and (for what I want) musn't see "inside parts" of MyLibrary.
I hope it is possible to understand what am I explaining. If not, please ask. Thank you for you patience.