本文整理汇总了C++中saveToFile函数的典型用法代码示例。如果您正苦于以下问题:C++ saveToFile函数的具体用法?C++ saveToFile怎么用?C++ saveToFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了saveToFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: emit
void ScorerManager::parseConstraintGroup()
{
//////////////////
emit( message("Parse constraint group starts: ") );
if ( this->otherPairs_.size() < 2)
{
emit( message("Parse pairs first!") );
return;
}
///////////////////////
groupRelations_.clear();
for ( int i = 0; i < this->actualInputGraphs_.size(); ++i)
{
Structure::Graph * g = Structure::Graph::actualGraph( this->actualInputGraphs_[i] );
GroupRelationDetector grd(g, i, this->normalizeCoef_, this->logLevel_);
grd.detect(this->otherPairs_[i]);
this->groupRelations_.push_back(grd.groupRelations_);
if (this->logLevel_)
{
saveToFile("group_relation-" + QString::number(i) + ".txt", this->groupRelations_[i]);
saveToFile("pair_relation-" + QString::number(i) + ".txt", this->otherPairs_[i]);
}
}
emit( message("Parse constraint group end. ") );
}
示例2: saveToFile
void saveToFile(struct dirNode *root,FILE *fstore)
{
if(root!=NULL)
{
//fwrite(&(root->fileDesc),sizeof(FileDescriptor),1,fstore);
saveToFile(root->rightSibling,fstore);
saveToFile(root->firstChild,fstore);
}
}
示例3: loadFromFile
void ofxPanel::setValue(float mx, float my, bool bCheck){
if( ofGetFrameNum() - currentFrame > 1 ){
bGrabbed = false;
bGuiActive = false;
return;
}
if( bCheck ){
if( b.inside(mx, my) ){
bGuiActive = true;
if( my > b.y && my <= b.y + header ){
bGrabbed = true;
grabPt.set(mx-b.x, my-b.y);
} else{
bGrabbed = false;
}
if(loadBox.inside(mx - b.x, my - b.y)) {
loadFromFile(filename);
}
if(saveBox.inside(mx - b.x, my - b.y)) {
saveToFile(filename);
}
}
} else if( bGrabbed ){
b.x = mx - grabPt.x;
b.y = my - grabPt.y;
}
}
示例4: QWidget
Notebook::Notebook(QWidget *parent) :
QWidget(parent)
{
setupUi(this);
titleLine->setReadOnly(true);
contentText->setReadOnly(true);
cancelButton->hide();
submitButton->hide();
nextButton->setEnabled(false);
previousButton->setEnabled(false);
editButton->setEnabled(false);
removeButton->setEnabled(false);
dialog = new FindDialog;
connect(addButton, SIGNAL(clicked()), this, SLOT(addNote()));
connect(submitButton, SIGNAL(clicked()), this, SLOT(submitNote()));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancel()));
connect(nextButton, SIGNAL(clicked()), this, SLOT(next()));
connect(previousButton, SIGNAL(clicked()), this, SLOT(previous()));
connect(editButton, SIGNAL(clicked()), this, SLOT(editContent()));
connect(removeButton, SIGNAL(clicked()), this, SLOT(removeContent()));
connect(findButton, SIGNAL(clicked()), this, SLOT(findTitle()));
connect(saveButton, SIGNAL(clicked()), this, SLOT(saveToFile()));
connect(loadButton, SIGNAL(clicked()), this, SLOT(loadFromFile()));
}
示例5: generator
void dsk::work() {
std::cout << "======Begin dsk model======" << std::endl;
double a = 0, b = 1, r;
for(auto i = 0; i < bytes.size(); i++){
generator(a,b,r);
r >= p ? bytes.at(i) = 0:1;
}
bl = makeBlocks(Blocks, BlockSize, bytes);
pr = new protocol(bl,code);
pr->work(dsk::ProtocolType, dsk::PacketSize);
std::stringstream res;
for(UINT i = 1; i <= dsk::PacketSize; i+=5){
pr->work(dsk::ProtocolType, i);
res << pr->getResults() << "\n";
}
saveToFile(res.str());
dsk::plot = pr->getPlot();
dsk::delProbPlot = pr->getDelProbPlot();
std::cout << "======End dsk model======" << std::endl;
std::stringstream bits;
for(auto value : bytes){
bits << value << " ";
}
std::string bitsName = "ErrorsStreamDSK.txt";
std::ofstream f;
f.open(bitsName);
f.write(bits.str().c_str(), sizeof(char)*bits.str().size());
f.close();
}
示例6: loadFromFile
bool ofxPanel::setValue(float mx, float my, bool bCheck){
if( !isGuiDrawing() ){
bGrabbed = false;
bGuiActive = false;
return false;
}
if( bCheck ){
if( b.inside(mx, my) ){
bGuiActive = true;
if( my > b.y && my <= b.y + header ){
bGrabbed = true;
grabPt.set(mx-b.x, my-b.y);
} else{
bGrabbed = false;
}
if(loadBox.inside(mx, my)) {
loadFromFile(filename);
ofNotifyEvent(loadPressedE,this);
return true;
}
if(saveBox.inside(mx, my)) {
saveToFile(filename);
ofNotifyEvent(savePressedE,this);
return true;
}
}
} else if( bGrabbed ){
setPosition(mx - grabPt.x,my - grabPt.y);
return true;
}
return false;
}
示例7: getSavingFileName
void PolicyEditor::save(){
if (!_isModified)
return;
QString file_name;
file_name = getSavingFileName(_filePath);
saveToFile(file_name);
}
示例8: saveToFile
void TlevelCreatorDlg::saveLevel() {
if ( QMessageBox::question(this, tr("level not saved!"), tr("Level was changed and not saved!"),
QMessageBox::Save, QMessageBox::Cancel) == QMessageBox::Save ) {
saveToFile();
} else
levelSaved();
}
示例9: saveToFile
void DemoKeeper::notifyEndDialog(common::OpenSaveFileDialog* _sender, bool _result)
{
mFileDialog->setVisible(false);
if (!_result) return;
if (mFileDialogSave)
{
std::string filename = mFileDialog->getFileName();
size_t index = filename.find_first_of('.');
if (index == std::string::npos)
filename += ".xml";
filename = mFileDialog->getCurrentFolder() + "/" + filename;
saveToFile(filename);
}
else
{
ClearGraph();
std::string filename = mFileDialog->getFileName();
filename = mFileDialog->getCurrentFolder() + "/" + filename;
loadFromFile(filename);
}
}
示例10: switch
void PixelWidget::keyPressEvent(QKeyEvent *e)
{
switch (e->key()) {
case Qt::Key_Plus:
increaseZoom();
break;
case Qt::Key_Minus:
decreaseZoom();
break;
case Qt::Key_PageUp:
setGridSize(m_gridSize + 1);
break;
case Qt::Key_PageDown:
setGridSize(m_gridSize - 1);
break;
case Qt::Key_G:
toggleGrid();
break;
case Qt::Key_C:
if (e->modifiers() & Qt::ControlModifier)
copyToClipboard();
break;
case Qt::Key_S:
if (e->modifiers() & Qt::ControlModifier) {
releaseKeyboard();
saveToFile();
}
break;
case Qt::Key_Control:
grabKeyboard();
break;
}
}
示例11: createNodeArray
// encoder
void Huffman::encode()
{
cout << "Begin encoding..." << endl;
cout << "Open file..." << endl;
inFile_.open(inFileName_.c_str(),ios::in);
cout << "Calculating frequency of all ascii chars..." << endl;
createNodeArray();
cout << "Done!" << endl;
inFile_.close();
cout << "Creating Priority-Queue..." << endl;
createPq();
cout << "Done!" << endl;
cout << "Creating Huffman-Tree..." << endl;
createHuffmanTree();
cout << "Done!" << endl;
cout << "Calculating Huffman-Code..." << endl;
calculateHuffmanCode();
cout << "Done!" << endl;
cout << "Saving to outputfile..." << endl;
saveToFile();
cout << "Done!" << endl;
cout << "Ecoding finished!" << endl;
}
示例12: saveToFile
octree_base<Container, PointT>::~octree_base ()
{
root_->flushToDisk ();
root_->saveIdx (false);
saveToFile ();
delete root_;
}
示例13: recordingStopped
void EventRecorder::timeout()
{
if (sessionTimer->isSynchronizing())
return;
if (autoStopRecord >= 0)
{
if((eventData.getRemainingTime().toString("h:mm:ss") == "0:00:00" && eventData.getEventType() == LTPackets::PRACTICE_EVENT) ||
(eventData.getRemainingTime().toString("h:mm:ss") == "0:00:00" && eventData.getEventType() == LTPackets::QUALI_EVENT && eventData.getQualiPeriod() == 3) ||
((eventData.getRemainingTime().toString("h:mm:ss") == "0:00:00" || eventData.getCompletedLaps() == eventData.getEventInfo().laps) && eventData.getEventType() == LTPackets::RACE_EVENT))
++elapsedTimeToStop;
if (elapsedTimeToStop >= (autoStopRecord * 60))
{
emit recordingStopped();
stopRecording();
}
}
if (autoSaveRecord > -1)
{
--autoSaveCounter;
if (autoSaveCounter <= 0)
{
saveToFile("");
autoSaveCounter = autoSaveRecord * 60;
}
}
}
示例14: r
void MainWindow::on_saveButton_clicked()
{
int size = nc*3/4;
char potentialFilename[]="out/potential-%1.txt";
char concFilename[]="out/ni_ne-%1.txt";
//Save potential
QVector<double> r(size), potential(size);
for (int i=0; i<size; ++i)
{
r[i] = r_array[i];
potential[i] = phi[i];
}
saveToFile(r,potential,QString(potentialFilename).arg((t/dt)));
//Save concentration of the electrons and ions
QVector<double> /*r(size),*/ ne(size),ni(size);
for (int i=0; i<size; ++i)
{
r[i] = r_array[i];
ne[i] = srho[0][i];
ni[i] = srho[1][i];
}
saveToFile2(r,ne,ni, QString(concFilename).arg((t/dt)));
}
示例15: saveToFile
void Highscores::add(Score s) {
s.version = highscoreVersion;
localScores.push_back(s);
saveToFile(localScores, localPath);
remoteScores.push_back(s);
fileSharing.uploadHighscores(localPath);
}