Links

Home
Open Source
Web Library
Data Library
The News Blogs
About W3 Systems
References
Health Sharing
Sleep
Wall Builders
Selective Immune suppression
Talking it over

Asides...

Hi

Object Oriented Web Services

This is my library that handles all the core web services.  Download and compile it to create fast and extremely stable dynamic web sites.  The library has been in development since 1996, so it has been tested under fire on many sites.
If you have any questions or would like help developing your site, please email me.

The archive is here.

The documentation is here.

 

Quick Tutorial Example

In the main() function:

(script, html, head and body are all output streams sharing the cout buffer.)

/*
  example1.cpp  
    
*/
#include "cgiClass.h"

using namespace std;


int main( int argc, char ** argv )
{

  // script
  cgiScript script;   

  // create an html instance at main() scope 
  cgiHtml html;
  {
    // create the head tag
    cgiHead head;
    {
      cgiCan title("title");
      title << "Example 1";
    }
    {
      cgiCan style("style");
      style << "body{ color: navy; background: white;}"
            << endl;
    }
  }  
  {
    // create the body tag
    cgiBody body;
    body << "<h1>Open Core Web Services</h1>"
         << "This is an example of open core web services.";    
  }
  return 0; 
}
You could also do the whole thing as thus:
/*
  example1.cpp  
    
*/
#include "cgiClass.h"

using namespace std;


int main( int argc, char ** argv )
{

  // script
  cgiScript script;   

  // create an html instance at main() scope 
  script << "<html>" << endl;
  script << "<head>" << endl;
  script << "<title>Example1</title>" << endl;
  script << "<style>body{ color: navy; background: white;}</style>" << endl;
  script << "</head>" << endl;
  script << "<body>" << endl;
  script << "<h1>Open Core Web Services</h1>"
         << "This is an example of open core web services.";
  script << "</body>" << endl;
  script << "</html>" << endl;
  
  return 0; 
}
But I wanted to create a paradigm that attempted to model html.
The paradigm works through scoping.
I think it's a little more elegant, and I hope elegance still matters!

There is also a presentation template class that allows you to seperate function from presentation.
I'll put an example of that up too.

Until then; here are my comments on the template class at the head of cgiTemplates.h:
   The cgiTemplates class
----------------------
The rationale behind this class
is the separation of content
and style from function.

Content and Style stay in a standard html (or XML)
page. After a page is written using a WYSIWYG
editor (or whatever) it is marked up with SGML
comments to mark the begining and ending of paragraphs.

Comment Format:
========================================

paragraph beginning: <!--@label-->

paragraph ending: <!--/@label-->

========================================
The label can be any alpha-numeric
sequence of characters

Function comes from the cgi program.
The cgi program calls this class to load and parse
the html/xml into paragraphs.

The program can then intersperse dynamically
generated content with the static paragraphs.

User defined argument markers can be placed in the
paragraphs so as to be replaced by program variables.
Replacement is most easily accomplished by using the
ocString methods replace and replaceAll. For type conversion
to string there is a function template called ocAppend( string, var ).
ocAppend and ocString are included in the "ocString.h" file

Having worked in some of the scripted environments, I believe this
method is superior in terms of performance, flexibility and reliability.

All code is compiled, the parsing is fast, and is done against
a well defined set of tokens.

The user can completely change the visual interface
without effecting the function (so long as the SGML comments and
argument markers are preserved.)

All code checks are done at compile time rather
that run time - this means the user is less likely to be exposed
to some un-anticipated error.

Copyright 2002 - Open Core Class Library
Author: David McCombs


KEY EVENTS OF the list_base list control...

(They are highlited)

  list_base & emitData( void )
  {
    bool more_data = opened;
    string tr = listTemplate.getParagraph("tr");
    td = listTemplate.getParagraph("td");
    string end_tr = listTemplate.getParagraph("end_tr");
    int fieldCount;
    if( opened ) fieldCount = rs.getFieldCount();
    derived_commence_event();
    while( more_data )
    {
      derived_predata_event();
      webIO << tr;
      for( int i=0; i < fieldCount; ++i )
      {
        if( i == hotCol || hotCol == -2 )
        {
          sendHotField(i, td );  
        }
        else if( i != skipCol )
        {
          sendField(i, td );
        }  
      }       
      webIO << end_tr;
      derived_data_event();
      more_data = rs.next();  
    }
    dsetCount = rs.getRecordCount();
    derived_complete_event();
    return * this;
  }
List event definitions

  // To be able to override each field
  virtual void sendField( int iField, ocString & td )
  {
    webIO << td.replace( "$data$", rs.getField(iField).format().c_str() );
  }
 
  // to be able to override the hot column (the one with the link.)
  virtual void sendHotField( int iField, ocString & td )
  {
    webIO <<  td.replace( "$data$",
                    editLink.replaceAll( "$key$",rs.getField(0).format().c_str())
                            .replaceAll( "$col$",rs.getField(iField).format().c_str()).c_str());
  }
    
  // events
  virtual void derived_commence_event( void ){;}
  virtual void derived_predata_event( void ){;}
  virtual void derived_data_event( void ){;}
  virtual void derived_complete_event( void ){;}
Copyright (C) 2009 - W3 Systems Design