[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[help-cgicc] Subclassing CgiInput
From: |
mk . gnu |
Subject: |
[help-cgicc] Subclassing CgiInput |
Date: |
Thu, 19 Apr 2007 20:49:30 +0200 |
Hello @All.
I hope anyone can help me on this topic. I'm trying to use the cgicc library in
a FastCgi environment. Therefore I want to subclass CgiInput as described in
the cgicc documentation. My FastCgiInput class looks as follows:
class FastCgiInput
: public cgicc::CgiInput {
friend class FastCgiManager;
private:
FastCgiInput();
FastCgiInput(const FastCgiInput & anOriginal);
public:
virtual
~FastCgiInput();
public:
virtual
size_t
read(char * Data, size_t aLength) const;
virtual
std::string
getenv(const char * aName) const;
};
The constructor is private, because only the methods of the friend class
FastCgiManager should be able to create FastCgiInput objects. It has no effect,
if I change the constructors to be public. However, the behaviour is not the
desired one: It is possible to create a new object of type FastCgiInput and the
overloaded methods read and getenv work fine, if called directly on the created
object. But it is impossible to create an object of type CgiEnvironment by
passing a FastCgiInput object to the constructor. If doing so, the
CgiEnvironment seems not to be able to read out the environment variables. As
an illustration:
FastCgiInput * i = new FastCgiInput();
CgiEnvironment * e = new CgiEnvironment(i);
A call to i->getenv("QUERY_STRING") is successful and returns the right query
string, but a call to e->getQueryString() returns an empty string.
The documentation says, that the operator= must be overloaded. What exactly
does that mean? What signature should I use when overloading operator=? How
does this affect the behaviour of the code?
Thanks,
Matthias
- [help-cgicc] Subclassing CgiInput,
mk . gnu <=