本文整理汇总了C++中FileFormat::setInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ FileFormat::setInfo方法的具体用法?C++ FileFormat::setInfo怎么用?C++ FileFormat::setInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileFormat
的用法示例。
在下文中一共展示了FileFormat::setInfo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Save
McoStatus PrinterType::Save(FSSpec *fspec)
{
int i;
McoStatus status = MCO_SUCCESS;
FileFormat *filef;
int magic_num = PRINTERTYPE_MAGICNUM;
int version = PRINTERTYPE_VERSION;
filef = new FileFormat;
// status = filef->createFilewithtype(fspec,smSystemScript,'Mprn','MCO6');
// if (status != MCO_SUCCESS) goto bail;
status = filef->openFile(fspec);
if (status != MCO_SUCCESS) goto bail;
status = filef->relWrite(sizeof(int),(char*)&magic_num);
if (status != MCO_SUCCESS) goto bailclose;
status = filef->relWrite(sizeof(int),(char*)&version);
if (status != MCO_SUCCESS) goto bailclose;
status = filef->relWrite(sizeof(ConData),(char*)&data);
if (status != MCO_SUCCESS) goto bailclose;
status = filef->relWrite(sizeof(int),(char*)&num_hands);
if (status != MCO_SUCCESS) goto bailclose;
status = filef->relWrite(sizeof(double)*31,(char*)x_hands);
if (status != MCO_SUCCESS) goto bailclose;
status = filef->relWrite(sizeof(double)*31,(char*)y_hands);
if (status != MCO_SUCCESS) goto bailclose;
status = filef->relWrite(sizeof(int),(char*)&sim_num);
if (status != MCO_SUCCESS) goto bailclose;
status = filef->relWrite(sizeof(int),(char*)&num_tweaks);
if (status != MCO_SUCCESS) goto bailclose;
for (i=0; i<num_tweaks; i++)
{
status = filef->relWrite(sizeof(Tweak_Element),(char*)tweaks[i]);
if (status != MCO_SUCCESS) goto bailclose;
}
filef->setInfo(fspec,MONACO_SIG,'MCO6');
bailclose:
filef->closeFile();
bail:
delete filef;
return status;
}
示例2:
Defaults::~Defaults(void)
{
FileFormat *filef;
FSSpec fspec;
McoStatus status;
int magic_num = DEFAULTS_MAGIC_NUM;
int version = DEFAULTS_VERSION;
Str255 def = MONACO_DEFAULT;
Str255 fold = MONACO_FOLDER;
// now try to load in the user defults
filef = new FileFormat;
ptocstr(def);
ptocstr(fold);
status = filef->createFileinPref(&fspec,(char*)def,(char*)fold);
if (status != MCO_SUCCESS) return;
status = filef->openFile(&fspec);
if (status != MCO_SUCCESS) return;
status = filef->relWrite(sizeof(int),(char*)&magic_num);
if (status != MCO_SUCCESS) return;
status = filef->relWrite(sizeof(int),(char*)&version);
if (status != MCO_SUCCESS) return;
status = filef->relWrite(sizeof(int),(char*)&printer_type);
if (status != MCO_SUCCESS) return;
status = filef->relWrite(sizeof(int),(char*)&input_type);
if (status != MCO_SUCCESS) return;
status = filef->relWrite(sizeof(int),(char*)&patch_format);
if (status != MCO_SUCCESS) return;
status = filef->relWrite(sizeof(int),(char*)&port);
if (status != MCO_SUCCESS) return;
filef->setInfo(&fspec,MONACO_SIG,'MCO7');
filef->closeFile();
delete filef;
}
示例3: if
// The event handler for the main menu
McoStatus ToneTab::DoEvents(short item, Point clickPoint, WindowCode *wc, int32 *numwc, void **data,Boolean &changed)
{
int didit = 0;
int i,j;
McoStatus status = MCO_SUCCESS;
short item2 = item - startNum;
Str255 prompt;
StandardFileReply soutReply,sinReply;
Str255 outname = "\p";
SFTypeList filelist;
Str255 inname;
Rect r1;
short iType;
Handle iHandle;
WindowPtr oldP;
GetPort(&oldP);
SetPort( dp ) ;
// no codes passed back
*numwc = 0;
for (i=0; i<numControls; i++)
{
status = controls[i]->DoEvents(item,clickPoint,wc,numwc,data,changed,&didit);
if (status) return status;
if (changed)
{
doc->changedLinearTone = 1;
last_changed = 1;
CopyOutofControl(i);
CopyIntoControl(i);
}
else last_changed = 0;
if (didit) return status;
}
if (item2 == EXPORT)
{
if (doc->calCurves)
{
GetIndString(prompt,PROMPT_STRINGS,STANDARD_PROMPT);
StandardPutFile(prompt, outname, &soutReply);
if(soutReply.sfGood)
{
memcpy(outname, soutReply.sfFile.name, *(soutReply.sfFile.name)+1);
PathNameFromDirID(soutReply.sfFile.parID, soutReply.sfFile.vRefNum, outname);
ptocstr(outname);
status = doc->calCurves->exportTone((char*)outname);
if (status) McoErrorAlert(status);
else
{
FileFormat ff;
ff.setInfo(&soutReply.sfFile,MONACO_SIG,'TEXT');
}
}
}
}
else if (item2 == IMPORT)
{
if (doc->calCurves)
{
filelist[0] = 'TEXT';
StandardGetFile(0L, 1, filelist, &sinReply);
if(sinReply.sfGood)
{
memcpy(inname, sinReply.sfFile.name, *(sinReply.sfFile.name)+1);
PathNameFromDirID(sinReply.sfFile.parID, sinReply.sfFile.vRefNum, inname);
ptocstr(inname);
status = doc->calCurves->importTone((char*)inname);
if (status) McoErrorAlert(status);
else
{
CopyIntoControl(-1);
doc->changedLinearTone = 1;
}
status = MCO_SUCCESS;
}
}
}
else
{
GetDItem (dp, DESCRIPTION+startNum, &iType, (Handle*)&iHandle, &r1);
GetIText(iHandle,inname);
if (inname[0] > 100) inname[0] = 100;
ptocstr(inname);
strcpy(doc->printData->setting.toneDesc,(char*)inname);
}
SetPort(oldP);
return status;
}