本文整理汇总了C++中Build函数的典型用法代码示例。如果您正苦于以下问题:C++ Build函数的具体用法?C++ Build怎么用?C++ Build使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Build函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
Build();
while(scanf("%d",&n) &&n) {
printf("%d:\n",n);
int ans=-1;
for(int i=0;i<pcnt && prime[i] < n;++i)
if(notp[n-prime[i]] == false) {
ans = prime[i];
break;
}
if(ans == -1)
puts("NO WAY!");
else
printf("%d+%d\n",ans,n-ans);
}
return 0;
}
示例2: BuildAndExecute
void Ide::BuildAndExecute()
{
if(Build()) {
int time = msecs();
One<Host> h = CreateHostRunDir();
h->ChDir(Nvl(rundir, GetFileFolder(target)));
String cmdline;
if(!runexternal)
cmdline << '\"' << h->GetHostPath(target) << "\" ";
cmdline << ToSystemCharset(runarg);
int exitcode;
switch(runmode) {
case RUN_WINDOW:
HideBottom();
h->Launch(cmdline, FindIndex(SplitFlags(mainconfigparam, true), "GUI") < 0);
break;
case RUN_CONSOLE:
ShowConsole();
PutConsole(String().Cat() << "Executing: " << cmdline);
console.Sync();
exitcode = h->ExecuteWithInput(cmdline);
PutConsole("Finished in " + GetPrintTime(time) + ", exit code: " + AsString(exitcode));
break;
case RUN_FILE: {
HideBottom();
String fn;
if(IsNull(stdout_file))
fn = ForceExt(target, ".ol");
else
fn = stdout_file;
FileOut out(fn);
if(!out) {
PromptOK("Unable to open output file [* " + DeQtf(stdout_file) + "] !");
return;
}
if(h->Execute(cmdline, out) >= 0) {
out.Close();
EditFile(fn);
}
}
}
}
}
示例3: Build
void Path::Build(const Coordinates& coords, //coords to build from
Path::Iter iter, //iterator of parent
Path::Dots& to_skip, //list of dots to skip
const Coordinates& previous){ //previous dot
//if dot isn't captured and we don't need to skip it...
if( !Skip(coords, to_skip)
&& (field->GetState(coords) != CAPTURED_BY_BLUE)
&& (field->GetState(coords) != CAPTURED_BY_RED)
&& field->InRange(coords)
){
//appending dot as a child for parent dot
Path::Iter ch = tr.append_child(iter, coords);
to_skip.push_back(coords); //marking this dot as visited
Path::SearchResult sr = field->SearchNearby(coords);
for(int i = 0; i < sr.amount; i++)
if(previous != sr.find_coords[i]) //we won't go to the dot we've visited before
Build(sr.find_coords[i], ch, to_skip, coords);
}
}
示例4: CS_ASSERT
//--------------------------------------------------
//--------------------------------------------------
void Texture::Restore()
{
CS_ASSERT(GetStorageLocation() == CSCore::StorageLocation::k_none, "Cannot restore texture that was loaded from file. This should be handled using RefreshResource().");
Texture::Descriptor desc;
desc.m_width = m_width;
desc.m_height = m_height;
desc.m_format = m_format;
desc.m_compression = m_compression;
desc.m_dataSize = m_restorationDataSize;
WrapMode sWrap = m_sWrapMode;
WrapMode tWrap = m_tWrapMode;
FilterMode filterMode = m_filterMode;
Build(desc, std::move(m_restorationData), m_hasMipMaps, m_restoreTextureDataEnabled);
SetWrapMode(sWrap, tWrap);
SetFilterMode(filterMode);
}
示例5: openInputFileAndControl
// 4. Construct grid from file
void OpenSMOKE_Grid1D::Construct(const std::string fileName)
{
BzzVector xVector;
std::string dummy, units;
ifstream inputFile;
openInputFileAndControl(inputFile, fileName);
inputFile >> dummy;
if (dummy != "#X")
ErrorMessage("Expected #X keyword");
inputFile >> units;
inputFile >> dummy;
if (dummy != "#LIST")
ErrorMessage("Expected #LIST keyword");
for(;;)
{
inputFile >> dummy;
if (dummy == "#END")
break;
xVector.Append(OpenSMOKE_Conversions::conversion_length(atof(dummy.c_str()), units));
}
inputFile.close();
Np = xVector.Size();
Ni = Np-1;
L = xVector[Np];
xA = xVector[1];
xB = xA+L;
Allocate();
dxw[1]=0.;
for(int i=2;i<=Np;i++)
dxw[i]=xVector[i]-xVector[i-1];
Build();
}
示例6: fin
void Model::OpenBookTXT(char * file_name, ID3D11Device * device)
{
std::fstream fin(file_name);
if (!fin) {
MessageBox(0, L"Erro ao carregar o arquivo de modelo (Arquivo nao existe ou esta corrompido).", L"Model Error", 0);
return;
}
std::string ignore;
fin >> ignore >> nModelVert;
fin >> ignore >> nModelIndex;
fin >> ignore >> ignore >> ignore >> ignore;
vertices.resize(nModelVert);
for (int i = 0; i < nModelVert; ++i) {
fin >> vertices[i].Pos.x >> vertices[i].Pos.y >> vertices[i].Pos.z;
//Seria a normal no lugar da cor aqui
fin >> vertices[i].Normal.x >> vertices[i].Normal.y >> vertices[i].Normal.z;
}
fin >> ignore >> ignore >> ignore;
UINT mTriangleCount = nModelIndex;
nModelIndex *= 3;
indices.resize(nModelIndex);
for (int i = 0; i < mTriangleCount; ++i) {
fin >> indices[i * 3 + 0] >> indices[i * 3 + 1] >> indices[i * 3 + 2];
}
fin.close();
Build(device);
}
示例7: main
int
main(void)
{
AdjMultipleList *G;
G = (AdjMultipleList *)malloc(sizeof(AdjMultipleList));
Build(G);
Show(G);
Dfsearch(G);
while(1){
mstkruskal(G);
}
// Mstprime(G);}
// read_input_file(G);
// A->B_DFS(G);
// A->B_BFS(G);
// A->B->C
return 0;
}
示例8: Allocate
// 1. Construct equispaced grid
void OpenSMOKE_Grid1D::Construct(const int NP, const double LL, const double xAA)
{
double deltax;
Np = NP;
Ni = Np-1;
L = LL;
xA = xAA;
xB = xA+L;
Allocate();
deltax = L/Ni;
dxw = deltax;
dxw[1] = 0.;
Build();
}
示例9: dlg
void UnitCfg::New ()
{
NewDlg dlg (Name, this);
if (dlg.exec ())
{
//
Comment->setText (tr(NONE_STR));
Name->insertItem (dlg.GetName ()); // add to the list box
Enabled->setChecked (0);
SetComboItem (Name, dlg.GetName ()); // make it the selected item
//
Build (); // build the record
GetConfigureDb ()->AddToRecord ("NAME", Name->currentText ());
QString cmd = GetConfigureDb ()->Insert ("UNITS"); // generate the update record
GetConfigureDb ()->DoExec (this, cmd,tNew); // lock the db and action the request
//
ButtonState (false);
fNew = true;
DOAUDIT(tr("New:") + dlg.GetName());
};
}
示例10: main
int main() {
int Q;
while(scanf("%d",&n) && n) {
scanf("%d",&Q);
for(int i=1;i<=n;++i)
scanf("%d",seq+i);
node *root;
root = Build(1,n);
while(Q--) {
int a,b;
scanf("%d%d",&a,&b);
printf("%d\n",Query(root, a, b));
}
Crash(root);
}
return 0;
}
示例11: dlg
void UserCfgDlg::New ()
{
// Get the new name
NewDlg dlg (Name, this);
if (dlg.exec ())
{
//
ReportsPriviledge->setChecked (0);
AlarmAckPriv->setChecked (0);
ReportsPriv->setChecked (0);
ReportsPriviledge->setEnabled (true);
AlarmAckPriv->setEnabled (true);
ReportsPriv->setEnabled (true);
ExitApp->setEnabled(0); // need this priviledge to close the user interface
AllPriv->setChecked (0);
AgePassword->setChecked(true); // default to needing to change passwords
AgeDays->setValue(0); // require password to change on next login
FactoryAdministrator->setChecked(false); // default no Factory Administrator
//
Comment->setText (tr(NONE_STR));
Password->setText (tr(NONE_STR));
//
// leave the language - so it defaults to current
//
Name->insertItem (dlg.GetName ()); // add to the list box
SetComboItem (Name, dlg.GetName ()); // make it the selected item
//
Build (); // build the record
GetConfigureDb ()->AddToRecord ("PSSWORD", tr(NONE_STR)); // force user toe choose password on startup
//
GetConfigureDb ()->AddToRecord ("NAME", Name->currentText ());
QString cmd = GetConfigureDb ()->Insert ("USERS"); // generate the update record
GetConfigureDb ()->DoExec (this, cmd,tNew); // lock the db and action the request
//
ButtonState (false);
//
DOAUDIT(tr("New:") + dlg.GetName());
//
};
}
示例12: switch
eOSState cCMDDir::New(eKeys Key)
{
switch(Key)
{
case kOk:
if(!isempty(Dir))
{
char *buffer = NULL;
asprintf(&buffer, "%s/%s", CurrentDir(), stripspace(Dir));
MYDEBUG("Verzeichnis: Neu: Anlegen: %s", buffer);
cFileInfo *info = new cFileInfo(buffer);
if(info->isExists())
{
MYDEBUG("Verzeichnis existiert bereits");
OSD_WARNMSG(tr("Directory exists"));
FREENULL(buffer);
DELETENULL(info);
return osContinue;
}
if(cFileCMD::Mkdir(buffer))
{
MYDEBUG("Verzeichnis anlegen erfolgreich");
LastSelDir(buffer);
if(!Select)
OsdObject->SetState(mmsReInit);
}
FREENULL(buffer);
DELETENULL(info);
}
case kBack:
State = csNone;
Build();
return osContinue;
break;
default:
break;
}
return cOsdMenu::ProcessKey(Key);
}
示例13: CloneShipFragment
HSTARSHIP
CloneShipFragment (COUNT index, PQUEUE pDstQueue, BYTE crew_level)
{
HSTARSHIP hStarShip, hBuiltShip;
SHIP_FRAGMENTPTR TemplatePtr;
if ((hStarShip = GetStarShipFromIndex (&GLOBAL (avail_race_q), index)) == 0)
return (0);
TemplatePtr = (SHIP_FRAGMENTPTR)LockStarShip (
&GLOBAL (avail_race_q), hStarShip
);
hBuiltShip =
Build (pDstQueue,
TemplatePtr->RaceResIndex,
TemplatePtr->ShipInfo.ship_flags & (GOOD_GUY | BAD_GUY),
(BYTE)(index == SAMATRA_SHIP ?
0 : NameCaptain (pDstQueue, (STARSHIPPTR)TemplatePtr)));
if (hBuiltShip)
{
SHIP_FRAGMENTPTR ShipFragPtr;
ShipFragPtr = (SHIP_FRAGMENTPTR)LockStarShip (pDstQueue, hBuiltShip);
ShipFragPtr->ShipInfo = TemplatePtr->ShipInfo;
if (crew_level)
ShipFragPtr->ShipInfo.crew_level = crew_level;
ShipFragPtr->ShipInfo.energy_level = 0;
ShipFragPtr->ShipInfo.ship_flags = 0;
ShipFragPtr->ShipInfo.var1 = ShipFragPtr->ShipInfo.var2 = 0;
ShipFragPtr->ShipInfo.loc.x = ShipFragPtr->ShipInfo.loc.y = 0;
SET_RACE_ID (ShipFragPtr, (BYTE)index);
UnlockStarShip (pDstQueue, hBuiltShip);
}
UnlockStarShip (
&GLOBAL (avail_race_q), hStarShip
);
return (hBuiltShip);
}
示例14: EnsureFileDoesNotExist
// TestParallelBuild
//------------------------------------------------------------------------------
void TestCLR::TestParallelBuild() const
{
FBuildOptions options;
options.m_ForceCleanBuild = true;
options.m_ShowSummary = true; // required to generate stats for node count checks
EnsureFileDoesNotExist( "../../../../ftmp/Test/CLR/clrmulti.lib" );
FBuildStats stats = Build( options, false, "CLR-Parallel-Target" ); // dont' use DB
EnsureFileExists( "../../../../ftmp/Test/CLR/clrmulti.lib" );
// Check stats
// Seen, Built, Type
CheckStatsNode ( stats, 1, 1, Node::DIRECTORY_LIST_NODE );
CheckStatsNode ( stats, 5, 3, Node::FILE_NODE ); // 3xcpp + .h
CheckStatsNode ( stats, 1, 1, Node::COMPILER_NODE );
CheckStatsNode ( stats, 3, 3, Node::OBJECT_NODE );
CheckStatsNode ( stats, 1, 1, Node::LIBRARY_NODE );
CheckStatsNode ( stats, 1, 1, Node::ALIAS_NODE );
CheckStatsTotal( stats, 12, 10 );
}
示例15: Build
/*
========================
idZipBuilder::Update
updates a zip file with the files in the specified folder
========================
*/
bool idZipBuilder::Update( const char* zipPath, const char* folder, bool cleanFolder )
{
// if this file doesn't exist, just build it
if( fileSystem->GetTimestamp( zipPath ) == FILE_NOT_FOUND_TIMESTAMP )
{
return Build( zipPath, folder, cleanFolder );
}
zipFileName = zipPath;
sourceFolderName = folder;
if( !CreateZipFile( true ) )
{
// don't clean the folder if the zip fails
return false;
}
if( cleanFolder )
{
CleanSourceFolder();
}
return true;
}