本文整理匯總了C++中CheckInput函數的典型用法代碼示例。如果您正苦於以下問題:C++ CheckInput函數的具體用法?C++ CheckInput怎麽用?C++ CheckInput使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了CheckInput函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: DoCCallBack_LPSTR_OutByRef
extern "C" DLL_EXPORT DLL_EXPORT void _cdecl DoCCallBack_LPSTR_OutByRef(CCallBackOutByRef callback)
{
int len = 10;
LPSTR pStr = (LPSTR)CoTaskMemAlloc(len);
if(!CheckInput(callback(&pStr)))
{
ReportFailure("DoCCallBack_LPSTR_OutByRef:NativeSide,the first Check");
}
if(!CheckInput(pStr))
{
ReportFailure("DoCCallBack_LPSTR_OutByRef:NativeSide,the Second Check");
}
CoTaskMemFree(pStr);
}
示例2: DoSCallBack_LPSTR_OutByRef
extern "C" DLL_EXPORT void __cdecl DoSCallBack_LPSTR_OutByRef(SCallBackOutByRef callback)
{
size_t len = 10;
LPSTR pStr = (LPSTR)CoreClrAlloc(len);
if (!CheckInput(callback(&pStr)))
{
ReportFailure("DoSCallBack_LPSTR_OutByRef:NativeSide,the first check");
}
if (!CheckInput(pStr))
{
ReportFailure("DoSCallBack_LPSTR_OutByRef:NativeSide,the second Check");
}
CoreClrFree(pStr);
}
示例3: main
int
main(void)
{
int h;
// initialize a flag
bool flag = false;
// keep asking for input until it's vaild
do
{
// ask for the height
printf("height: ");
// record users' input
h = GetInt();
// check the input
flag = CheckInput(h);
}
while (flag == false);
// draw the chart
DrawChart(h);
return 0;
}
示例4: Convert
int IdConverter::Convert(std::string & id_in, std::string & id_out)
{
// sanity check
if(int rc = CheckInput(id_in))
{
return rc;
}
// convert
id_out = "";
for(size_t ipos = 0; ipos < id_in.size(); )
{
if(id_in[ipos + 2] != delimr)
{
// one-token group
if(id_in.compare(ipos, 2, "Z9") == 0)
{
id_out += "A1-A1";
}
else
{
// increment token
char token[8];
IncrementToken(id_in, ipos, token);
id_out += token;
}
ipos += 2;
}
else
{
// two-token group
if(id_in.compare(ipos, 5, "Z9-Z9") == 0)
{
// can not be incremented more
return 3;
}
if(id_in.compare(ipos + 3, 2, "Z9") == 0)
{
// first token should be incremented
char token[8];
IncrementToken(id_in, ipos, token);
id_out += token;
// second token will be "A1"
id_out += "-A1";
}
else
{
// increment second token only
char token[8];
IncrementToken(id_in, ipos + 3, token);
id_out += id_in.substr(ipos, 3);
id_out += token;
}
ipos += 5;
}
}
return 0;
}
示例5: if
void CMainMenu::Update(const SUIInput& a_rInput)
{
if (m_GoingIntoGame)
{
float half = CPostEffects::GameStartTime / 2.0f;
m_CurrentTime += twTime->GetDeltaTime();
float value = m_CurrentTime / half;
((triebWerk::CUIDrawable*)(m_pBackground->GetDrawable()))->m_Material.m_ConstantBuffer.SetValueInBuffer(4, &value);
if (m_CurrentTime >= half)
{
twSceneManager->SetActiveScene("Game");
m_GoingIntoGame = false;
m_CurrentTime = 0.0f;
}
return;
}
else if (m_LerpToExtras) LerpToExtras();
else if (m_LerpFromExtras) LerpFromExtras();
if (CGameInfo::Instance().m_Menu == EMenus::Main)
{
((triebWerk::CFontDrawable*)m_pTextExtras->GetDrawable())->m_pText->SetText("Extras");
CheckInput(a_rInput);
}
UpdateGraphics();
}
示例6: CheckInput
void Example::prepare(float dt)
{
CheckInput();
DeltaTime = dt;
ModelSky->m_RotateY+=(SPEED*DeltaTime);
const float ROTSPEED = 50.0f;
if(rotate)
m_rotationAngle += ROTSPEED * dt;
if (m_rotationAngle > 360.0f)
m_rotationAngle -= 360.0f;
m_angle += 2.0f * dt;
if (m_angle > 360.0f)
m_angle -= 360.0f;
const float LIGHT_SPEED = 0.0005f;
m_lightPosZ += LIGHT_SPEED;
m_GLSLProgram->sendUniform("time", timer);
}
示例7: onStart
void auto_smzdm::onStart()
{
if (!CheckInput())
{
return;
}
UpdateData();
control_status = true;
ui.lineEdit_msg->setText(QStringLiteral("運行中"));
QString msg = QStringLiteral("運行中");
int count = 0;
while( control_status )
{
QString temp = msg;
smzdm_run();
count ++;
QString temp2;
temp2.setNum(count);
ui.lineEdit_msg->setText(temp + temp2);
QElapsedTimer t;
t.start();
while(t.elapsed()<1000)
QCoreApplication::processEvents();
}
}
示例8: OpenShop
// Open the Shop
NamedScript KeyBind void OpenShop(bool OpenLocker)
{
// If you're dead, return
if (GetActorProperty(0, APROP_Health) <= 0) return;
// If you're in an Outpost menu, return
if (Player.OutpostMenu > 0) return;
// If you're in any minigames, return
if (Player.InMinigame) return;
// If you're looking inside a crate, return
if (Player.CrateOpen) return;
// Close the main menu if it's open
Player.InMenu = false;
// Sanity check for pressing use while the shop is open in front of the counter in the Outpost
if (Player.InShop && CheckInput(BT_USE, KEY_HELD, false, PlayerNumber())) return;
if (Player.InShop)
{
ActivatorSound("menu/leave", 127);
SetPlayerProperty(0, 0, PROP_TOTALLYFROZEN);
Player.InShop = false;
}
else
{
ActivatorSound("menu/shop", 127);
Player.InShop = true;
if (OpenLocker)
Player.LockerMode = true;
}
}
示例9: mexFunction
void mexFunction(int nlhs, mxArray *plhs[], int nrhs,const mxArray *prhs[])
{
double tau, rownorm;
double *W, *W_thresh, *nz;
long p, K, ik, ip, pK;
CheckInput(nlhs, plhs, nrhs, prhs);
p=mxGetM(prhs[0]); /* # row */
K=mxGetN(prhs[0]); /* # col */
W=mxGetPr(prhs[0]); /* pointer to the input array */
tau=mxGetScalar(prhs[1]);
plhs[0]=mxCreateDoubleMatrix(p,K,mxREAL); /* output p x K array */
W_thresh=mxGetPr(plhs[0]); /* pointer to the data W_thresh*/
pK=p*K;
for (ip=0; ip<p; ip++) {
/* compute the 2-norm of the ip-th row */
for (ik=0, rownorm=0.0; ik<K; ik++)
rownorm+=W[ip+p*ik]*W[ip+p*ik]; /* W(ip+1,ik+1)=W[ip + p*ik], ip=0,...,p, ik=0,...,K */
rownorm=sqrt(rownorm);
/* perform row-wise group-thresholding */
if (rownorm > tau){
for (ik=0; ik<K; ik++)
W_thresh[ip+p*ik]=W[ip+p*ik]*(1-tau/rownorm); /* W(ip+1,ik+1)=W[ip + p*ik], ip=0,...,p, ik=0,...,K */
}
else {
for (ik=0; ik<K; ik++)
W_thresh[ip+p*ik]=0; /* W(ip+1,ik+1)=W[ip + p*ik], ip=0,...,p, ik=0,...,K */
}
}
}
示例10: CheckUp
// This is called every 4096 nodes to check if we have run out of time
// or if we have been interrupted by the GUI
static void CheckUp(searchinfo_t *sinfo)
{
if(sinfo->infinite == false && GetTime() >= sinfo->stopTime){
sinfo->stop = true;
}
CheckInput(sinfo);
}
示例11: CheckInput
void BiasAdderNet::Execute() {
CheckInput();
const Blob* const input = this->input_blobs(0);
const Blob* const bias = this->params(0);
Blob* const output = this->output_blobs(0);
int channels = bias->channels();
CHECK_EQ(channels, input->channels());
int height = input->height();
int width = input->width();
int num = input->num();
LOG(DEBUG) << "input blob: (" << num << "," << input->channels() << ","
<< height << "," << width << ")";
LOG(DEBUG) << "bias blob: (" << bias->num() << "," << bias->channels()
<< "," << bias->height() << "," << bias->width() << ")";
float* const dst_head = new float[num*channels*height*width];
int size = height * width;
for (int n = 0, offset = 0; n < num; ++n) {
for (int ichannel = 0; ichannel < channels; ++ichannel) {
for(int i = 0; i < size; ++i, ++offset) {
dst_head[offset] = (*input)[offset] + (*bias)[ichannel];
}
}
}
output->CopyData(num, channels, height, width, dst_head);
delete []dst_head;
CheckOutput();
}
示例12: DoCCallBack_LPSTR_Out
extern "C" DLL_EXPORT void __cdecl DoCCallBack_LPSTR_Out(CCallBackOut callback)
{
size_t len = 10;
LPSTR pStr = (LPSTR)CoreClrAlloc(len);
//Check the return value
if (!CheckInput(callback(pStr)))
{
ReportFailure("DoCCallBack_LPSTR_Out:NativeSide,the first check");
}
if (!CheckInput(pStr))
{
ReportFailure("DoCCallBack_LPSTR_Out:NativeSide,the Second Check");
}
CoreClrFree(pStr);
}
示例13: main
/**
*
* Main function of this program.
*
*/
int main()
{
float input;
float input_cents;
do
{
// Get the user input
printf("O hai! How much change is owed?\n");
input = GetFloat();
// Validate the user input
if(CheckInput(input) == FALSE)
{
continue;
}
}while(input < 0.0);
// Convert to cents
input_cents = (float)round(input * 100);
// Lets Start
int number_of_coins = 0;
while(input_cents > 0.0)
{
//printf("input_cents=%f\n",input_cents);
if(input_cents >= QUATAR)
{
// This means the input is can be subtracted by a QUATAR
input_cents = input_cents - QUATAR;
number_of_coins++;
}
else if(input_cents < QUATAR && input_cents >= DIME)
{
// This means the input is can be subtracted by a DIME
input_cents = input_cents - DIME;
number_of_coins++;
}
else if(input_cents < DIME && input_cents >= NICKEL)
{
// This means the input is can be subtracted by a NICKEL
input_cents = input_cents - NICKEL;
number_of_coins++;
}
else
{
// This means remaining are PENNIES. So just add as many number of pennies.
number_of_coins = number_of_coins + input_cents;
input_cents = 0;
}
}
printf("%d\n", number_of_coins);
// Good Bye
return 0;
}
示例14: on_btnOK_clicked
void InputDialog::on_btnOK_clicked()
{
if(CheckInput())
{
strResult = ui->lnInput->text();
done(QDialog::Accepted);
}
}
示例15: DoSCallBack_LPSTR_InOut
extern "C" DLL_EXPORT DLL_EXPORT void _cdecl DoSCallBack_LPSTR_InOut(SCallBackInOut callback)
{
const char* pTemp = "AAAA";
int len = strlen(pTemp)+1;
LPSTR pStr = (LPSTR)CoTaskMemAlloc(len);
strncpy(pStr,pTemp,len);
if(!CheckInput(callback(pStr)))
{
ReportFailure("DoSCallBack_LPSTR_InOut:NativeSide,the first check");
}
if(!CheckInput(pStr))
{
ReportFailure("DoSCallBack_LPSTR_InOut:NativeSide,the second Check");
}
CoTaskMemFree(pStr);
}