#ifndef __Global_h__
# define __Global_h__

# include "MString.h"
# include "CGIFormattedData.h"
# include "CGIFormData.h"
# include <map>

namespace  jet {

   class __mysql;
   
   class Global {

    public:
      Global(char **envp);
      virtual ~Global();

      void dump();
      bool sessionExists(coreutils::MString sessionId);
      void addSession(coreutils::MString sessionId, __mysql *mysql);
      void removeSession(coreutils::MString sessionId);
      __mysql * getSession(coreutils::MString sessionId);
      coreutils::ZString getSessionVariable(coreutils::MString &splitName);
      void outputHeaders();
      void setupFormData(coreutils::ZString &formdata);
      void setupFormURLEncoded(coreutils::ZString &formdata);
      char *errorCursor = NULL;
	
      coreutils::CGIFormattedData cookies;
      coreutils::CGIFormData *cgiData;
      std::map<coreutils::MString, coreutils::MString> variables;
      std::map<coreutils::MString, __mysql *> sessions;
      std::map<coreutils::MString, coreutils::MString> headers;
      std::map<coreutils::MString, coreutils::MString> tags;
      char **envp;
      bool cgi = false;
      bool session = false;
      coreutils::MString sessionId;
      
   };

}

#endif
