File: HtFile.h

package info (click to toggle)
htdig 1%3A3.2.0b6-8
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 14,984 kB
  • ctags: 9,369
  • sloc: ansic: 49,626; cpp: 46,470; sh: 23,063; xml: 4,180; perl: 2,543; makefile: 875; php: 79; asm: 14
file content (130 lines) | stat: -rw-r--r-- 2,785 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
//
// HtFile.h
//
// HtFile: Class for local files (derived from Transport)
//
// Alexis Mikhailov, from HtHTTP.h by Gabriele Bartolini - Prato - Italia
// started: 03.05.1999
//
// ////////////////////////////////////////////////////////////
//
// The HtFile class should provide  an interface for retrieving local
// documents. It derives from Transport class.
//
///////
//
// Part of the ht://Dig package   <http://www.htdig.org/>
// Copyright (c) 1995-2004 The ht://Dig Group
// For copyright details, see the file COPYING in your distribution
// or the GNU Library General Public License (LGPL) version 2 or later
// <http://www.gnu.org/copyleft/lgpl.html>
//
// $Id: HtFile.h,v 1.6 2004/05/28 13:15:23 lha Exp $ 
//

#ifndef _HTFILE_H
#define _HTFILE_H

#include "Transport.h"
#include "URL.h"
#include "htString.h"


// In advance declarations

class HtFile;

class HtFile_Response : public Transport_Response
{

   friend class HtFile;    // declaring friendship
   
   public:
///////
   //    Construction / Destruction
///////
	 
      HtFile_Response();
      ~HtFile_Response();
};

class HtFile : public Transport
{
public:

///////
   //    Construction/Destruction
///////

    HtFile();
    ~HtFile();

   // Information about the method to be used in the request

   // manages a Transport request (method inherited from Transport class)
   virtual DocStatus Request ();

   // Determine Mime type of file from its extension
   static const String *Ext2Mime (const char *);

   // Determine Mime type of file from its contents
   static String File2Mime (const char *);

 ///////
    //    Interface for resource retrieving
 ///////
   
 ///////
    //    Interface for resource retrieving
 ///////

   // Set and get the document to be retrieved
   void SetRequestURL(URL &u) { _url = u;}
   URL GetRequestURL () { return _url;}


   // Set and get the referring URL
   void SetRefererURL (URL u) { _referer = u;}
   URL GetRefererURL () { return _referer;}


 ///////
    //    Interface for the HTTP Response
 ///////

   // We have a valid response only if the status code is not equal to
   // initialization value
   
   Transport_Response *GetResponse()
   {
      if (_response._status_code != -1)
         return &_response;
      else return NULL;}


   // Get the document status 
   virtual DocStatus GetDocumentStatus();
   
protected:

///////
   //    Member attributes
///////

   ///////
      //    Http single Request information (Member attributes)
   ///////

   URL		_url;               // URL to retrieve
   URL		_referer;	    // Referring URL
   
   ///////
      //    Http Response information
   ///////

   HtFile_Response	 _response; 	 // Object where response
   	       	   	       	   	 // information will be stored into
};

#endif