本文整理汇总了C++中save函数的典型用法代码示例。如果您正苦于以下问题:C++ save函数的具体用法?C++ save怎么用?C++ save使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了save函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: save
void Kandy::fileSaveAs()
{
QString filename = KFileDialog::getSaveFileName();
save(filename);
}
示例2: save
void IntegerEdit::setValue(int value) {
edit = value;
save();
}
示例3: CFileList
//! Creates a list of files and directories in the current working directory
IFileList* CFileSystem::createFileList()
{
FileEntry e2;
FileEntry e3;
if ( FileSystemType == FILESYSTEM_NATIVE )
return new CFileList();
CFileList* r = new CFileList( "virtual" );
r->Path = WorkingDirectory [ FILESYSTEM_VIRTUAL ];
for ( u32 i = 0; i != FileArchives.size(); ++i)
{
CFileList* flist[2] = { 0, 0 };
//! merge relative folder file archives
if ( FileArchives[i]->getArchiveType() == "mount" )
{
EFileSystemType currentType = setFileListSystem ( FILESYSTEM_NATIVE );
core::string<c16> save ( getWorkingDirectory () );
core::string<c16> current;
current = FileArchives[i]->getArchiveName() + WorkingDirectory [ FILESYSTEM_VIRTUAL ];
flattenFilename ( current );
if ( changeWorkingDirectoryTo ( current ) )
{
flist[0] = new CFileList( "mountpoint" );
flist[0]->constructNative ();
changeWorkingDirectoryTo ( save );
}
setFileListSystem ( currentType );
}
else
if ( FileArchives[i]->getArchiveType() == "zip" )
{
flist[0] = new CFileList( "zip" );
flist[1] = new CFileList( "zip directory" );
// add relative navigation
e2.isDirectory = 1;
e2.Name = ".";
e2.FullName = r->Path + e2.Name;
e2.Size = 0;
flist[1]->Files.push_back ( e2 );
e2.Name = "..";
e2.FullName = r->Path + e2.Name;
flist[1]->Files.push_back ( e2 );
for ( u32 g = 0; g < FileArchives[i]->getFileCount(); ++g)
{
const SZipFileEntry *e = (SZipFileEntry*) FileArchives[i]->getFileInfo(g);
s32 test = isInSameDirectory ( r->Path, e->zipFileName );
if ( test < 0 || test > 1 )
continue;
e2.Size = e->header.DataDescriptor.UncompressedSize;
e2.isDirectory = e2.Size == 0;
// check missing directories
if ( !e2.isDirectory && test == 1 )
{
e3.Size = 0;
e3.isDirectory = 1;
e3.FullName = e->path;
e3.Name = e->path.subString ( r->Path.size(), e->path.size() - r->Path.size() - 1 );
if ( flist[1]->Files.binary_search ( e3 ) < 0 )
flist[1]->Files.push_back ( e3 );
}
else
{
e2.FullName = e->zipFileName;
e2.Name = e->simpleFileName;
if ( !e2.isDirectory )
core::deletePathFromFilename ( e2.Name );
flist[0]->Files.push_back ( e2 );
}
}
}
// add file to virtual directory
for ( u32 g = 0; g < 2; ++g )
{
if ( !flist[g] )
continue;
for ( u32 j = 0; j != flist[g]->Files.size(); ++j )
r->Files.push_back ( flist[g]->Files[j] );
flist[g]->drop();
}
}
r->Files.sort();
return r;
//.........这里部分代码省略.........
示例4: read_string
static void read_string (LexState *LS, int del, SemInfo *seminfo) {
lua_State *L = LS->L;
size_t l = 0;
checkbuffer(L, 10, l);
save_and_next(L, LS, l);
while (LS->current != del) {
checkbuffer(L, 10, l);
switch (LS->current) {
case EOZ: case '\n':
save(L, '\0', l);
luaX_error(LS, "unfinished string", TK_STRING);
break; /* to avoid warnings */
case '\\':
next(LS); /* do not save the '\' */
switch (LS->current) {
case 'a': save(L, '\a', l); next(LS); break;
case 'b': save(L, '\b', l); next(LS); break;
case 'f': save(L, '\f', l); next(LS); break;
case 'n': save(L, '\n', l); next(LS); break;
case 'r': save(L, '\r', l); next(LS); break;
case 't': save(L, '\t', l); next(LS); break;
case 'v': save(L, '\v', l); next(LS); break;
case '\n': save(L, '\n', l); inclinenumber(LS); break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': {
int c = 0;
int i = 0;
do {
c = 10*c + (LS->current-'0');
next(LS);
} while (++i<3 && isdigit(LS->current));
if (c != (unsigned char)c) {
save(L, '\0', l);
luaX_error(LS, "escape sequence too large", TK_STRING);
}
save(L, c, l);
break;
}
default: /* handles \\, \", \', and \? */
save_and_next(L, LS, l);
}
break;
default:
save_and_next(L, LS, l);
}
}
save_and_next(L, LS, l); /* skip delimiter */
save(L, '\0', l);
seminfo->ts = luaS_newlstr(L, L->Mbuffer+1, l-3);
}
示例5: save
void
save(const version_type & t){
save(static_cast<const unsigned int>(t));
}
示例6: c_hoice
void c_hoice(){
str_in1 = strlen(in1);
str_in2 = strlen(in2);
str_in3 = strlen(in3);
var_in(); if (chosen == 1) return ;
else
{
if (str_in1 == 1)
{ if (str_in2 == 0)
{
if (in1[0] >= 'A' && in1[0] <= 'Z')
{
for (int i = 0; i <= 9; i ++)
{
if (in1[0] == var[i])
{
begin_chosen = i;
printf(" = "); comma(var_var[begin_chosen]); chosen = 1; return;
}
else
begin_chosen = 100;
}
}
else if (in1[0] >= 'a' && in1[0] <= 'z')
{
in1[0] -= 32;
for (int i = 0; i <= 9; i ++)
{
if (in1[0] == var[i])
{
begin_chosen = i;
printf(" = "); comma(var_var[begin_chosen]); chosen = 1; return;
}
else
begin_chosen = 100;
}
}
}}
else
{
choice = strcmp (in1, c_lear);
if (choice == 0) {system("clear"); chosen = 1; return ;}
else { choice = strcmp (in1, e_nd);
if (choice == 0) exit(1);
else { choice = strcmp (in1, V_AR);
if (choice == 0) {VAR(); chosen = 1; return ;}
else { choice = strcmp (in1, s_ave);
if (choice == 0) {save(); chosen = 1; return;}
else { choice = strcmp (in1, l_oad);
if (choice == 0) {load(); chosen = 1; return;}
}}}}
}
if (begin_chosen == 100)
{printf(" = undefined."); chosen = 1; return;}
}
} // choice 함수
示例7: save
void Sim::SFM::Airframe::save(Variant & variant, const Desc & desc)
{
save(variant["force"], desc.force);
save(variant["torque"], desc.torque);
}
示例8: save
void LogSensorStream::save(const std::string& _filename){
std::ofstream outfile;
outfile.open(_filename.c_str());
save(outfile);
outfile.close();
}
示例9: QAction
void MainWindow::createActions()
{
newAction = new QAction(tr("&New"), this);
newAction->setIcon(QIcon(":/images/new.png"));
newAction->setShortcut(QKeySequence::New);
newAction->setStatusTip(tr("Create a new spreadsheet file"));
connect(newAction, SIGNAL(triggered()), this, SLOT(newFile()));
openAction = new QAction(tr("&Open..."), this);
openAction->setIcon(QIcon(":/images/open.png"));
openAction->setShortcut(QKeySequence::Open);
openAction->setStatusTip(tr("Open an existing spreadsheet file"));
connect(openAction, SIGNAL(triggered()), this, SLOT(open()));
saveAction = new QAction(tr("&Save"), this);
saveAction->setIcon(QIcon(":/images/save.png"));
saveAction->setShortcut(QKeySequence::Save);
saveAction->setStatusTip(tr("Save the spreadsheet to disk"));
connect(saveAction, SIGNAL(triggered()), this, SLOT(save()));
saveAsAction = new QAction(tr("Save &As..."), this);
saveAsAction->setStatusTip(tr("Save the spreadsheet under a new "
"name"));
connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs()));
for (int i = 0; i < MaxRecentFiles; ++i) {
recentFileActions[i] = new QAction(this);
recentFileActions[i]->setVisible(false);
connect(recentFileActions[i], SIGNAL(triggered()),
this, SLOT(openRecentFile()));
}
exitAction = new QAction(tr("E&xit"), this);
exitAction->setShortcut(tr("Ctrl+Q"));
exitAction->setStatusTip(tr("Exit the application"));
connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));
cutAction = new QAction(tr("Cu&t"), this);
cutAction->setIcon(QIcon(":/images/cut.png"));
cutAction->setShortcut(QKeySequence::Cut);
cutAction->setStatusTip(tr("Cut the current selection's contents "
"to the clipboard"));
connect(cutAction, SIGNAL(triggered()), spreadsheet, SLOT(cut()));
copyAction = new QAction(tr("&Copy"), this);
copyAction->setIcon(QIcon(":/images/copy.png"));
copyAction->setShortcut(QKeySequence::Copy);
copyAction->setStatusTip(tr("Copy the current selection's contents "
"to the clipboard"));
connect(copyAction, SIGNAL(triggered()), spreadsheet, SLOT(copy()));
pasteAction = new QAction(tr("&Paste"), this);
pasteAction->setIcon(QIcon(":/images/paste.png"));
pasteAction->setShortcut(QKeySequence::Paste);
pasteAction->setStatusTip(tr("Paste the clipboard's contents into "
"the current selection"));
connect(pasteAction, SIGNAL(triggered()),
spreadsheet, SLOT(paste()));
deleteAction = new QAction(tr("&Delete"), this);
deleteAction->setShortcut(QKeySequence::Delete);
deleteAction->setStatusTip(tr("Delete the current selection's "
"contents"));
connect(deleteAction, SIGNAL(triggered()),
spreadsheet, SLOT(del()));
selectRowAction = new QAction(tr("&Row"), this);
selectRowAction->setStatusTip(tr("Select all the cells in the "
"current row"));
connect(selectRowAction, SIGNAL(triggered()),
spreadsheet, SLOT(selectCurrentRow()));
selectColumnAction = new QAction(tr("&Column"), this);
selectColumnAction->setStatusTip(tr("Select all the cells in the "
"current column"));
connect(selectColumnAction, SIGNAL(triggered()),
spreadsheet, SLOT(selectCurrentColumn()));
selectAllAction = new QAction(tr("&All"), this);
selectAllAction->setShortcut(QKeySequence::SelectAll);
selectAllAction->setStatusTip(tr("Select all the cells in the "
"spreadsheet"));
connect(selectAllAction, SIGNAL(triggered()),
spreadsheet, SLOT(selectAll()));
findAction = new QAction(tr("&Find..."), this);
findAction->setIcon(QIcon(":/images/find.png"));
findAction->setShortcut(QKeySequence::Find);
findAction->setStatusTip(tr("Find a matching cell"));
connect(findAction, SIGNAL(triggered()), this, SLOT(find()));
goToCellAction = new QAction(tr("&Go to Cell..."), this);
goToCellAction->setIcon(QIcon(":/images/gotocell.png"));
goToCellAction->setShortcut(tr("Ctrl+G"));
goToCellAction->setStatusTip(tr("Go to the specified cell"));
connect(goToCellAction, SIGNAL(triggered()),
this, SLOT(goToCell()));
recalculateAction = new QAction(tr("&Recalculate"), this);
recalculateAction->setShortcut(tr("F9"));
//.........这里部分代码省略.........
示例10: save
void FrameState::update(const IRInstruction* inst) {
if (auto* taken = inst->taken()) {
save(taken);
}
auto const opc = inst->op();
getLocalEffects(inst, *this);
switch (opc) {
case DefInlineFP: trackDefInlineFP(inst); break;
case InlineReturn: trackInlineReturn(inst); break;
case Call:
m_spValue = inst->dst();
m_frameSpansCall = true;
// A call pops the ActRec and pushes a return value.
m_spOffset -= kNumActRecCells;
m_spOffset += 1;
assert(m_spOffset >= 0);
clearCse();
break;
case CallArray:
m_spValue = inst->dst();
m_frameSpansCall = true;
// A CallArray pops the ActRec an array arg and pushes a return value.
m_spOffset -= kNumActRecCells;
assert(m_spOffset >= 0);
clearCse();
break;
case ContEnter:
clearCse();
break;
case DefFP:
case FreeActRec:
m_fpValue = inst->dst();
break;
case ReDefGeneratorSP:
m_spValue = inst->dst();
break;
case ReDefSP:
m_spValue = inst->dst();
m_spOffset = inst->extra<ReDefSP>()->spOffset;
break;
case DefInlineSP:
case DefSP:
m_spValue = inst->dst();
m_spOffset = inst->extra<StackOffset>()->offset;
break;
case AssertStk:
case AssertStkVal:
case CastStk:
case CoerceStk:
case CheckStk:
case GuardStk:
case ExceptionBarrier:
m_spValue = inst->dst();
break;
case SpillStack: {
m_spValue = inst->dst();
// Push the spilled values but adjust for the popped values
int64_t stackAdjustment = inst->src(1)->getValInt();
m_spOffset -= stackAdjustment;
m_spOffset += spillValueCells(inst);
break;
}
case SpillFrame:
case CufIterSpillFrame:
m_spValue = inst->dst();
m_spOffset += kNumActRecCells;
break;
case InterpOne:
case InterpOneCF: {
m_spValue = inst->dst();
auto const& extra = *inst->extra<InterpOneData>();
int64_t stackAdjustment = extra.cellsPopped - extra.cellsPushed;
// push the return value if any and adjust for the popped values
m_spOffset -= stackAdjustment;
break;
}
case AssertLoc:
case GuardLoc:
case CheckLoc:
m_fpValue = inst->dst();
break;
case LdThis:
m_thisAvailable = true;
break;
//.........这里部分代码省略.........
示例11: save
void BookmarkGroup::reparent( BookmarkGroupPtr parent )
{
m_parent = parent;
save();
}
示例12: main
/**
*\fn int main(int argc, char *argv[])
* Main
*\param[in,out] argc argc
*\param[in,out] argv argv
*/
int main(int argc, char *argv[])
{
SDL_Surface *screen = NULL;
int go = 1;
int ret,ret1, ret2 = 0, ret3, ret4;
char level_name[MAX_SIZE_FILE_NAME];
char player_name[MAX_SIZE_FILE_NAME];
int nb_lvl;
/*sound*/
Sound *sound_system;
sound_system = createSound();
/*keyboard config*/
SDLKey kc[NB_KEY-1];
/*input*/
Input in;
SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_JOYSTICK);
Player *current_player;
current_player = (Player *)malloc(sizeof(Player));
/*screen initialization*/
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);
initInput(&in);
/*configurations loading */
loadSoundOptions("configuration/sound.conf",sound_system);
SDL_WM_SetCaption("Super Martin", NULL); //window name
SDL_ShowCursor(SDL_DISABLE); //delete the mouse
while (go) //main loop
{
if(titleMenu(screen,&go,sound_system, &in))
{
while( (ret3 = menuPlayers(screen, player_name, &go, sound_system, &in)) != -1 && go)
{
switch(ret3)
{
case -1:
break;
case 2 :
ret2 = newPlayer(screen, player_name, sound_system, &go);
if(ret2 == 1)
{
current_player->levelMax = 1;
current_player->nbCoins = 0;
current_player->nbLifes = 3;
current_player->nbProjectile = 5;
savePlayer("save/.save", player_name, current_player);
loadInputOptions("default",kc,&in);
saveInputOptions(player_name, kc, &in);
}
else
break;
case 1 :
loadPlayer("save/.save", player_name, current_player);
loadInputOptions(player_name,kc,&in);
while(go && (ret1 = mainMenu(screen,&go,sound_system, player_name, &in)) != -1)
{
switch(ret1)
{
case -1:
break;
case 0:
while( (ret4 = menuLevel(screen,level_name,sound_system, player_name, current_player, &go, &nb_lvl, &in)) != -1 && go)
{
while(play(screen,level_name,sound_system,&go,kc, &in, current_player, player_name, ret4+1, nb_lvl) && go);
}
break;
case 1 :
save(screen, "save/.save", player_name, current_player, &go);
loadPlayer("save/.save", player_name, current_player);
break;
case 2 :
while((ret = optionMenu(screen,&go,sound_system,kc, &in)) != -1 && go)
{
switch(ret)
{
case -1:
break;
//.........这里部分代码省略.........
示例13: save
void ItemShortcut::setItem(const int index)
{
mItems[index] = mItemSelected;
mItemColors[index] = mItemColorSelected;
save();
}
示例14: split_quoted
int
split_quoted (const char *s, int *argc, char *argv[], int argv_sz)
{
char arg_buff[MAX_ARG_LEN]; /* current argument buffer */
char *ap, *ae; /* arg_buff current ptr & end-guard */
const char *c; /* current input charcter ptr */
char qc; /* current quote character */
enum states state; /* current state */
enum err_codes err; /* error end-code */
int flags; /* warning flags */
ap = &arg_buff[0];
ae = &arg_buff[MAX_ARG_LEN - 1];
c = &s[0];
state = ST_DELIM;
err = ERR_OK;
flags = 0;
qc = SQ; /* silence compiler waring */
while ( state != ST_END ) {
switch (state) {
case ST_DELIM:
while ( is_delim(*c) ) c++;
if ( *c == SQ || *c == DQ ) {
qc = *c; c++; state = ST_QUOTE;
break;
}
if ( *c == EOS ) {
state = ST_END;
break;
}
if ( *c == BS ) {
c++;
if ( *c == NL ) {
c++;
break;
}
if ( *c == EOS ) {
state = ST_END; err = ERR_BS_AT_EOS;
break;
}
}
/* All other cases incl. character after BS */
save(); c++; state = ST_ARG;
break;
case ST_QUOTE:
while ( *c != qc && ( *c != BS || qc == SQ ) && *c != EOS ) {
save(); c++;
}
if ( *c == qc ) {
c++; state = ST_ARG;
break;
}
if ( *c == BS ) {
assert (qc == DQ);
c++;
if ( *c == NL) {
c++;
break;
}
if (*c == EOS) {
state = ST_END; err = ERR_BS_AT_EOS;
break;
}
if ( ! is_dq_escapable(*c) ) {
c--; save(); c++;
}
save(); c++;
break;
}
if ( *c == EOS ) {
state = ST_END; err = ERR_SQ_OPEN_AT_EOS;
break;
}
assert(0);
case ST_ARG:
if ( *c == SQ || *c == DQ ) {
qc = *c; c++; state = ST_QUOTE;
break;
}
if ( is_delim(*c) || *c == EOS ) {
push();
state = (*c == EOS) ? ST_END : ST_DELIM;
c++;
break;
}
if ( *c == BS ) {
c++;
if ( *c == NL ) {
c++;
break;
}
if ( *c == EOS ) {
state = ST_END; err = ERR_BS_AT_EOS;
break;
}
}
/* All other cases, incl. character after BS */
save(); c++;
break;
//.........这里部分代码省略.........
示例15: bounds
void CCellView::ResizeCol(BPoint where, int colNr)
{
float x, minX, maxRow;
BPoint newP, lastP;
BRect bounds(Bounds()), r, b;
ulong buttons, cnt;
bool multi;
int mCol = colNr;
CRunArray backup(fCellWidths);
StPenState save(this);
ClearAnts();
cnt = fSelection.right - fSelection.left + 1;
while (fCellWidths[colNr + 1] == fCellWidths[colNr])
colNr++;
multi = fSelection.left != fSelection.right
&& colNr >= fSelection.left
&& colNr <= fSelection.right;
if (colNr <= fFrozen.h)
{
x = fBorderWidth + fCellWidths[colNr];
minX = fBorderWidth + fCellWidths[multi?fSelection.left - 1 : colNr - 1];
}
else
{
x = fBorderWidth + fCellWidths[colNr] + fCellWidths[fFrozen.h] -
fCellWidths[fPosition.h - 1];
minX = fBorderWidth + fCellWidths[fFrozen.h] - fCellWidths[fPosition.h - 1] +
fCellWidths[multi?fSelection.left - 1 : colNr - 1];
}
r.top = 1;
r.bottom = fBorderHeight - 1;
r.left = minX + 1;
if (multi)
r.right = minX + fCellWidths[fSelection.right] -
fCellWidths[fSelection.left - 1] - 1;
else
r.right = minX + fCellWidths[colNr] - fCellWidths[colNr - 1] - 1;
b = bounds;
b.left = r.right;
maxRow = fPosition.v;
while (fCellHeights[++maxRow] - fCellHeights[fPosition.v] < bounds.bottom - fBorderHeight)
;
lastP = where;
newP = where;
do
{
if (newP.x != lastP.x)
{
float dx;
int k = colNr;
dx = newP.x - lastP.x;
if (lastP.x + dx < bounds.left + fBorderWidth)
dx = std::min(lastP.x - bounds.left - fBorderWidth, (float)0);
if (lastP.x + dx > bounds.right)
dx = std::max(bounds.right - lastP.x, (float)0);
if (multi && x + dx < minX)
dx = minX - x;
if (multi)
{
float w, t;
w = x + dx - minX;
if (w > 0)
w = Round(w / (colNr - fSelection.left + 1));
t = fCellWidths[fSelection.right];
fCellWidths.SetValue(fSelection.left, fSelection.right, w);
dx = fCellWidths[fSelection.right] - t;
}
else if (x + dx < minX)
{
int t = k;
fCellWidths.SetValue(colNr, 0);
while (k > 1 && backup[k - 1] + fBorderWidth >= x + dx)
k--;
ASSERT(k<colNr);
if (k <= mCol)
while (mCol > k)
fCellWidths.SetValue(mCol--, 0);
else
{
t = mCol;
for (;mCol<k;mCol++)
//.........这里部分代码省略.........