• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ IllegalArgumentException函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中IllegalArgumentException函数的典型用法代码示例。如果您正苦于以下问题:C++ IllegalArgumentException函数的具体用法?C++ IllegalArgumentException怎么用?C++ IllegalArgumentException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了IllegalArgumentException函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: switch

void DecodeHints::addFormat(BarcodeFormat toadd) {
  switch (toadd) {
    case BarcodeFormat_QR_CODE: hints |= BARCODEFORMAT_QR_CODE_HINT; break;
    case BarcodeFormat_DATA_MATRIX: hints |= BARCODEFORMAT_DATA_MATRIX_HINT; break;
    case BarcodeFormat_UPC_E: hints |= BARCODEFORMAT_UPC_E_HINT; break;
    case BarcodeFormat_UPC_A: hints |= BARCODEFORMAT_UPC_A_HINT; break;
    case BarcodeFormat_EAN_8: hints |= BARCODEFORMAT_EAN_8_HINT; break;
    case BarcodeFormat_EAN_13: hints |= BARCODEFORMAT_EAN_13_HINT; break;
    case BarcodeFormat_CODE_128: hints |= BARCODEFORMAT_CODE_128_HINT; break;
    case BarcodeFormat_CODE_39: hints |= BARCODEFORMAT_CODE_39_HINT; break;
    case BarcodeFormat_ITF: hints |= BARCODEFORMAT_ITF_HINT; break;
    default: throw IllegalArgumentException("Unrecognizd barcode format");
  }
}
开发者ID:Android9001,项目名称:zxing,代码行数:14,代码来源:DecodeHints.cpp


示例2: setName

void PFPChunk::setName(const String &chunkname)
/*!\brief Name des Chunks setzen
 *
 * \desc
 * Mit dieser Funktion wird der Name eines Chunks definiert. Der Name muss
 * exakt 4 Byte lang sein und darf nur Großbuchstaben enthalten (es wird
 * eine automatische Konvertierung durchgeführt). Ausserdem sind nur Zeichen
 * aus dem Zeichensatz US-ASCII erlaubt.
 *
 * \param chunkname String mit dem Namen des Strings
 * \exception IllegalArgumentException Wird geworfen, wenn der Name des Chunks ungültig ist
 *
 */
{
	if (chunkname.len()!=4) throw IllegalArgumentException();
	String s=chunkname;
	s.upperCase();
	for (size_t i=0;i<4;i++) {
		wchar_t c=s[i];
		if (c<32 || c>127) throw IllegalArgumentException();
	}
	this->chunkname=s;
}
开发者ID:pfedick,项目名称:pplib,代码行数:23,代码来源:PFPFile.cpp


示例3: IllegalArgumentException

void KnownIdentities::fromFile(QString const& filename, bool dryRun) {
	if (!QFile::exists(filename)) {
		throw IllegalArgumentException() << QString("Could not open the specified contacts file as it does not exist: %1").arg(filename).toStdString();
	}
	QFile inputFile(filename);
	if (!inputFile.open(QFile::ReadOnly | QFile::Text)) {
		throw IllegalArgumentException() << QString("Could not open the specified contacts file for reading: %1").arg(filename).toStdString();
	}

	QRegExp commentRegExp("^\\s*#.*$", Qt::CaseInsensitive, QRegExp::RegExp2);
	QRegExp identityRegExp("^\\s*([A-Z0-9]{8})\\s*:\\s*([a-fA-F0-9]{64})\\s*(?::\\s*(.*)\\s*)?$", Qt::CaseInsensitive, QRegExp::RegExp2);

	QTextStream in(&inputFile);
	while (!in.atEnd()) {
		QString line = in.readLine();
		if (line.trimmed().isEmpty() || commentRegExp.exactMatch(line)) {
			continue;
		} else if (identityRegExp.exactMatch(line)) {
			if (!dryRun) {
				accessMutex.lock();

				identityToPublicKeyHashMap.insert(identityRegExp.cap(1), PublicKey::fromHexString(identityRegExp.cap(2)));
				if (!identityRegExp.cap(3).trimmed().isEmpty()) {
					// Nickname given.
					identityToNicknameHashMap.insert(identityRegExp.cap(1), identityRegExp.cap(3));
				}

				accessMutex.unlock();
			}
		} else {
			throw IllegalArgumentException() << QString("Invalid or ill-formated line in contacts file \"%1\". Problematic line: %2").arg(filename).arg(line).toStdString();
		}
	}

	inputFile.close();
	emit identitiesChanged();
}
开发者ID:Blinket,项目名称:openMittsu,代码行数:37,代码来源:KnownIdentities.cpp


示例4: ASSERT

    void HmacImpl<HASH,DRBGINFO>::nextBytesImpl(byte bytes[], size_t size)
    {
        // Assert here. Parameters are validated in HmacGenerate()
        ASSERT(DigestLength == m_v.size());
        ASSERT(DigestLength == m_k.size());

        // Has a catastrophic error been encountered previously?
        ASSERT(!m_catastrophic);
        if(m_catastrophic)
            throw EncryptionException("A catastrophic error was previously encountered");

        ASSERT(bytes && size);
        if( !(bytes && size) )
            throw IllegalArgumentException("Unable to generate bytes from hash drbg. The buffer or size is not valid");

        ASSERT(m_rctr <= MaxReseed);
        if( !(m_rctr <= MaxReseed) )
            throw IllegalArgumentException("Unable to generate bytes from hash drbg. A reseed is required");

        ASSERT(size <= MaxRequest);
        if( !(size <= MaxRequest) )
            throw IllegalArgumentException("Unable to generate bytes from hash drbg. The requested size exceeds the maximum this DRBG can produce");

        try
        {
            // Set up a temporary so we don't leak bits on an exception
            CryptoPP::SecByteBlock temp(size);
            HmacGenerate(temp.data(), temp.size());

            ::memcpy(bytes, temp.data(), size);
        }
        catch(CryptoPP::Exception& ex)
        {
            m_catastrophic = true;
            throw EncryptionException(NarrowString("Internal error: ") + ex.what());
        }
    }
开发者ID:dreadlock,项目名称:owasp-esapi-cplusplus,代码行数:37,代码来源:SecureRandomImpl.cpp


示例5: IllegalArgumentException

void CGImageLuminanceSource::init (CGImageRef cgimage, int left, int top, int width, int height) {
    data_ = 0;
    image_ = cgimage;
    left_ = left;
    top_ = top;
    width_ = width;
    height_ = height;
    dataWidth_ = (int)CGImageGetWidth(image_);
    dataHeight_ = (int)CGImageGetHeight(image_);

    if (left_ + width_ > dataWidth_ ||
        top_ + height_ > dataHeight_ ||
        top_ < 0 ||
        left_ < 0) {
        throw IllegalArgumentException("Crop rectangle does not fit within image data.");
    }

    CGColorSpaceRef space = CGImageGetColorSpace(image_);
    CGColorSpaceModel model = CGColorSpaceGetModel(space);

    if (model != kCGColorSpaceModelMonochrome || CGImageGetBitsPerComponent(image_) != 8 || CGImageGetBitsPerPixel(image_) != 8) {
        CGColorSpaceRef gray = CGColorSpaceCreateDeviceGray();
        
        CGContextRef ctx = CGBitmapContextCreate(0, width, height, 8, width, gray, kCGImageAlphaNone);
        
        CGColorSpaceRelease(gray);

        if (top || left) {
            CGContextClipToRect(ctx, CGRectMake(0, 0, width, height));
        }

        CGContextDrawImage(ctx, CGRectMake(-left, -top, width, height), image_);
    
        image_ = CGBitmapContextCreateImage(ctx);

        bytesPerRow_ = width;
        top_ = 0;
        left_ = 0;
        dataWidth_ = width;
        dataHeight_ = height;

        CGContextRelease(ctx);
    } else {
        CGImageRetain(image_);
    }

    CGDataProviderRef provider = CGImageGetDataProvider(image_);
    data_ = CGDataProviderCopyData(provider);
}
开发者ID:conradev,项目名称:QuickQR,代码行数:49,代码来源:CGImageLuminanceSource.cpp


示例6: switch

void InternalJob::SetPriority(int newPriority)
{
  switch (newPriority)
  {
  case Job::INTERACTIVE:
  case Job::SHORT:
  case Job::LONG:
  case Job::BUILD:
  case Job::DECORATE:
    ptr_manager->SetPriority(InternalJob::Pointer(this), newPriority);
    break;
  default:
    throw IllegalArgumentException(newPriority);
  }
}
开发者ID:AGrafmint,项目名称:MITK,代码行数:15,代码来源:berryInternalJob.cpp


示例7: project

 void project(Coordinate* c) const
 {
   double inx = c->x;
   double iny = c->y;
   if (_transform->Transform(1, &c->x, &c->y) == FALSE)
   {
     QString err = QString("Error projecting point. Is the point outside of the projection's "
                           "bounds?");
     LOG_WARN("Source Point, x:" << inx << " y: " << iny);
     LOG_WARN("Source SRS: " << MapReprojector::toWkt(_transform->GetSourceCS()));
     LOG_WARN("Target Point, x:" << c->x << " y: " << c->y);
     LOG_WARN("Target SRS: " << MapReprojector::toWkt(_transform->GetTargetCS()));
     throw IllegalArgumentException(err);
   }
 }
开发者ID:giserh,项目名称:hootenanny,代码行数:15,代码来源:MapReprojector.cpp


示例8: initFieldType

 SortField::SortField(const String& field, ParserPtr parser, bool reverse)
 {
     if (boost::dynamic_pointer_cast<IntParser>(parser))
         initFieldType(field, INT);
     else if (boost::dynamic_pointer_cast<ByteParser>(parser))
         initFieldType(field, BYTE);
     else if (boost::dynamic_pointer_cast<LongParser>(parser))
         initFieldType(field, LONG);
     else if (boost::dynamic_pointer_cast<DoubleParser>(parser))
         initFieldType(field, DOUBLE);
     else
         boost::throw_exception(IllegalArgumentException(L"Parser instance does not subclass existing numeric parser from FieldCache"));
     this->reverse = reverse;
     this->parser = parser;
 }
开发者ID:alesha1488,项目名称:LucenePlusPlus,代码行数:15,代码来源:SortField.cpp


示例9: IllegalArgumentException

	void ActionPerformer::performAction(const String&name)
	{
		Action*action = nullptr;
		size_t actions_size = actions.size();
		for(size_t i=0; i<actions_size; i++)
		{
			ActionInfo actInfo = actions.get(i);
			if(actInfo.name.equals(name))
			{
				action = actInfo.action;
				i = actions_size;
			}
		}
		
		if(action == nullptr)
		{
			throw IllegalArgumentException("name", "action does not exist");
		}
		else if(action->performer != nullptr && ((!action->finishing && !action->cancelling) || action->reran))
		{
			throw IllegalArgumentException("perform", "cannot perform on multiple performers");
		}
		else if(action_current != nullptr && ((!action_current->finishing && !action_current->cancelling) || action_current->reran))
		{
			throw IllegalStateException("current action must be cancelled or finished before another action is performed");
		}
		else if(action_current==action && action_current->cancelling)
		{
			throw IllegalArgumentException("action", "action is cancelling");
		}
		
		action_current = action;
		action_name = name;
		
		action_current->perform(this);
	}
开发者ID:BlueTheRaptor,项目名称:MobileBrawler,代码行数:36,代码来源:ActionPerformer.cpp


示例10: IllegalArgumentException

GF256Poly *GF256Poly::multiplyByMonomial(int degree,
        int coefficient) {
    if (degree < 0) {
        throw IllegalArgumentException("Degree must be non-negative");
    }
    if (coefficient == 0) {
        return field.getZero();
    }
    int size = coefficients.size();
    ArrayRef<int> product (new Array<int>(size + degree));
    for (int i = 0; i < size; i++) {
        product[i] = field.multiply(coefficients[i], coefficient);
    }
    return new GF256Poly(field, product);
}
开发者ID:jverkoey,项目名称:liteqr,代码行数:15,代码来源:GF256Poly.cpp


示例11: switch

 bool Field::isStored(Store store)
 {
     switch (store)
     {
         case STORE_YES:
             return true;
         
         case STORE_NO:
             return false;
         
         default:
             boost::throw_exception(IllegalArgumentException(L"Invalid field store"));
             return false;
     }
 }
开发者ID:alesha1488,项目名称:LucenePlusPlus,代码行数:15,代码来源:Field.cpp


示例12: requireParser

/**
 * Parses a datetime from the given text, returning the number of
 * milliseconds since the epoch, 1970-01-01T00:00:00Z.
 * <p>
 * The parse will use the ISO chronology, and the default time zone.
 * If the text contains a time zone string then that will be taken into account.
 *
 * @param text  text to parse
 * @return parsed value expressed in milliseconds since the epoch
 * @throws UnsupportedOperationException if parsing is not supported
 * @throws IllegalArgumentException if the text to parse is invalid
 */
int64_t DateTimeFormatter::parseMillis(string text) {
    DateTimeParser *parser = requireParser();
    
    Chronology *chrono = selectChronology(iChrono);
    DateTimeParserBucket *bucket = new DateTimeParserBucket(0, chrono, iLocale, iPivotYear, iDefaultYear);
    int newPos = parser->parseInto(bucket, text, 0);
    if (newPos >= 0) {
        if (newPos >= text.size()) {
            return bucket->computeMillis(true, text);
        }
    } else {
        newPos = ~newPos;
    }
    throw IllegalArgumentException(FormatUtils::createErrorMessage(text, newPos));
}
开发者ID:saulpower,项目名称:CodaTime,代码行数:27,代码来源:DateTimeFormatter.cpp


示例13: throw

void
Thread::setSpecific(Key& key, void* value)
    throw (IllegalArgumentException,
           SystemException)
{
    int ret;
    ret = pthread_setspecific(key.theKey(), value);
    if(ret) {
        if(ret == EINVAL) {
            throw IllegalArgumentException("Thread::setSpecific()", ret);
        } else {
            throw SystemException("Thread::setSpecific()",ret);
        }
    }
};
开发者ID:AlvaroVega,项目名称:TIDorbC,代码行数:15,代码来源:Thread.C


示例14: IllegalArgumentException

// The API asks for rows, but we're rotated, so we return columns.
unsigned char* GreyscaleRotatedLuminanceSource::getRow(int y, unsigned char* row) {
  if (y < 0 || y >= getHeight()) {
    throw IllegalArgumentException("Requested row is outside the image: " + y);
  }
  int width = getWidth();
  if (row == NULL) {
    row = new unsigned char[width];
  }
  int offset = (left_ * dataWidth_) + (dataWidth_ - (y + top_));
  for (int x = 0; x < width; x++) {
    row[x] = greyData_[offset];
    offset += dataWidth_;
  }
  return row;
}
开发者ID:NAGAVENDRA,项目名称:GenieForiOS,代码行数:16,代码来源:GreyscaleRotatedLuminanceSource.cpp


示例15: IllegalArgumentException

bool ScriptMatchCreator::isMatchCandidate(ConstElementPtr element, const ConstOsmMapPtr& map)
{
  if (!_script)
  {
    throw IllegalArgumentException("The script must be set on the ScriptMatchCreator.");
  }
  if (!_matchCandidateChecker.get())
  {
    vector<const Match *> emptyMatches;
    _matchCandidateChecker.reset(
      new ScriptMatchVisitor(map, emptyMatches, ConstMatchThresholdPtr(), _script));
    _matchCandidateChecker->customScriptInit();
  }
  return _matchCandidateChecker->isMatchCandidate(element);
}
开发者ID:mitulvpatel,项目名称:hootenanny,代码行数:15,代码来源:ScriptMatchCreator.cpp


示例16: IllegalArgumentException

  Ref<GF256Poly> GF256::buildMonomial(int degree, int coefficient) {
#ifdef DEBUG
    cout << __FUNCTION__ << "\n";
#endif
    if (degree < 0) {
      throw IllegalArgumentException("Degree must be non-negative");
    }
    if (coefficient == 0) {
      return zero_;
    }
    int nCoefficients = degree + 1;
    ArrayRef<int> coefficients(new Array<int>(nCoefficients));
    coefficients[0] = coefficient;
    Ref<GF256Poly> result(new GF256Poly(*this, coefficients));
    return result;
  }
开发者ID:Ithoughts,项目名称:liteqr,代码行数:16,代码来源:GF256.cpp


示例17: BinaryLogarithm

            T BinaryLogarithm(T val)
            {
                if (val < 1)
                {
                    throw IllegalArgumentException(SAF_SOURCE_LOCATION, Text::String("Function not defined for numbers "
                        "smaller than 1."));
                }

                T k = 0;
                while (val >>= 1)
                {
                    ++k;
                }

                return k;
            }
开发者ID:odanek,项目名称:saf,代码行数:16,代码来源:Powers.cpp


示例18: IllegalArgumentException

unsigned int Place::consumeTokens(unsigned int nbOfTokens, unsigned int colorLabel) {
	colorLabel--;

	unsigned int time = 0;

	if (m_tokenByColor[colorLabel].size() < nbOfTokens) {
		throw IllegalArgumentException();
	} else {
		for (unsigned int i = 0; i < nbOfTokens; ++i) {
			time = m_tokenByColor[colorLabel].back().getRemainingTime();
			m_tokenByColor[colorLabel].pop_back();
		}
	}

	return time;
}
开发者ID:raphaelmarczak,项目名称:libIscore,代码行数:16,代码来源:Place.cpp


示例19: ESAPI_ASSERT2

  /**
   * Return true if specified cipher mode may be used for encryption and
   *   decryption operations via {@link org.owasp.esapi.Encryptor}.
   * @param cipherMode The specified cipher mode to be used for the encryption
   *                   or decryption operation.
   * @return true if the specified cipher mode is in the comma-separated list
   *         of cipher modes supporting both confidentiality and authenticity;
   *         otherwise false.
   * @see #isCombinedCipherMode(String)
   * @see org.owasp.esapi.SecurityConfiguration#getCombinedCipherModes()
   * @see org.owasp.esapi.SecurityConfiguration#getAdditionalAllowedCipherModes()
   */
  bool CryptoHelper::isAllowedCipherMode(const NarrowString& cipherMode)
  {
    ESAPI_ASSERT2( !cipherMode.empty(), "cipherMode is not valid" );
    if(cipherMode.empty())
      throw IllegalArgumentException("Cipher mode is not valid");

    if ( isCombinedCipherMode(cipherMode) ) { 
      return true; 
    } 

    DummyConfiguration config;
    const StringList& extraModes = config.getAdditionalAllowedCipherModes();
        
    StringList::const_iterator it = std::find(extraModes.begin(), extraModes.end(), cipherMode);
    return it != extraModes.end(); 
  }
开发者ID:dreadlock,项目名称:owasp-esapi-cplusplus,代码行数:28,代码来源:CryptoHelper.cpp


示例20: switch

int DateTimeFormat::selectStyle(char ch) {
    switch (ch) {
        case 'S':
            return SHORT;
        case 'M':
            return MEDIUM;
        case 'L':
            return LONG;
        case 'F':
            return FULL;
        case '-':
            return NONE;
        default:
            throw IllegalArgumentException("Invalid style character: " + ch);
    }
}
开发者ID:saulpower,项目名称:CodaTime,代码行数:16,代码来源:DateTimeFormat.cpp



注:本文中的IllegalArgumentException函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ImVec2函数代码示例发布时间:2022-05-30
下一篇:
C++ IfcPPException函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap