1 |
bearsoft |
1.1 |
#include "ExtPropertiesElement.h"
|
2 |
|
|
#include "../LinkedList/ObjectLinkedList.h"
|
3 |
|
|
#include "../String/String.h"
|
4 |
|
|
#include "../String/StringTools.h"
|
5 |
|
|
#include "../System/System.h"
|
6 |
|
|
#include "../System/SystemDefine.h"
|
7 |
|
|
|
8 |
|
|
ExtPropertiesElement::ExtPropertiesElement(char *iKey, char *iData)
|
9 |
|
|
{
|
10 |
|
|
key=new String(iKey);
|
11 |
|
|
data=new String(iData);
|
12 |
|
|
ObjectLinkedList<ExtPropertiesElement> *tempObject=new ObjectLinkedList<ExtPropertiesElement>();
|
13 |
|
|
objectLinkedListStore=(int*)tempObject;
|
14 |
|
|
}
|
15 |
|
|
|
16 |
|
|
ExtPropertiesElement::~ExtPropertiesElement()
|
17 |
|
|
{
|
18 |
|
|
delete key;
|
19 |
|
|
delete data;
|
20 |
|
|
ObjectLinkedList<ExtPropertiesElement> *objectLinkedList=(ObjectLinkedList<ExtPropertiesElement>*)objectLinkedListStore;
|
21 |
|
|
delete objectLinkedList;
|
22 |
|
|
}
|
23 |
|
|
|
24 |
|
|
void ExtPropertiesElement::addLast(char *iKey, char *iData)
|
25 |
|
|
{
|
26 |
|
|
ObjectLinkedList<ExtPropertiesElement> *objectLinkedList=(ObjectLinkedList<ExtPropertiesElement>*)objectLinkedListStore;
|
27 |
|
|
ExtPropertiesElement *extPropertiesElement=(ExtPropertiesElement*)objectLinkedList->addLast(new ExtPropertiesElement(iKey,iData));
|
28 |
|
|
}
|
29 |
|
|
|
30 |
|
|
char *ExtPropertiesElement::getKey(int index)
|
31 |
|
|
{
|
32 |
|
|
ObjectLinkedList<ExtPropertiesElement> *objectLinkedList=(ObjectLinkedList<ExtPropertiesElement>*)objectLinkedListStore;
|
33 |
|
|
int size=objectLinkedList->size();
|
34 |
|
|
if (index>=0 && index<size)
|
35 |
|
|
{
|
36 |
|
|
ExtPropertiesElement *extPropertiesElement=objectLinkedList->getElement(index);
|
37 |
|
|
return extPropertiesElement->key->buffer;
|
38 |
|
|
}
|
39 |
|
|
return null;
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
char *ExtPropertiesElement::getData(int index)
|
43 |
|
|
{
|
44 |
|
|
ObjectLinkedList<ExtPropertiesElement> *objectLinkedList=(ObjectLinkedList<ExtPropertiesElement>*)objectLinkedListStore;
|
45 |
|
|
int size=objectLinkedList->size();
|
46 |
|
|
if (index>=0 && index<size)
|
47 |
|
|
{
|
48 |
|
|
ExtPropertiesElement *extPropertiesElement=objectLinkedList->getElement(index);
|
49 |
|
|
return extPropertiesElement->data->buffer;
|
50 |
|
|
}
|
51 |
|
|
return null;
|
52 |
|
|
}
|
53 |
|
|
|
54 |
|
|
int ExtPropertiesElement::getSize()
|
55 |
|
|
{
|
56 |
|
|
ObjectLinkedList<ExtPropertiesElement> *objectLinkedList=(ObjectLinkedList<ExtPropertiesElement>*)objectLinkedListStore;
|
57 |
|
|
return objectLinkedList->size();
|
58 |
|
|
}
|
59 |
|
|
|
60 |
|
|
char *ExtPropertiesElement::getKeyData(String &iKey)
|
61 |
|
|
{
|
62 |
|
|
ObjectLinkedList<ExtPropertiesElement> *objectLinkedList=(ObjectLinkedList<ExtPropertiesElement>*)objectLinkedListStore;
|
63 |
|
|
int size=objectLinkedList->size();
|
64 |
|
|
|
65 |
|
|
for ( int r=0; r<size ; r++ )
|
66 |
|
|
{
|
67 |
|
|
ExtPropertiesElement *extPropertiesElement=objectLinkedList->getElement(r);
|
68 |
|
|
|
69 |
|
|
String key=extPropertiesElement->key->buffer;
|
70 |
|
|
|
71 |
|
|
if (key.equals(iKey))
|
72 |
|
|
{
|
73 |
|
|
return extPropertiesElement->data->buffer;
|
74 |
|
|
}
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
return null;
|
78 |
|
|
}
|
79 |
|
|
|