aboutsummaryrefslogtreecommitdiff
path: root/src/lib/hd24devicenamegenerator.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/hd24devicenamegenerator.h')
-rwxr-xr-xsrc/lib/hd24devicenamegenerator.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/lib/hd24devicenamegenerator.h b/src/lib/hd24devicenamegenerator.h
new file mode 100755
index 0000000..40349ab
--- /dev/null
+++ b/src/lib/hd24devicenamegenerator.h
@@ -0,0 +1,52 @@
1#ifndef __hd24devnamegenerator_h__
2#define __hd24devnamegenerator_h__
3
4#include <config.h>
5#include <stdio.h>
6#include <string>
7#include <iostream>
8#include <vector>
9#include "convertlib.h"
10
11using namespace std;
12
13class hd24devicenamegenerator
14{
15 private:
16 char* imagespath; // path of device images
17 vector<string>* filelist;
18 __uint32 getnumberoffiles();
19 __uint32 filecount; // cache for getnumberoffiles
20 __uint32 getnumberofsysdevs();
21 __uint32 hd24filecount(const char* imagedir);
22 void initvars();
23 const char* getfilename(__uint32 filenum);
24 void clearfilelist();
25 public:
26 ~hd24devicenamegenerator();
27 hd24devicenamegenerator();
28
29 __uint32 getnumberofnames();
30 string* getdevicename(__uint32 number);
31
32 const char* imagedir();
33
34 /*
35 Setting the image dir resets the filecount to 0
36 which means the next call will actually count the image
37 files in the image dir (a rather heavy operation), and
38 caches the result in filecount.
39 imagedir(imagedir()) will force a filecount reset.
40
41 If the image dir is NULL, only system devices are returned.
42 */
43
44 const char* imagedir(const char* newdir);
45 /*
46 returns NULL on alloc error, const char*=dirname otherwise
47 */
48
49};
50
51#endif
52