-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
161 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* List.cpp | ||
* | ||
* Created on: Apr 25, 2013 | ||
* Author: jimtahu | ||
*/ | ||
|
||
#include "ListVariable.h" | ||
|
||
ListVarable::ListVarable(string name):Variable(name) { | ||
this->head=NULL; | ||
} | ||
|
||
void ListVarable::add(string value){ | ||
ListItem *item = new ListItem(); | ||
item->value=value; | ||
item->next=this->head; | ||
this->head=item; | ||
} | ||
|
||
ListVarable::~ListVarable() { | ||
ListItem *item = this->head; | ||
while(this->head != NULL){ | ||
this->head=item->next; | ||
delete item; | ||
item=this->head; | ||
}//end while list items | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* List.h | ||
* | ||
* Created on: Apr 25, 2013 | ||
* Author: jimtahu | ||
*/ | ||
|
||
#ifndef LIST_H_ | ||
#define LIST_H_ | ||
|
||
#include "Variable.h" | ||
|
||
class ListItem { | ||
public: | ||
string value; | ||
ListItem *next; | ||
public: | ||
}; | ||
|
||
class ListVarable: public Variable { | ||
ListItem *head; | ||
public: | ||
ListVarable(string name); | ||
void add(string value); | ||
virtual ~ListVarable(); | ||
}; | ||
|
||
#endif /* LIST_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* ScalarVariable.cpp | ||
* | ||
* Created on: Apr 26, 2013 | ||
* Author: jimtahu | ||
*/ | ||
|
||
#include "ScalarVariable.h" | ||
|
||
ScalarVariable::ScalarVariable(string name):Variable(name){ | ||
this->Value=""; | ||
} | ||
|
||
ScalarVariable::ScalarVariable(ScalarVariable &other):Variable(other){ | ||
this->Value=other.GetValue(); | ||
} | ||
|
||
string ScalarVariable::GetValue(void){ | ||
return this->Value; | ||
} | ||
|
||
void ScalarVariable::SetValue(string value){ | ||
this->Value=value; | ||
} | ||
|
||
ScalarVariable::~ScalarVariable() { | ||
// TODO Auto-generated destructor stub | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* ScalarVariable.h | ||
* | ||
* Created on: Apr 26, 2013 | ||
* Author: jimtahu | ||
*/ | ||
|
||
#ifndef SCALARVARIABLE_H_ | ||
#define SCALARVARIABLE_H_ | ||
|
||
#include "Variable.h" | ||
|
||
class ScalarVariable: public Variable { | ||
string Value; | ||
public: | ||
ScalarVariable(string name); | ||
ScalarVariable(ScalarVariable &other); | ||
string GetValue(); | ||
void SetValue(string value); | ||
virtual ~ScalarVariable(); | ||
}; | ||
|
||
#endif /* SCALARVARIABLE_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Variable.cpp | ||
* | ||
* Created on: Apr 25, 2013 | ||
* Author: jimtahu | ||
*/ | ||
|
||
#include "Variable.h" | ||
|
||
Variable::Variable(string name){ | ||
this->Name=name; | ||
} | ||
|
||
Variable::Variable(Variable &other){ | ||
this->Name=other.GetName(); | ||
} | ||
|
||
string Variable::GetName(void){ | ||
return this->Name; | ||
} | ||
|
||
Variable::~Variable(){ | ||
// TODO Auto-generated destructor stub | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Variable.h | ||
* | ||
* Created on: Apr 25, 2013 | ||
* Author: jimtahu | ||
*/ | ||
|
||
#ifndef VARIABLE_H_ | ||
#define VARIABLE_H_ | ||
|
||
#include <string> | ||
|
||
using namespace std; | ||
|
||
class Variable { | ||
private: | ||
string Name; | ||
public: | ||
Variable(string name); | ||
Variable(Variable &other); | ||
virtual string GetName(); | ||
virtual ~Variable(); | ||
}; | ||
|
||
#endif /* VARIABLE_H_ */ |