File: thselector.h

package info (click to toggle)
therion 0.3.10-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,840 kB
  • ctags: 5,417
  • sloc: cpp: 46,983; tcl: 17,383; ansic: 9,055; perl: 1,680; makefile: 728; asm: 152; sh: 12
file content (117 lines) | stat: -rw-r--r-- 2,574 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
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
/**
 * @file thselector.h
 * Database selector class.
 */
  
/* Copyright (C) 2000 Stacho Mudrak
 * 
 * $Date: $
 * $RCSfile: $
 * $Revision: $
 *
 * -------------------------------------------------------------------- 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 * --------------------------------------------------------------------
 */
 
#ifndef thselector_h
#define thselector_h

#include <list>
#include <stdio.h>


/**
 * Selection.
 */
 
class thselector_item {

  public:

  char * name, *src_name;
  unsigned long src_ln;
  unsigned long number;
  bool unselect, recursive;  
  long map_level, chapter_level;
  class thdataobject * optr;
  
  thselector_item () : name(""), src_name(""), src_ln(0), unselect(false), recursive(true),
      map_level(0), chapter_level(0), optr(NULL) {}
  
};


typedef std::list <thselector_item> thselector_list;


/**
 * Selector class.
 */
 
class thselector {

  public:
  
  thselector();  ///< Default constructor.

  class thconfig * cfgptr;  ///< Current config pointer.
  
  thselector_list data;  ///< Selection data.
  
  void select_object(thselector_item * pitm, class thdataobject * optr);  ///< Select object.
  
  void select_all(thselector_item * pitm, class thdatabase * db);  ///< Select all objects in db.
  
  void select_survey(thselector_item * pitm, class thsurvey * srv);  ///< Select survey.

  unsigned long number;
    
  void assign_config(class thconfig * cptr);  ///< Assign configuration object.
  

  /**
   * Parse select option from config file.
   */
   
  void parse_selection (bool usid, int nargs, char ** args);
  
  
  /**
   * Dump selection into file.
   */
   
  void dump_selection (FILE * cf);


  /**
   * Dump database selection options into file.
   */
   
  void dump_selection_db (FILE * cf, class thdatabase * db);
  
  
  /**
   * Select objects in database.
   */
  
  void select_db(class thdatabase * db);
  
};


#endif