Annotation of libwww/Library/src/HTDir.html, revision 2.6

2.1       frystyk     1: <HTML>
                      2: <HEAD>
2.4       frystyk     3: <TITLE>W3C Sample Code Library libwww DIRECTORY BROWSING</TITLE>
2.3       frystyk     4: <!-- Changed by: Henrik Frystyk Nielsen, 23-Mar-1996 -->
2.1       frystyk     5: </HEAD>
                      6: <BODY>
                      7: 
                      8: <H1>Directory Browsing</H1>
                      9: 
                     10: <PRE>
                     11: /*
                     12: **     (c) COPYRIGHT MIT 1995.
                     13: **     Please first read the full copyright statement in the file COPYRIGH.
                     14: */
                     15: </PRE>
                     16: 
                     17: The directory manager generates directory listings for FTP and HTTP
                     18: requests. This module contains the protocol independent code and it
                     19: produces the HTML object. It is only included if either the <A
                     20: HREF="HTFTP.html">FTP</A> or the <A HREF="HTFile.html">File</A> module
                     21: is included. <P>
                     22: 
                     23: This module is implemented by <A HREF="HTDir.c">HTDir.c</A>, and it is
2.5       frystyk    24: a part of the <A HREF="http://www.w3.org/Library/"> W3C
2.4       frystyk    25: Sample Code Library</A>.
2.1       frystyk    26: 
                     27: <PRE>
                     28: #ifndef HTDIR_H
                     29: #define HTDIR_H
                     30: #include "HTReq.h"
                     31: #include "HTIcons.h"
2.6     ! vbancrof   32: 
        !            33: #ifdef __cplusplus
        !            34: extern "C" { 
        !            35: #endif 
2.1       frystyk    36: </PRE>
                     37: 
                     38: <H2>What Should the Listings Look Like?</H2>
                     39: 
                     40: If the <CODE>HT_DS_DES</CODE> is set then the <EM>Description</EM>
                     41: field is added as the last column in the listing.  File descriptions
                     42: are queried from the <A HREF="HTDescpt.html">HTDescript
                     43: module</A>. Make a full mask by adding/oring the following flags:
                     44: 
                     45: <PRE>
                     46: typedef enum _HTDirShow {
                     47:     HT_DS_SIZE  = 0x1,                 /* Show file size using K, M and G? */
                     48:     HT_DS_DATE  = 0x2,                 /* Show last modified date? */
                     49:     HT_DS_HID   = 0x4,                 /* Show hidden files? */
                     50:     HT_DS_DES  = 0x8,                  /* Show descriptions? */
                     51:     HT_DS_ICON  = 0x10,                        /* Show icons? */
                     52:     HT_DS_HOTI  = 0x20                 /* Are Icons hot or cold? */
                     53: } HTDirShow;
                     54: 
                     55: typedef enum _HTDirKey {
                     56:     HT_DK_NONE = 0,                    /* No sorting */
                     57:     HT_DK_CSEN = 1,                    /* Case sensitive */
                     58:     HT_DK_CINS  = 2                    /* Case insensitive */
                     59: } HTDirKey;
                     60: </PRE>
                     61: 
                     62: <H3>Length of Filenames and Descriptions</H3>
                     63: 
                     64: The module automatically ajusts the width of the directory listing as
                     65: a function of the file name. The width can flows dynamically between
                     66: an upper and a lower limit.  The maximum length of
                     67: this field is specified by
                     68: 
                     69: <PRE>
                     70: extern BOOL HTDir_setWidth (int minfile, int maxfile);
                     71: </PRE>
                     72: 
                     73: <H2>The Directory Object</H2>
                     74: 
                     75: The directory object handles the generation of a directory listing. It
                     76: is a bit like a stream in that it accept data, but it must be
                     77: formatted in a special way which makes the normal stream architecture
                     78: inadequate.
                     79: 
                     80: <H3>Width of File Names</H3>
                     81: 
                     82: The module automatically ajusts the width of the directory listing as
                     83: a function of the file name. The width can flows dynamically between
                     84: an upper and a lower limit.
                     85: 
                     86: <PRE>
                     87: extern BOOL HTDir_setWidth (int minfile, int maxfile);
                     88: </PRE>
                     89: 
                     90: <H3>Create a Directory Object</H3>
                     91: 
                     92: Creates a structured stream object and sets up the initial HTML stuff
                     93: Returns the dir object if OK, else NULL
                     94: 
                     95: <PRE>
                     96: typedef struct _HTDir HTDir;
                     97: 
                     98: extern HTDir * HTDir_new (HTRequest * request, HTDirShow show, HTDirKey key);
                     99: </PRE>
                    100: 
                    101: <H3>Add a Line to the List</H3>
                    102: 
                    103: This function accepts a directory line. "data" and "size", and
                    104: "description" can all be NULL. Returns YES if OK, else NO
                    105: 
                    106: <PRE>
                    107: extern BOOL HTDir_addElement   (HTDir *dir, char *name, char *date,
                    108:                                 char *size, HTFileMode mode);
                    109: </PRE>
                    110: 
                    111: <H3>Free a Directory Obejct</H3>
                    112: 
                    113: If we are sorting then do the sorting and put out the list,
                    114: else just append the end of the list.
                    115: 
                    116: <PRE>
                    117: extern BOOL HTDir_free (HTDir * dir);
                    118: </PRE>
                    119: 
                    120: <PRE>
2.6     ! vbancrof  121: #ifdef __cplusplus
        !           122: }
        !           123: #endif
        !           124: 
2.1       frystyk   125: #endif /* HTDIR */
                    126: </PRE>
2.3       frystyk   127: 
                    128: <HR>
                    129: <ADDRESS>
2.6     ! vbancrof  130: @(#) $Id: HTDir.html,v 2.5 1998/05/14 02:10:23 frystyk Exp $
2.3       frystyk   131: </ADDRESS>
2.1       frystyk   132: </BODY>
                    133: </HTML>

Webmaster