File: BasicDocument.h

package info (click to toggle)
htdig 1%3A3.2.0b6-21
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 21,292 kB
  • sloc: ansic: 49,632; cpp: 46,468; sh: 17,400; xml: 4,180; perl: 2,543; makefile: 888; php: 79; asm: 14
file content (119 lines) | stat: -rw-r--r-- 3,848 bytes parent folder | download
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
//--------------------------------------------------------------------
//
// BasicDocument.h
//
// 2/6/2002 created for libhtdig to simplify & mimic Document.cc
//
// Neal Richter nealr@rightnow.com
//
//
// BasicDocument: This class holds everything there is to know about a document.
//           The actual contents of the document may or may not be present at
//           all times for memory conservation reasons.
//
//           This is a basic extensable container for plain text holding documents.
//
//           Uses any Parser with parse method handling this class.
//           
// Part of the ht://Dig package   <https://htdig.sourceforge.net/>
// 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 or later
// <http://www.gnu.org/copyleft/lgpl.html>
//
// $Id: BasicDocument.h,v 1.4 2004/05/28 13:15:28 lha Exp $
//
//--------------------------------------------------------------------




#ifndef _BasicDocument_h_
#define _BasicDocument_h_

#include "htString.h"
#include "Parsable.h"
#include "Object.h"
#include "StringList.h"
#include "HtDateTime.h"


class TextCollector;


class BasicDocument:public Object
{
   public:
    //
    // Construction/Destruction
    //
    BasicDocument(char *location = 0, int max_size = 0);
    ~BasicDocument();

    //
    // Interface to the document.
    //
    void  Reset();
    int   Length();

    //int                StoredLength()   {return contents.length();}

    char *Title()                          {return title;}
    void  Title(char *t)                   {title = t; document_length = -1;}
    void  Title(const String & t)          {title = t; document_length = -1;}
    int   TitleLength()                    {return title.length();}

    char *MetaContent()                    {return metacontent;}
    void  MetaContent(char *m)             {metacontent = m; document_length = -1;}
    void  MetaContent(const String & m)    {metacontent = m; document_length = -1;}
    int   MetaContentLength()              {return metacontent.length();}

    char *Contents()                       {return contents;}
    void  Contents(char *s)                {contents = s; document_length = -1;}
    void  Contents(const String & s)       {contents = s; document_length = -1;}
    int   ContentsLength()                 {return contents.length();}

    char *Location()                       {return location;}
    void  Location(char *l)                {location = l; document_length = -1;}
    void  Location(const String & l)       {location = l; document_length = -1;}
    int  LocationLength()                  {return location.length();}

    char *DocumentID()                     {return id;}
    void  DocumentID(char *ida)            {id = ida; document_length = -1;}
    void  DocumentID(const String & ida)   {id = ida; document_length = -1;}
    int   DocumentIDLength()               {return id.length();}

    char *ContentType()                    {return contentType;}
    void  ContentType(char *ct)            {contentType = ct;}
    void  ContentType(const String & ct)   {contentType = ct;}
    
    time_t ModTime()                       {return modtime.GetTime_t();}
    void   ModTime(time_t t)               {modtime = t;}

    //
    // Return an appropriate parsable object for the document type.
    //
    Parsable *getParsable();

    int     internalParser(TextCollector & textcollector);
    int     SelfParseable();

   private:

    String          id;
    String          location;
    String          title;
    String          metacontent;
    String          contents;

    String          contentType;

    HtDateTime      modtime;

    int             document_length;
    
    //int max_doc_size;

};

#endif