1 |
#include <stdlib.h> |
2 |
#include <string.h> |
3 |
|
4 |
#include "io/LinkedAssign.hpp" |
5 |
|
6 |
LinkedAssign::LinkedAssign( char* the_text, int the_ival ){ |
7 |
|
8 |
next = NULL; |
9 |
strcpy( text, the_text ); |
10 |
ival = the_ival; |
11 |
type = 0; |
12 |
} |
13 |
|
14 |
LinkedAssign::LinkedAssign( char* the_text, double the_dval ){ |
15 |
|
16 |
next = NULL; |
17 |
strcpy( text, the_text ); |
18 |
dval = the_dval; |
19 |
type = 1; |
20 |
} |
21 |
|
22 |
LinkedAssign::LinkedAssign( char* the_text, char* the_sval ){ |
23 |
|
24 |
next = NULL; |
25 |
strcpy( text, the_text ); |
26 |
strcpy( sval, the_sval ); |
27 |
type = 2; |
28 |
} |
29 |
|
30 |
void LinkedAssign::setValues( char* the_text, int the_ival ){ |
31 |
|
32 |
strcpy( text, the_text ); |
33 |
ival = the_ival; |
34 |
type = 0; |
35 |
} |
36 |
|
37 |
void LinkedAssign::setValues( char* the_text, double the_dval ){ |
38 |
|
39 |
strcpy( text, the_text ); |
40 |
dval = the_dval; |
41 |
type = 1; |
42 |
} |
43 |
|
44 |
void LinkedAssign::setValues( char* the_text, char* the_sval ){ |
45 |
|
46 |
strcpy( text, the_text ); |
47 |
strcpy( sval, the_sval ); |
48 |
type = 2; |
49 |
} |
50 |
|
51 |
void LinkedAssign::add( char* the_text, int the_ival ){ |
52 |
|
53 |
if( next != NULL ) next->add( the_text, the_ival ); |
54 |
|
55 |
else next = new LinkedAssign( the_text, the_ival ); |
56 |
} |
57 |
|
58 |
void LinkedAssign::add( char* the_text, double the_dval ){ |
59 |
|
60 |
if( next != NULL ) next->add( the_text, the_dval ); |
61 |
|
62 |
else next = new LinkedAssign( the_text, the_dval ); |
63 |
} |
64 |
|
65 |
void LinkedAssign::add( char* the_text, char* the_sval ){ |
66 |
|
67 |
if( next != NULL ) next->add( the_text, the_sval ); |
68 |
|
69 |
else next = new LinkedAssign( the_text, the_sval ); |
70 |
} |
71 |
|
72 |
LinkedAssign* LinkedAssign::find( char* key ){ |
73 |
|
74 |
if( !strcmp(key, text) ) return this; |
75 |
|
76 |
if( next != NULL ) return next->find(key); |
77 |
|
78 |
return NULL; |
79 |
} |
80 |
|