ChipMaster's trial hacks on C++CMS starting with v1.2.1. Not sure I'll follow on with the v2 since it looks to be breaking and mostly frivolous.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
803 B

  1. #ifndef CPPCMS_CGICC_CONN_H
  2. #define CPPCMS_CGICC_CONN_H
  3. #include <boost/noncopyable.hpp>
  4. #include <cgicc/Cgicc.h>
  5. #include <string>
  6. #include <ostream>
  7. #include <memory>
  8. namespace cppcms {
  9. using namespace std;
  10. class cgicc_connection : private boost::noncopyable {
  11. public:
  12. virtual string env(char const *variable) = 0;
  13. virtual cgicc::Cgicc &cgi() = 0;
  14. virtual ostream &cout() = 0;
  15. virtual ~cgicc_connection() {};
  16. };
  17. class cgicc_connection_cgi : public cgicc_connection {
  18. auto_ptr<cgicc::Cgicc> save_cgi;
  19. public:
  20. cgicc_connection_cgi() : save_cgi(new cgicc::Cgicc()) {};
  21. virtual string env(char const *var)
  22. {
  23. char const *ptr=getenv(var);
  24. if(ptr) return ptr;
  25. return "";
  26. };
  27. virtual cgicc::Cgicc &cgi() { return *save_cgi; };
  28. virtual ostream &cout() { return std::cout; };
  29. };
  30. };
  31. #endif