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/receptionist.h

    r159 r165  
    1919#include "display.h"
    2020#include "action.h"
     21#include "recptproto.h"
     22#include "converter.h"
    2123
    2224#ifndef MACROPRECEDENCE
     
    2527
    2628
     29struct recptconf {
     30  text_t gsdlhome;
     31  text_t collection; // will equal "" in 'general' mode
     32  text_t collectdir; // will equal gsdlhome in 'general' mode
     33  text_t httpimg;
     34  text_t gwcgi;
     35  text_tarray macrofiles;
     36  text_t saveconf;
     37};
     38
     39
    2740class receptionist {
     41protected:
     42  recptconf configinfo;
     43
     44  cgiargsinfoclass argsinfo;
     45  actionmapclass actions;
     46  recptprotolistclass protocols;
     47  displayclass disp;
     48  convertinfoclass converters;
     49
    2850public:
    2951  receptionist () {}
    3052  virtual ~receptionist() {}
    3153
    32   // this version of set_gsdlhome should be used if the receptionist
    33   // is being run for multiple collections ("general" mode).
    34   void set_gsdlhome (const text_t &thegsdlhome);
    35   text_t get_gsdlhome () {return gsdlhome;}
     54  // add_action makes another action available to the receptionist
     55  // the action remains the property of the calling code and that
     56  // code should destroy the action after the recptionist has been
     57  // destroyed.
     58  void add_action (action *theaction) {actions.addaction(theaction);}
     59  actionmapclass *get_actionmap_ptr () {return &actions;}
    3660
    37   // this version of set_gsdlhome should be used if the receptionist
    38   // is being run for a single collection ("collection specific" mode).
    39   void set_gsdlhome (const text_t &thegsdlhome, const text_t &thecollection);
    40   text_t get_collection () {return collection;}
     61  // add_protocol makes another protocol available to the receptionist
     62  // without any protocols, no collections will be available. The
     63  // protocols remain the property of the calling code.
     64  void add_protocol (recptproto *theprotocol) {protocols.addrecptproto(theprotocol);}
     65  recptprotolistclass *get_recptprotolist_ptr () {return &protocols;}
     66 
     67  // add_converter makes another converter available to the receptionist.
     68  // Converters are needed to display pages using different encodings.
     69  // The converters remain the property of the calling code.
     70  void add_converter (const text_t &name, inconvertclass *inconverter,
     71              rzwsoutconvertclass *outconverter)
     72    {converters.add_converter(name, inconverter, outconverter);}
     73  convertinfoclass *get_convertinfo_ptr () {return &converters;}
    4174
    42   // sets the http address of the images directory. This is used to
    43   // speed up the access to the images which are a part of the general
    44   // interface. If this is not set the interface will have to get the
    45   // images via gwcgi which will be a lot slower (especially if the
    46   // browser does not cache the images).
    47   void set_httpimg (const text_t &thehttpimg) {httpimg=thehttpimg;}
    48   text_t get_httpimg () {return httpimg;}
    4975
    50   // sets the http address of the gateway cgi program (ie. the program
    51   // that contains this receptionist).
    52   void set_gwcgi (const text_t &thegwcgi) {gwcgi=thegwcgi;}
    53   text_t get_gwcgi () {return gwcgi;}
     76  // configure should be called for each line in the
     77  // configuration files to configure the receptionist and everything
     78  // it contains. The configuration should take place after everything
     79  // has been added but before the initialisation.
     80  void configure (const text_t &key, const text_tarray &cfgline);
     81  void configure (const text_t &key, const text_t &value);
     82  const recptconf &get_configinfo () {return configinfo;}
     83  cgiargsinfoclass *get_cgiargsinfo_ptr () {return &argsinfo;}
     84 
    5485
    55   // set_macrofiles defines the macro files which will be read when
    56   // the init function is called.
    57   void set_macrofiles (const text_tarray &themacrofiles) {macrofiles=themacrofiles;}
    58   text_tarray get_macrofiles () {return macrofiles;}
    59 
    60   // set_saveconf defines what should be included in the compressed
    61   // arguments. This string should consist of cgi argument names
    62   // seperated by "-".
    63   void set_saveconf (const text_t &thesaveconf) {saveconf=thesaveconf;}
    64   text_t get_saveconf () {return saveconf;}
    65 
    66   // add_action makes another action available to the receptionist
    67   // the action becomes the property of the receptionist
    68   void add_action (action *theaction) {actions.addaction(theaction);}
    69 
    70   // configure_actions should be called for each line in the
    71   // configuration files to configure the actions. The configuration
    72   // should take place after all the actions have been added.
    73   void configure_actions (const text_t &key, const text_tarray &cfgline);
    74 
    75   // init should be called after setgsdhome has been called.
     86  // init should be called after all the actions, protocols, and
     87  // converters have been added to the receptionist and after everything
     88  // has been configured but before any pages are created.
    7689  // It returns true on success and false on failure. If false is
    7790  // returned getpage should not be called (without producing
     
    114127  text_t get_compressed_arg (const cgiargsclass &args);
    115128
    116   // returns a pointer to the action list
    117   actionmapclass *get_actionmap_ptr () {return &actions;}
    118 
    119129protected:
    120   text_t gsdlhome;
    121   text_t collectdir; // will equal gsdlhome in 'general' mode
    122   text_t collection; // will equal "" in 'general' mode
    123   text_t httpimg;
    124   text_t gwcgi;
    125 
    126   displayclass disp;
    127   text_tarray macrofiles;
    128 
    129   text_t saveconf;
    130   cgiargsinfoclass argsinfo;
    131   actionmapclass actions;
    132 
    133130  // will read in all the macro files. If one is not found an
    134131  // error message will be written to logout and the method will
Note: See TracChangeset for help on using the changeset viewer.