本文整理汇总了C++中Convert::binStrToX10方法的典型用法代码示例。如果您正苦于以下问题:C++ Convert::binStrToX10方法的具体用法?C++ Convert::binStrToX10怎么用?C++ Convert::binStrToX10使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Convert
的用法示例。
在下文中一共展示了Convert::binStrToX10方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: next
/**
* Proceeds with the next step in the simulation.
* Reads the inputs from the inputs field and sends them to the machine.
*/
void Simulator::next()
{
QString in, out;
int numin, numout;
GState* next_state;
Convert conv;
IOInfo* ioinfo;
IOInfoBin iobin(IO_MealyIn);
IOInfoASCII ioascii(IO_MealyIn);
Error err;
numin = machine->getNumInputs();
numout = machine->getNumOutputs();
in = simdlg->getInputs();
// bin = new char[numin+1];
if (simdlg->isIBinChecked())
{
if (Transition::conditionValid(Binary, in, FALSE))
{
if (!simdlg->isClockOn())
err.info(tr("Input is not in binary format."));
else
//simdlg->setInputs("");
simdlg->clearInput();
return;
}
iobin = conv.binStrToX10(numin, in, IO_MealyIn);
ioinfo = &iobin;
}
else if (simdlg->isIHexChecked())
{
QString intmp=in;
intmp = intmp.replace(QRegExp("[0-9a-fA-F\\s]"), "");
if (!intmp.isEmpty())
{
if (!simdlg->isClockOn())
err.info(tr("Input is not in hexadecimal format."));
else
//simdlg->setInputs("");
simdlg->clearInput();
return;
}
iobin = conv.hexStrToX10(numin, in, IO_MealyIn);
ioinfo = &iobin;
}
else // ASCII
{
ioascii.setInfo(in);
ioinfo = &ioascii;
if (!ioascii.isSingle())
{
if (!ioascii.getInfo().isEmpty() && !simdlg->isClockOn())
err.info(tr("The input is not a single character.")); //
else
//simdlg->setInputs("");
simdlg->clearInput();
return;
}
}
// IOInfoBin ioinfo(bin, numin);
next_state = next(ioinfo, out);
if (next_state)
{
simdlg->setOutputs(out);
setCurrentState(next_state);
main->repaintViewport();
}
if (simdlg->isClockOn() && simdlg->isIASCIIChecked())
{
simdlg->resetBits();
simdlg->clearInput();
}
else
simdlg->selectFirst();
// delete [] bin;
}