本文整理汇总了C++中setFailed函数的典型用法代码示例。如果您正苦于以下问题:C++ setFailed函数的具体用法?C++ setFailed怎么用?C++ setFailed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setFailed函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: adoptPtr
void PNGImageDecoder::decode(bool onlySize)
{
if (failed())
return;
if (!m_reader)
m_reader = adoptPtr(new PNGImageReader(this));
// If we couldn't decode the image but we've received all the data, decoding
// has failed.
if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived())
setFailed();
// If we're done decoding the image, we don't need the PNGImageReader
// anymore. (If we failed, |m_reader| has already been cleared.)
else if (isComplete())
m_reader.clear();
}
示例2: PLATFORM
void BMPImageDecoder::decode(bool onlySize)
{
#if PLATFORM(CHROMIUM)
TRACE_EVENT("BMPImageDecoder::decode", this, 0);
#endif
if (failed())
return;
// If we couldn't decode the image but we've received all the data, decoding
// has failed.
if (!decodeHelper(onlySize) && isAllDataReceived())
setFailed();
// If we're done decoding the image, we don't need the BMPImageReader
// anymore. (If we failed, |m_reader| has already been cleared.)
else if (!m_frameBufferCache.isEmpty() && (m_frameBufferCache.first().status() == ImageFrame::FrameComplete))
m_reader.clear();
}
示例3: ASSERT
bool ICOImageDecoder::processDirectory() {
// Read directory.
ASSERT(!m_decodedOffset);
if (m_data->size() < sizeOfDirectory)
return false;
const uint16_t fileType = readUint16(2);
m_dirEntriesCount = readUint16(4);
m_decodedOffset = sizeOfDirectory;
// See if this is an icon filetype we understand, and make sure we have at
// least one entry in the directory.
if (((fileType != ICON) && (fileType != CURSOR)) || (!m_dirEntriesCount))
return setFailed();
m_fileType = static_cast<FileType>(fileType);
return true;
}
示例4: adoptPtr
void JPEGImageDecoder::decode(bool onlySize)
{
if (failed())
return;
if (!m_reader)
m_reader = adoptPtr(new JPEGImageReader(this));
// If we couldn't decode the image but we've received all the data, decoding
// has failed.
if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived())
setFailed();
// If we're done decoding the image, we don't need the JPEGImageReader
// anymore. (If we failed, |m_reader| has already been cleared.)
else if (!m_frameBufferCache.isEmpty() && (m_frameBufferCache[0].status() == ImageFrame::FrameComplete))
m_reader.clear();
}
示例5: adoptPtr
void PNGImageDecoder::decode(bool onlySize)
{
if (failed())
return;
if (!m_reader)
m_reader = adoptPtr(new PNGImageReader(this));
// If we couldn't decode the image but have received all the data, decoding
// has failed.
if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived())
setFailed();
// If decoding is done or failed, we don't need the PNGImageReader anymore.
if (isComplete(this) || failed())
m_reader.clear();
}
示例6: setFailed
void ICOImageDecoder::decode(size_t index, bool onlySize)
{
if (failed())
return;
// If we couldn't decode the image but we've received all the data, decoding
// has failed.
if ((!decodeDirectory() || (!onlySize && !decodeAtIndex(index))) && isAllDataReceived())
setFailed();
// If we're done decoding this frame, we don't need the BMPImageReader or
// PNGImageDecoder anymore. (If we failed, these have already been
// cleared.)
else if ((m_frameBufferCache.size() > index) && (m_frameBufferCache[index].status() == ImageFrame::FrameComplete)) {
m_bmpReaders[index] = nullptr;
m_pngDecoders[index] = nullptr;
}
}
示例7: AMListAction3
CLSSIS3820ScalerDarkCurrentMeasurementAction::CLSSIS3820ScalerDarkCurrentMeasurementAction(CLSSIS3820ScalerDarkCurrentMeasurementActionInfo *info, QObject *parent) :
AMListAction3(info, AMListAction3::Sequential, parent)
{
CLSSIS3820Scaler *scaler = CLSBeamline::clsBeamline()->scaler();
double secondsDwell = scalerDarkCurrentMeasurementActionInfo()->dwellTime();
connect( this, SIGNAL(failed()), this, SLOT(onActionFailed()) );
if (scaler && scaler->isConnected() && secondsDwell > 0) {
// pre-measurement settings.
double oldDwell = scaler->dwellTime();
// first turn off beam.
// addSubAction(AMBeamline::bl()->createTurnOffBeamActions());
// set the scaler's dwell time to new time.
addSubAction(scaler->createDwellTimeAction3(secondsDwell));
// initiate a scaler measurement and wait until it is complete.
addSubAction(scaler->createStartAction3(true));
addSubAction(scaler->createWaitForDwellFinishedAction(secondsDwell + 5.0));
// notify attached and able scaler channel detectors that the latest measurement was a dark current measurement.
AMListAction3 *notifyChannelDetectors = new AMListAction3(new AMListActionInfo3("Set last measurement as dark current measurement", "Set last measurement as dark current measurement"));
for (int i = 0; i < scaler->channels().count(); i++) {
CLSSIS3820ScalerChannel *channel = scaler->channelAt(i);
if (channel && channel->isEnabled() && channel->detector() && channel->detector()->canDoDarkCurrentCorrection()) {
notifyChannelDetectors->addSubAction(channel->detector()->createSetLastMeasurementAsDarkCurrentAction());
}
}
addSubAction(notifyChannelDetectors);
// reset settings to pre-measurement conditions.
addSubAction(scaler->createDwellTimeAction3(oldDwell));
} else {
AMErrorMon::alert(this, CLSSIS3820SCALERDARKCURRENTMEASUREMENTACTION_SCALER_NOT_VALID, "Failed to complete dark current measurement--scaler not valid.");
setFailed();
}
}
示例8: QString
void VESPERSSetStringAction::onValueChanged()
{
const AMProcessVariable *pv = ((AMPVControl *)(control_))->readPV();
QString string = VESPERS::pvToString(pv);
QString text = ((VESPERSSetStringActionInfo *)info())->text();
if (string == text){
AMErrorMon::debug(this, VESPERSSETSTRINGACTION_SUCCEEDED, QString("[SUCCEEDED] Set string. Desired: %1 Result: %2.").arg(text).arg(string));
setSucceeded();
}
else{
AMErrorMon::debug(this, VESPERSSETSTRINGACTION_FAILED, QString("[FAILED] Set string. Desired: %1 Result: %2.").arg(text).arg(string));
setFailed();
}
}
示例9: disconnect
void AMScanAction::onControllerInitialized()
{
if (state() == AMAction3::Skipping){
disconnect(controller_, SIGNAL(cancelled()), this, SLOT(onControllerCancelled()));
connect(controller_, SIGNAL(cancelled()), this, SLOT(onControllerSucceeded()));
controller_->cancel();
}
else if (!controller_->start()){
AMErrorMon::alert(this, AMSCANACTION_CANT_START_CONTROLLER, "Could not start the scan controller.");
setFailed();
}
else {
setStarted();
}
}
示例10: U_TRACE
UString URPCObject::processMessage(URPCEnvelope& envelope, bool& bContainsFault)
{
U_TRACE(0, "URPCObject::processMessage(%p,%p)", &envelope, &bContainsFault)
U_INTERNAL_ASSERT_POINTER(URPCMethod::encoder)
UString retval;
// Iterate over the list of methods
URPCMethod* method = find(envelope.getMethodName());
if (method == 0)
{
// Return object not found error. This would be a Client fault
setFailed();
URPCMethod::pFault->setFaultReason(U_CONSTANT_TO_PARAM("The requested method does not exist on this server"));
bContainsFault = true;
retval = URPCMethod::encoder->encodeFault(URPCMethod::pFault);
}
else
{
UString ns = envelope.getNsName();
U_INTERNAL_DUMP("envelope.nsName = %V", ns.rep)
// check the name of namespace qualified element information (gSOAP)
if (ns.empty()) ns = method->getNamespaces();
if (ns.empty()) ns = *UString::str_ns;
bContainsFault = (method->execute(envelope) == false);
retval = URPCMethod::encoder->encodeMethodResponse(*method, ns);
}
U_RETURN_STRING(retval);
}
示例11: setFailed
void EglWaylandBackend::init()
{
if (!initRenderingContext()) {
setFailed("Could not initialize rendering context");
return;
}
initEGL();
GLPlatform *glPlatform = GLPlatform::instance();
glPlatform->detect(EglPlatformInterface);
glPlatform->printResults();
initGL(EglPlatformInterface);
setSupportsBufferAge(false);
if (hasGLExtension("EGL_EXT_buffer_age")) {
const QByteArray useBufferAge = qgetenv("KWIN_USE_BUFFER_AGE");
if (useBufferAge != "0")
setSupportsBufferAge(true);
}
}
示例12: QString
void AMDetectorReadAction::startImplementation(){
// If you still don't have a detector, check the exposed detectors one last time.
//if(!detector_)
// detector_ = AMBeamline::bl()->exposedDetectorByInfo(*(detectorReadInfo()->detectorInfo()));
if(!detector_ && AMBeamlineSupport::beamlineDetectorAPI())
detector_ = AMBeamlineSupport::beamlineDetectorAPI()->exposedDetectorByInfo(*(detectorReadInfo()->detectorInfo()));
if(!detector_) {
AMErrorMon::alert(this,
AMDETECTORREADACTION_NO_VALID_DETECTOR,
QString("There was an error reading the detector '%1', because the detector was not found. Please report this problem to the Acquaman developers.").arg(detectorReadInfo()->name()));
setFailed();
return;
}
if(detector_->readMethod() == AMDetectorDefinitions::WaitRead){
// connect to detector initialization signals
connect(detector_, SIGNAL(newValuesAvailable()), this, SLOT(onDetectorNewValuesAvailable()));
}
else
internalSetSucceeded();
}
示例13: adoptPtr
void GIFImageDecoder::parse(GIFParseQuery query)
{
if (failed())
return;
if (!m_reader) {
m_reader = adoptPtr(new GIFImageReader(this));
m_reader->setData(m_data);
}
if (!m_reader->parse(query)) {
setFailed();
return;
}
const size_t oldSize = m_frameBufferCache.size();
m_frameBufferCache.resize(m_reader->imagesCount());
for (size_t i = oldSize; i < m_reader->imagesCount(); ++i) {
ImageFrame& buffer = m_frameBufferCache[i];
const GIFFrameContext* frameContext = m_reader->frameContext(i);
buffer.setPremultiplyAlpha(m_premultiplyAlpha);
buffer.setRequiredPreviousFrameIndex(findRequiredPreviousFrame(i));
buffer.setDuration(frameContext->delayTime);
buffer.setDisposalMethod(frameContext->disposalMethod);
// Initialize the frame rect in our buffer.
IntRect frameRect(frameContext->xOffset, frameContext->yOffset, frameContext->width, frameContext->height);
// Make sure the frameRect doesn't extend outside the buffer.
if (frameRect.maxX() > size().width())
frameRect.setWidth(size().width() - frameContext->xOffset);
if (frameRect.maxY() > size().height())
frameRect.setHeight(size().height() - frameContext->yOffset);
buffer.setOriginalFrameRect(frameRect);
}
}
示例14: isAllDataReceived
void ICOImageDecoder::decode(size_t index, bool onlySize) {
if (failed())
return;
// Defensively clear the FastSharedBufferReader's cache, as another caller
// may have called SharedBuffer::mergeSegmentsIntoBuffer().
m_fastReader.clearCache();
// If we couldn't decode the image but we've received all the data, decoding
// has failed.
if ((!decodeDirectory() || (!onlySize && !decodeAtIndex(index))) &&
isAllDataReceived()) {
setFailed();
// If we're done decoding this frame, we don't need the BMPImageReader or
// PNGImageDecoder anymore. (If we failed, these have already been
// cleared.)
} else if ((m_frameBufferCache.size() > index) &&
(m_frameBufferCache[index].getStatus() ==
ImageFrame::FrameComplete)) {
m_bmpReaders[index].reset();
m_pngDecoders[index].reset();
}
}
示例15: setFailed
void ICOImageDecoder::decode(size_t index, bool onlySize)
{
if (failed())
return;
// If we couldn't decode the image but we've received all the data, decoding
// has failed.
if ((!decodeDirectory() || (!onlySize && !decodeAtIndex(index))) && isAllDataReceived())
setFailed();
// If we're done decoding this frame, we don't need the BMPImageReader or
// PNGImageDecoder anymore. (If we failed, these have already been
// cleared.)
else if ((m_frameBufferCache.size() > index) && m_frameBufferCache[index].isComplete()) {
m_bmpReaders[index] = nullptr;
m_pngDecoders[index] = nullptr;
}
if (m_frameBufferCache.isEmpty())
m_frameBufferCache.resize(m_dirEntries.size());
// CAUTION: We must not resize m_frameBufferCache again after this, as
// decodeAtIndex() may give a BMPImageReader a pointer to one of the
// entries.
}