| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#ifndef RCMAIN_H |
| 21 |
#define RCMAIN_H |
| 22 |
|
| 23 |
#include "os.h" |
| 24 |
#include "t3std.h" |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
class CResCompMain |
| 30 |
{ |
| 31 |
public: |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
static int add_resources(const char *image_fname, |
| 38 |
const class CRcResList *reslist, |
| 39 |
class CRcHostIfc *hostifc, |
| 40 |
int create_new, os_filetype_t file_type, |
| 41 |
int link_mode); |
| 42 |
|
| 43 |
private: |
| 44 |
|
| 45 |
static void disp_error(class CRcHostIfc *hostifc, const char *msg, ...); |
| 46 |
}; |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
class CRcResEntry |
| 52 |
{ |
| 53 |
public: |
| 54 |
CRcResEntry(const char *fname, const char *url) |
| 55 |
{ |
| 56 |
|
| 57 |
fname_ = lib_copy_str(fname); |
| 58 |
url_ = lib_copy_str(url); |
| 59 |
|
| 60 |
|
| 61 |
next_ = 0; |
| 62 |
} |
| 63 |
|
| 64 |
~CRcResEntry() |
| 65 |
{ |
| 66 |
|
| 67 |
lib_free_str(fname_); |
| 68 |
lib_free_str(url_); |
| 69 |
} |
| 70 |
|
| 71 |
|
| 72 |
CRcResEntry *get_next() const { return next_; } |
| 73 |
void set_next(CRcResEntry *nxt) { next_ = nxt; } |
| 74 |
|
| 75 |
|
| 76 |
const char *get_fname() const { return fname_; } |
| 77 |
|
| 78 |
|
| 79 |
const char *get_url() const { return url_; } |
| 80 |
|
| 81 |
private: |
| 82 |
|
| 83 |
CRcResEntry *next_; |
| 84 |
|
| 85 |
|
| 86 |
char *fname_; |
| 87 |
|
| 88 |
|
| 89 |
char *url_; |
| 90 |
}; |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
enum rcmain_res_op_mode_t |
| 96 |
{ |
| 97 |
|
| 98 |
RCMAIN_RES_OP_MODE_ADD, |
| 99 |
|
| 100 |
|
| 101 |
RCMAIN_RES_OP_MODE_REPLACE, |
| 102 |
|
| 103 |
|
| 104 |
RCMAIN_RES_OP_MODE_DELETE |
| 105 |
}; |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
class CRcResList |
| 111 |
{ |
| 112 |
public: |
| 113 |
CRcResList() |
| 114 |
{ |
| 115 |
|
| 116 |
head_ = tail_ = 0; |
| 117 |
count_ = 0; |
| 118 |
} |
| 119 |
|
| 120 |
~CRcResList() |
| 121 |
{ |
| 122 |
|
| 123 |
while (head_ != 0) |
| 124 |
{ |
| 125 |
CRcResEntry *nxt; |
| 126 |
|
| 127 |
|
| 128 |
nxt = head_->get_next(); |
| 129 |
|
| 130 |
|
| 131 |
delete head_; |
| 132 |
|
| 133 |
|
| 134 |
head_ = nxt; |
| 135 |
} |
| 136 |
} |
| 137 |
|
| 138 |
|
| 139 |
class CRcResEntry *get_head() const { return head_; } |
| 140 |
|
| 141 |
|
| 142 |
unsigned int get_count() const { return count_; } |
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
void add_file(const char *fname, const char *alias, int recurse); |
| 158 |
|
| 159 |
private: |
| 160 |
|
| 161 |
void add_element(class CRcResEntry *entry) |
| 162 |
{ |
| 163 |
|
| 164 |
if (tail_ == 0) |
| 165 |
head_ = entry; |
| 166 |
else |
| 167 |
tail_->set_next(entry); |
| 168 |
tail_ = entry; |
| 169 |
|
| 170 |
|
| 171 |
++count_; |
| 172 |
} |
| 173 |
|
| 174 |
|
| 175 |
class CRcResEntry *head_; |
| 176 |
|
| 177 |
|
| 178 |
class CRcResEntry *tail_; |
| 179 |
|
| 180 |
|
| 181 |
unsigned int count_; |
| 182 |
}; |
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
class CRcHostIfc |
| 189 |
{ |
| 190 |
public: |
| 191 |
|
| 192 |
virtual void display_error(const char *msg) = 0; |
| 193 |
|
| 194 |
|
| 195 |
virtual void display_status(const char *msg) = 0; |
| 196 |
}; |
| 197 |
|
| 198 |
#endif |
| 199 |
|