-
Notifications
You must be signed in to change notification settings - Fork 1
/
FieldInfo.h
58 lines (47 loc) · 1.06 KB
/
FieldInfo.h
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
#pragma once
#include "common.h"
class FieldInfo
{
TCHAR m_fieldName[512];
TCHAR m_fieldValue[2048];
public:
FieldInfo(TCHAR *lpszFieldName, TCHAR *lpszFieldValue) {
_tcsncpy(m_fieldName, lpszFieldName, 512);
_tcsncpy(m_fieldValue, lpszFieldValue, 2048);
}
FieldInfo() {}
FieldInfo(const FieldInfo &other) {
memcpy(this, &other, sizeof(FieldInfo));
}
const TCHAR *GetFieldName() const { return &m_fieldName[0]; }
const TCHAR *GetFieldValue() const { return &m_fieldValue[0]; }
};
//typedef std::vector< FieldInfo > FieldInfoCollection;
class FieldInfoList {
public:
class ListNode {
public:
ListNode() {}
FieldInfo info;
ListNode *next;
};
FieldInfoList(): head(0) {}
~FieldInfoList() {clear();}
void clear() {
ListNode *n = head;
while(n) {
n = n->next;
delete head;
head = n;
}
}
void push_back(const FieldInfo &info) {
ListNode *n = new ListNode;
n->info = info;
n->next = head;
head = n;
}
ListNode *start() const {return head;}
protected:
ListNode *head;
};