Skip to content

Commit

Permalink
Add RAM/Archive destination setter.
Browse files Browse the repository at this point in the history
  • Loading branch information
adriweb committed Jul 29, 2017
1 parent f1a2500 commit caf958c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/TIVarFile.cpp
Expand Up @@ -246,6 +246,17 @@ namespace tivars
this->refreshMetadataFields();
}

void TIVarFile::setArchived(bool flag)
{
if (this->calcModel.getFlags() >= TIFeatureFlags::hasFlash)
{
this->varEntry.archivedFlag = (uchar)(flag ? 1 : 0);
this->refreshMetadataFields();
} else {
throw runtime_error("[Error] Archived flag not supported on this calculator model");
}
}


data_t TIVarFile::getRawContent()
{
Expand Down Expand Up @@ -382,6 +393,7 @@ namespace tivars
.function("setContentFromString" , select_overload<void(const std::string&)>(&TIVarFile::setContentFromString))
.function("setCalcModel" , &TIVarFile::setCalcModel)
.function("setVarName" , &TIVarFile::setVarName)
.function("setArchived" , &TIVarFile::setArchived)
.function("getRawContent" , &TIVarFile::getRawContent)
.function("getReadableContent" , select_overload<std::string(const options_t&)>(&TIVarFile::getReadableContent))
.function("getReadableContent" , select_overload<std::string(void)>(&TIVarFile::getReadableContent))
Expand Down
1 change: 1 addition & 0 deletions src/TIVarFile.h
Expand Up @@ -73,6 +73,7 @@ namespace tivars

void setCalcModel(const TIModel& model);
void setVarName(const std::string& name);
void setArchived(bool flag);

data_t getRawContent();

Expand Down
Binary file removed src/TypeHandlers/TH_0x21.bc
Binary file not shown.
4 changes: 3 additions & 1 deletion tests.cpp
Expand Up @@ -118,7 +118,9 @@ newPrgm.saveVarToFile("testData", "Program_new");
testPrgm42.setContentFromString("Grande blabla:Disp \"Grande blabla");
testPrgm42.setVarName("Toto");
assert(testPrgm42.getReadableContent() == "Grande blabla:Disp \"Grande blabla");
testPrgm42.saveVarToFile("testData", "testMinTok_new");
testPrgm42.saveVarToFile("testData", "testMinTok_new");
testPrgm42.setArchived(true);
testPrgm42.saveVarToFile("testData", "testMinTok_archived_new");


TIVarFile testRealList = TIVarFile::loadFromFile("testData/RealList.8xl");
Expand Down

0 comments on commit caf958c

Please sign in to comment.