annotate scn2k/scn2k_flags.h @ 62:3b1593186f12

fix pointers used to get strchr result
author Thibaut GIRKA <thib@sitedethib.com>
date Sat, 06 Feb 2010 17:03:47 +0100
parents c7bcc0ec2267
children 4b9ffe15a87d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
1 #ifndef __SCN2K_FLAGS_H__
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
2 #define __SCN2K_FLAGS_H__
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
3
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
4 #include <set>
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
5 #include <string>
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
6
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
7 struct VarInfo {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
8 #define TYPE_NONSYSVARMAX 5
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
9 #define TYPE_VARMAX 9
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
10 #define TYPE_VARLOCSTR 10
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
11 #define TYPE_VARSYSSTR 12
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
12 #define TYPE_VARSTR 18
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
13 #define TYPE_STR 58
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
14 #define TYPE_VAL 68
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
15 #define TYPE_SYS 0xc8
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
16 #define TYPE_END 0x7f
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
17
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
18 #define TYPE_SYS_SYS 0
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
19 #define TYPE_SYS_SKIPMODE 1
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
20 int type;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
21 int number;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
22 int value;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
23 VarInfo() { type = TYPE_VAL; value = 0;}
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
24 VarInfo(int n) { type = TYPE_VAL; value = n;}
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
25 VarInfo(const VarInfo& i) { type = i.type; number = i.number; value = i.value;}
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
26 };
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
27
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
28 class Flags {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
29 /* flag:
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
30 ** type 0-5 : ¥í¡Œ¥«¥ëÀ°¿ô¡¢³Æ2000žÄ
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
31 ** type 6, 25 : ¥°¥í¡Œ¥Ð¥ëÀ°¿ô¡¢2000žÄ
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
32 ** type 10,11: ¥í¡Œ¥«¥ëÀ°¿ô??¡¢³Æ2000žÄ
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
33 ** type 12 : ¥°¥í¡Œ¥Ð¥ëÊž»úÎó¡¢2000žÄ (º£€Ï̵»ë€·€Æ€âÎÉ€€€¬)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
34 ** type 18 : ¥í¡Œ¥«¥ëÊž»úÎó¡¢2000žÄ
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
35 ** type 25: ¥·¥¹¥Æ¥àÊÑ¿ô¡Ê¥Þ¥Š¥¹ºÂÉž€Ê€É¡©¡Ë 1000 žÄ¡©
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
36 ** type 26-32, 51 : 1-bit access to 0-6, 25
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
37 ** type 52-58, 77 : 2-bit access to 0-6, 25
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
38 ** type 78-84, 103 : 4-bit access to 0-6, 25
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
39 ** type 104-110, 129 : 8-bit access to 0-6, 25
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
40 */
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
41 private:
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
42 typedef unsigned int uint;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
43 int sys;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
44 int var[TYPE_VARMAX+1][2000];
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
45 std::string str[2000];
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
46 std::string sys_str[2000];
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
47 std::string loc_str[3];
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
48 public:
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
49 Flags(void);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
50 int operator () () const;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
51 int operator () (VarInfo info) const;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
52 void Str(int type, unsigned int number, char* buf, int sz) const;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
53 std::string Str(int type, unsigned int number) const;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
54 std::set<int> cgm_data;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
55
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
56 bool IsInt(int type) const;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
57 int MaxIndex(int type) const;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
58
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
59 void Set(VarInfo info, int value);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
60 int Get(int type, int number) const;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
61 void SetSys(int value);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
62 void SetStr(VarInfo info, std::string val);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
63
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
64 bool Exec(class Cmd& cmd);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
65
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
66 void Save(std::string& str);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
67 void Load(const char* str);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
68
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
69 void SaveSys(std::string& str);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
70 void LoadSys(const char* str);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
71 };
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
72
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
73 #endif