-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.hh
executable file
·98 lines (90 loc) · 3.24 KB
/
list.hh
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
/*--------------------------------------------------------------------------- *
* srtl implementation in c++ *
* *
* This file contains class header definitions for list pattern class and *
* supporting class. *
* *
* *
* Change History *
* -------------------------------------------------------------------------- *
* Name Date Change Description *
* Sheweta 14-Aug-13 Initial Version *
* *
*--------------------------------------------------------------------------- */
#ifndef __LIST_H_INCLUDED__
#define __LIST_H_INCLUDED__
#include <list>
#include "pattern.hh"
/*--------------------------------------------------------------------------- *
* This class stores the lists of elements. It supports methods to append and *
* display the final std::string of elements. *
*--------------------------------------------------------------------------- */
class Element
{
private:
std::string * Name;
std::string * Value;
public:
Element();
~Element();
Element(Element *E);
Element (const Element & e);
Element(std::string *V);
Element (std::string *N,std::string *V);
void setName(std::string *V);
void setValue(std::string * V);
std::string * getName() const;
std::string * getValue() const;
};
class ElemList : public Element
{
private :
std::list<Element *> eList;
public:
ElemList();
~ElemList();
ElemList(Element *e);
ElemList(const ElemList & el);
ElemList(ElemList *l,Element *e);
ElemList(ElemList *l,ElemList *e);
void append(Element *e);
void append(ElemList * l);
std::list<Element *> getList() const;
};
class ListPattern : public Pattern
{
private:
ElemList * elist;
std::string pname;
char separator;
char start;
char end;
char estart ;
char eend;
bool error;
public:
ListPattern();
~ListPattern();
ListPattern(Type t);
ListPattern(std::string name);
ListPattern(Type t,std::string name);
ListPattern(Type t,std::string name,Element *e);
ListPattern(Type t,std::string name,ElemList *e);
ListPattern(Type t,std::string name,ElemList *e, char start, char end);
std::string getPatName();
void setPatName(std::string V);
void setEStEnd(char s, char e);
void setPatType(Type t);
void setStEnd(char s, char e);
Type getPatType();
void createPattern();
void setSeparator(char s);
void append(std::string * Name);
void append(Element *e);
void append(std::string *Name,std::string *Value);
void append (ElemList *e);
void setError();
bool inError();
ElemList* getElemList () { return elist; }
};
#endif