File: npthreads.h

package info (click to toggle)
peruser 4b33-6
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,952 kB
  • ctags: 1,064
  • sloc: cpp: 22,367; perl: 2,733; makefile: 345; sh: 335
file content (75 lines) | stat: -rw-r--r-- 1,863 bytes parent folder | download | duplicates (2)
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
#include "npfile.h"
#include "npstringarray.h"

struct np_ref_node_t
{
   char *reference;
   struct np_ref_node_t *next, *prev;
};

struct np_thread_node_t
{
   char *subject;
   char *from;
   char *date;
   char *message_id;
   char *server;
   char *group;

   long offset;
   long size;

   int gap, ordinal, tree_ordinal;

   struct np_ref_node_t *references;

   int is_article, is_unseen, is_requested, is_child, child_count,
      descendents, unseen_descendents, requested_descendents,
      header_descendents;

   struct np_thread_node_t *next, *prev, *spool_next, *spool_prev, *parent,
      *child_head, *child_tail, *child_prev, *child_next;

   void *item, *label;
};

class NP_Threads
{
   char error_message[ 1024 ], *home, *server, *group;

   int total, unseen, headers, requested;

   int load( char *, char *, int, int );
   int sort();
   int thread();
   int fill_gaps();

   void recursively_fill_gaps( np_thread_node_t *, np_thread_node_t *, int );
   np_thread_node_t *make_phony_root( NP_Stringarray& );
   int make( int, int );

   int make_refs( np_ref_node_t **, char *, NP_File& );
   void make_ref_list( np_ref_node_t **, char * );
   void dup_line( char **, char *, int );

   np_thread_node_t *threads, *spool_beginning;

 public:

   NP_Threads() { threads = NULL; server = NULL; group = NULL;
                  home = getenv( "HOME" ); };
   ~NP_Threads() { clear(); };

   np_thread_node_t *get_tree( char *, char *, int, int, int );
   np_thread_node_t *get_spool_beginning();

   void recursively_count_descendents( int *, int *, int *, int *,
                                       np_thread_node_t * );
   void get_totals( int *, int *, int *, int * );

   void clear();
   void assign( np_thread_node_t * );

   void print_error() { printf( "%s\n", error_message ); };
   char *get_error() { return error_message; };
};