-
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.
Starting work on vector type (they now are added to tree but cause se…
…gfault while cleaning).
- Loading branch information
Showing
5 changed files
with
68 additions
and
11 deletions.
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
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,31 @@ | ||
/* | ||
* ListValue.cpp | ||
* | ||
* Created on: May 9, 2013 | ||
* Author: jimtahu | ||
*/ | ||
|
||
#include "ListValue.h" | ||
|
||
namespace ParseTree { | ||
|
||
using namespace std; | ||
|
||
ListValue::ListValue(Value *head) { | ||
items.insert(items.begin(),head); | ||
} | ||
|
||
void ListValue::add(Value *item){ | ||
items.insert(items.end(),item); | ||
} | ||
|
||
string ListValue::getValue(){ | ||
return "%LIST%"; | ||
} | ||
|
||
ListValue::~ListValue() { | ||
for(std::vector<Value *>::iterator i=items.begin(); i!=items.end(); i++) | ||
delete *i; | ||
} | ||
|
||
} /* namespace ParseTree */ |
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,27 @@ | ||
/* | ||
* ListValue.h | ||
* | ||
* Created on: May 9, 2013 | ||
* Author: jimtahu | ||
*/ | ||
|
||
#ifndef LISTVALUE_H_ | ||
#define LISTVALUE_H_ | ||
|
||
#include <vector> | ||
#include "Value.h" | ||
|
||
namespace ParseTree { | ||
|
||
class ListValue: public Value { | ||
private: | ||
std::vector<Value *> items; | ||
public: | ||
ListValue(Value *head); | ||
void add(Value *item); | ||
std::string getValue(); | ||
virtual ~ListValue(); | ||
}; | ||
|
||
} /* namespace ParseTree */ | ||
#endif /* LISTVALUE_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