I'm pretty sure I missed cases and introduced bugs with the new CGenerator triplit system, but I finally got all normal tests passing, and it's almost 5 in the morning, so I'm calling it a night. We have destructors and copy constructors now\! I need to work out copy assignment, but again, another day

This commit is contained in:
Nathan Braswell
2015-05-30 04:43:01 -04:00
parent b71bb84070
commit bbcebf7c17
13 changed files with 482 additions and 66 deletions

45
src/CCodeTriple.cpp Normal file
View File

@@ -0,0 +1,45 @@
#include "CCodeTriple.h"
CCodeTriple::CCodeTriple(std::string pre, std::string val, std::string post) {
preValue = pre;
value = val;
postValue = post;
}
CCodeTriple::CCodeTriple(std::string val) {
value = val;
}
CCodeTriple::CCodeTriple(const char* val) {
value = val;
}
CCodeTriple::CCodeTriple() {
}
CCodeTriple::~CCodeTriple() {
}
std::string CCodeTriple::oneString() {
return preValue + value + postValue;
}
CCodeTriple & CCodeTriple::operator=(const CCodeTriple &rhs) {
preValue = rhs.preValue;
value = rhs.value;
postValue = rhs.postValue;
return *this;
}
CCodeTriple & CCodeTriple::operator+=(const CCodeTriple &rhs) {
preValue += rhs.preValue;
//preValue = rhs.preValue + preValue;
value += rhs.value;
postValue = rhs.postValue + postValue;
return *this;
}
CCodeTriple operator+(const CCodeTriple &a, const CCodeTriple &b) {
return CCodeTriple(a.preValue + b.preValue, a.value + b.value, b.postValue + a.postValue);
//return CCodeTriple(b.preValue + a.preValue, a.value + b.value, b.postValue + a.postValue);
}