Cgipp v0.3 <-> Cgipp v0.2
|
The whole library has been simplified and reduced in size and
complexity, and I have stopped using a cgiMain() function,
which was heavily criticised by Arne Sletteng. I have removed some of
the classes, changed names on others and put some functions inside
classes where they made more sense. The changes can easily be
summarized as:
CgiData is now named Cgipp, and is the main class of the
system. The old cgiMain() function is also included in the
constructor
of Cgipp and an example start of a program can be:
main() {
int found=0;
Cgipp *cgi = new Cgipp();
htmlTool doc(cout);
doc.printHeader();
char *name = cgi->getvar("name", 80, found);
if (name) doc << "Name is " << name << br;
delete cgi;
return 0;
};
another change you may have noted in the above example is that
the fetchString method now is named getvar which is
both simpler to understand and shorter to write. Check the
documentation for the names of the new methods.
The Toolbox-class was dependent on the CGI-library to work, but
this dependency has been removed and the Toolbox-class can be used
anywhere. Some methods have been removed to accomplish this. The
toolbox class is also not part of the standard make, and to include it
in the library you must edit the makefiles/fix the IDE-file.
The CgiEnv class has been simplified and many methods have been
removed, if you need any of the old, see how I have made the methods
and edit the source code (very easy). I did this to reduce the
code-size.
The htmlTool class has lost some of it's useless methods which
nobody used anyway.
You can now use the main() function to do what you want
it to and not be forced to use a cgiMain() application.
Cgipp has changed quite a lot from Cgicc, but I have tried to
maintain much of the old structure, to make the conversion from Cgicc to Cgipp
as easy and trivial as possible. The most notable changes is:
CgiForm and CgiPackage has been combined into one class:
CgiData, this solves many of the problems there
was with this unnecessary separation.
Many bugs have been removed. I do not maintain a list, so I
recommend that you compare the source code. Most (if not all) memory leaks have
been removed.
Code size has in some cases been halved, but does the same job and more.
Needless logging has been removed or commented out.
Using a ostrstream for output was not too portable as I have had
severe problems with this on IRIX where crashes occured seemingly
random. This has been changed to ostream which means that
people who prefer using a strstream may use it as any ostream. I also
had a problem on many platforms if the programs crashed I got
NO output at all where I do get output using
e.g. cout/stdout.
Reduced the number of arguments to cgiMain() to two,
from four. [Only Cgipp v0.2+]
htmlTool [Was: HTMLDocument] has become a subclass of ostream
which makes it much
easier to use and much more adaptable. It does accept all that the old
HTMLDocument did, but has grown in possibilities (code size is half
though). The file now also fits better into Dos' 8.3 filenames.
[Outdated :Removed much of the unecessary cleaning when bailing out. A
speedy cgi-program should not use years to clean up something the OS
(at least on unix) will do.] Much safer ways to clean up memory before leaving,
and a better bound-checker has been included for better portabilitiy to PCs
when run in DEBUG mode.
Easier installing on systems. Uses configure on unix-systems and includes
IDE-file for various installs on PC.
Exceptionhandling and exceptionthrowing removed due to numerous
internal compiler errors on different platforms. The programs I
develop on my linux should work on solaris and the ones I develop on
Solaris should be usable on IRIX too w/o internal compiler errors. The
day we get good c++ compilers on unix I'll include exception handling.
[Note: the DOS-version may get exception-handling soon quite simply
because it works on Borland's compiler]
Added Toolbox class for the things I far too often use in all my
programs..
Updated the whole library to compile and be used flawlessly on
pcs, sun4, irix, osf, solaris, etc.. This takes time and effort and
thorough testing which has been done now. [More testing on v0.2 should
be done. Runs flawlessly on linux and DOS at least]
The CgiEnv class now has support for more types of
environment variables than it had, including cookies.
Cgicc's promise of never returning variables as NULL
was not kept, but is almost kept except for the PostData variable.
Most (if not all) freebie methods have been put in the classes where
they belong. (Usually in a protected mode)