home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 10 / amigaformatcd10.iso / -in_the_mag- / html_tutorial / o_parse.h < prev    next >
C/C++ Source or Header  |  1996-09-03  |  1KB  |  46 lines

  1.  
  2. //
  3. // Split the components of a CGI result string into
  4. //  individual sub strings
  5. //
  6. // For example the string
  7. //   name=Your+name&action=%2B10%25&log=~mas/log
  8. //
  9. // is composed of two named elements:
  10. //
  11. //     Element    String associated with element
  12. //     name       Your name
  13. //     action     +10%
  14. //     log        /usr/staff/mas/log
  15. //
  16. // (C) M.A.Smith University of Brighton
  17. // Permission is granted to use this code
  18. //   provided this declaration and copyright notice remains intact.
  19. // 26 August 1995
  20. //
  21. //
  22. // S p e c i f i c a t i o n
  23.  
  24. #ifndef CLASS_PARSE
  25. #define CLASS_PARSE
  26.  
  27. class Parse
  28. {
  29. public:
  30.   Parse( char [] );
  31.   ~Parse();
  32.   void set( char [] );
  33.   char *get_item( char [], bool=false );
  34.   char *get_item_n( char [], bool=false );
  35. protected:
  36.   void remove_escape(char []);   // Strip escape characters
  37.   int hex( char );               // Return hex value
  38.   char *map_uname( char [] );    // process ~uname -> home path
  39. private:
  40.   enum { SEP = '&' };            // Seperator for fields
  41.   char *the_str;                 // String parsed
  42.   int  the_length;               // Length of the string
  43. };
  44.  
  45. #endif
  46.