Ignore:
Timestamp:
1999-02-22T11:33:58+13:00 (25 years ago)
Author:
rjmcnab
Message:

Lots of stuff :-)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/action.cpp

    r158 r165  
    1212/*
    1313   $Log$
     14   Revision 1.6  1999/02/21 22:33:52  rjmcnab
     15
     16   Lots of stuff :-)
     17
    1418   Revision 1.5  1999/02/11 01:24:04  rjmcnab
    1519
     
    5660}
    5761
     62// configure should be called once for each configuration line
     63// the default version configures the default for any arguments
     64// which this action uses
     65void action::configure (const text_t &key, const text_tarray &cfgline) {
     66  cgiarginfo *info = NULL;
     67  if ((key == "argdefault") && (cfgline.size() == 2) &&
     68      ((info = argsinfo.getarginfo(cfgline[0])) != NULL)) {
     69    if (info->defaultstatus <= cgiarginfo::config) {
     70      info->defaultstatus = cgiarginfo::config;
     71      info->argdefault = cfgline[1];
     72    }
     73  }
     74}
     75
     76// init should be called after all the configuration is done but
     77// before any other methods are called
     78bool action::init (ostream &/*logout*/) {
     79  return true;
     80}
     81
    5882// returns the "a" argument value that will specify this action
    5983// this name should be short but does not have to be one character
     
    92116// from outputing anything.
    93117bool action::do_action (cgiargsclass &/*args*/, outconvertclass &/*outconvert*/,
    94             ostream &/*textout*/, ostream &/*logout*/) {
     118            recptproto */*collectproto*/, ostream &/*textout*/,
     119            ostream &/*logout*/) {
    95120  return true;
    96 }
    97 
    98 // configure should be called once for each configuration line
    99 // the default version configures the default for any arguments
    100 // which this action uses
    101 void action::configure (const text_t &key, const text_tarray &cfgline) {
    102   cgiarginfo *info = NULL;
    103   if ((key == "argdefault") && (cfgline.size() == 2) &&
    104       ((info = argsinfo.getarginfo(cfgline[0])) != NULL)) {
    105     if (info->defaultstatus <= cgiarginfo::config) {
    106       info->defaultstatus = cgiarginfo::config;
    107       info->argdefault = cfgline[1];
    108     }
    109   }
    110121}
    111122
    112123
    113124
    114 actionmapclass::actionmapclass () {
    115 }
    116 
    117 // theaction becomes the property of this class after addaction
    118 // therefore theaction should always be created using new but
    119 // not deleted after the call to addaction.
     125// theaction remains the property of the calling code but
     126// should not be deleted until it is removed from this list.
    120127void actionmapclass::addaction (action *theaction) {
    121128  // can't add a null action
     
    130137  aptr.a = theaction;
    131138  actionptrs[theaction->get_action_name()] = aptr;
    132   aptr.a = NULL; // control has passed on
    133139}
    134140
    135141// getaction will return NULL if the action could not be found
    136142action *actionmapclass::getaction (const text_t &key) {
     143  // can't find an action with no name
     144  assert (!key.empty());
     145  if (key.empty()) return NULL;
     146
    137147  iterator here = actionptrs.find (key);
    138148  if (here == actionptrs.end()) return NULL;
Note: See TracChangeset for help on using the changeset viewer.