// Copyright (c) 1999-2000 David Muse
// See the COPYING file for more information

#ifndef GROUNDWORK_H
#define GROUNDWORK_H

#include <interface.h>
#include <cgi.h>
#include <page.h>
#include <pathnames.h>
#include <jogtimeout.h>

// The groundwork class provides functionality essential to build 
// simple web based programs.

class	groundwork: 
		public interface, 
		public cgi, 
		public page,
		public pathnames,
		public jogtimeout {

	friend class extendedgroundwork;

	public:
		void	initGroundwork(int joginterval, int timeout);

		int	execute();
			// sends a standard header and calls parsePage
			// on the html page with a corresponding name
			// to the name of the cgi in the appropriate
			// interface directory
			// returns the value of the parsePage call

		// path variables
		char	*site();
		char	*app();
		char	*package();
			// these functions return the site, package, app and
			// interface.
			//
			// site, package and app are derived from the 
			// SCRIPT_NAME environment variable, and assume that 
			// the cgi is in the 
			// /usr/local/web/"site"/"package"/apps/"app"/cgi-bin
			// directory.
		char	*htmlFileName();
			// returns the full path name of the html page in
			// the specefied interface directory corresponding to
			// the cgi

	private:
		#include <private/groundwork.h>

};

#endif