当前位置: 首页>>代码示例>>C++>>正文


C++ InvalidArgumentException函数代码示例

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


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

示例1: Vector3f

 bool Vector3f::AnyGreaterEqual(const Vector3f& other, F32 epsilon /*= Epsilon*/) const {
     if (epsilon >= 0.0f) {
         Vector3f temp = other - Vector3f(epsilon);
         return temp.x >= epsilon || temp.y >= epsilon || temp.z >= epsilon;
     } else {
         throw InvalidArgumentException("epsilon");
     }
 }
开发者ID:panmar,项目名称:pg3,代码行数:8,代码来源:Vector.cpp

示例2: InvalidArgumentException

 bool Vector2f::AnyLess(const Vector2f& other, F32 epsilon /*= Epsilon*/) const {
     if (epsilon >= 0.0f) {
         Vector2f temp = other + epsilon;
         return x < temp.x || y < temp.y;
     } else {
         throw InvalidArgumentException("epsilon");
     }
 }
开发者ID:panmar,项目名称:pg3,代码行数:8,代码来源:Vector.cpp

示例3: Abs

 bool Vector3f::AllEqual(const Vector3f& other, F32 epsilon /*= Epsilon*/) const {
     if (epsilon >= 0.0f) {
         Vector3f diff = Abs(*this - other);
         return (diff.x <= epsilon && diff.y <= epsilon && diff.z <= epsilon);
     } else {
         throw InvalidArgumentException("epsilon");
     }
 }
开发者ID:panmar,项目名称:pg3,代码行数:8,代码来源:Vector.cpp

示例4: format

void BoundingSphere::SetRadius(F32 radius) {
    if (radius > 0.0f) {
        this->radius = radius;
    } else {
        string message = format("Invalid radius value '%f'", radius);
        throw InvalidArgumentException(message);
    }
}
开发者ID:panmar,项目名称:pg3,代码行数:8,代码来源:BoundingVolumes.cpp

示例5: switch

void SerialConfigImpl::setParityImpl(SerialConfigImpl::ParityImpl parity)
{
	switch (parity)
	{
	case PARITY_NONE_IMPL:
		return setParityCharImpl('N');
	case PARITY_ODD_IMPL:
		return setParityCharImpl('O');
	case PARITY_EVEN_IMPL:
		return setParityCharImpl('E');
	case PARITY_MARK_IMPL:
	default:
		throw InvalidArgumentException();
	}

	throw InvalidArgumentException("Wrong parity.");
}
开发者ID:RangelReale,项目名称:sandbox,代码行数:17,代码来源:SerialConfig_POSIX.cpp

示例6: InvalidArgumentException

RawSocket& RawSocket::operator = (const Socket& socket)
{
	if (dynamic_cast<RawSocketImpl*>(socket.impl()))
		Socket::operator = (socket);
	else
		throw InvalidArgumentException("Cannot assign incompatible socket");
	return *this;
}
开发者ID:BrianHoldsworth,项目名称:Poco,代码行数:8,代码来源:RawSocket.cpp

示例7: while

void FileChannel::setPurgeAge(const std::string& age)
{
	delete _pPurgeStrategy;
	_pPurgeStrategy = 0;
	_purgeAge = "none";
	if (age.empty() || 0 == icompare(age, "none"))
		return;

	std::string::const_iterator it = age.begin();
	std::string::const_iterator end = age.end();

	int n = 0;
	while (it != end && Ascii::isSpace(*it))
		++it;
	while (it != end && Ascii::isDigit(*it))
	{
		n *= 10;
		n += *it++ - '0';
	}
	while (it != end && Ascii::isSpace(*it))
		++it;
	std::string unit;
	while (it != end && Ascii::isAlpha(*it))
		unit += *it++;
	
	Timespan::TimeDiff factor = Timespan::SECONDS;
	if (unit == "minutes")
		factor = Timespan::MINUTES;
	else if (unit == "hours")
		factor = Timespan::HOURS;
	else if (unit == "days")
		factor = Timespan::DAYS;
	else if (unit == "weeks")
		factor = 7*Timespan::DAYS;
	else if (unit == "months")
		factor = 30 * Timespan::DAYS;
	else if (unit != "seconds")
		throw InvalidArgumentException("purgeAge", age);

	if (0 == n)
		throw InvalidArgumentException("Zero is not valid purge age.");

	_pPurgeStrategy = new PurgeByAgeStrategy(Timespan(factor * n));
	_purgeAge = age;
}
开发者ID:RageStormers,项目名称:poco,代码行数:45,代码来源:FileChannel.cpp

示例8: InvalidArgumentException

int ICMPEventArgs::replyTime(int index) const
{
	if (0 == _rtt.size()) 
		throw InvalidArgumentException("Supplied index exceeds array capacity.");

	if (-1 == index) index = _sent - 1;

	return _rtt[index];
}
开发者ID:carvalhomb,项目名称:tsmells,代码行数:9,代码来源:ICMPEventArgs.cpp

示例9: InvalidArgumentException

String StringUtil::Translate(CStrRef input, CStrRef from, CStrRef to) {
  if (input.empty()) return input;

  if (from.empty()) {
    throw InvalidArgumentException("from", "(empty)");
  }
  if (from.size() != to.size()) {
    throw InvalidArgumentException("from and to", "(different sizes)");
  }

  int len = input.size();
  char *ret = (char *)malloc(len + 1);
  memcpy(ret, input, len);
  ret[len] = '\0';

  string_translate(ret, len, from, to, from.size());
  return String(ret, len, AttachString);
}
开发者ID:Neomeng,项目名称:hiphop-php,代码行数:18,代码来源:string_util.cpp

示例10: InvalidArgumentException

    AppearanceDataIC ICAAMModel::getModel(int scale) const
    {
        if (scale < 0 || scale >= this->modelData.size())
        {
            throw InvalidArgumentException();
        }

        return this->modelData[scale];
    }
开发者ID:coolbatch,项目名称:AAMToolbox,代码行数:9,代码来源:ICAAMModel.cpp

示例11: _source

Query::Query(const Var& source): _source(source)
{
	if (!source.isEmpty() &&
		source.type() != typeid(Object) &&
		source.type() != typeid(Object::Ptr) &&
		source.type() != typeid(Array) &&
		source.type() != typeid(Array::Ptr))
		throw InvalidArgumentException("Only JSON Object, Array or pointers thereof allowed.");
}
开发者ID:Mobiletainment,项目名称:Multiplayer-Network-Conecpts,代码行数:9,代码来源:Query.cpp

示例12: InvalidArgumentException

DynamicAny DynamicAny::operator -- (int)
{
	if (!isInteger())
		throw InvalidArgumentException("Invalid operation for this data type.");

	DynamicAny tmp(*this);
	*this -= 1;
	return tmp;
}
开发者ID:carvalhomb,项目名称:tsmells,代码行数:9,代码来源:DynamicAny.cpp

示例13: InvalidAccessException

int SerialChannelImpl::readImpl(char*& pBuffer)
{
	if (!_pConfig->getUseEOFImpl())
		throw InvalidAccessException();

	int bufSize = _pConfig->getBufferSizeImpl();
	int it = 1;

	if ((0 == bufSize) || (0 != pBuffer))
		throw InvalidArgumentException();

	std::string buffer;
	DWORD read = 0;
	DWORD readCount = 0;

	pBuffer = static_cast<char*>(std::calloc(bufSize, sizeof(char)));//! freed in parent call

	do
    {
		if (_leftOver.size())
		{
			read = _leftOver.size() > bufSize - readCount ? bufSize - readCount : _leftOver.size();
			std::memcpy(pBuffer + readCount, _leftOver.data(), read);
			if (read == _leftOver.size())
				_leftOver.clear();
			else
				_leftOver.assign(_leftOver, read, _leftOver.size() - read);
		}
		else
		{
			if (!ReadFile(_handle, pBuffer + readCount, bufSize - readCount, &read, NULL)) 
				handleError(_pConfig->name());
			else if (0 == read) break;
		}

		poco_assert (read <= bufSize - readCount);
		
		buffer.assign(static_cast<char*>(pBuffer + readCount), read);
		size_t pos = buffer.find(_pConfig->getEOFCharImpl());
		if (pos != buffer.npos)
		{
			readCount += static_cast<DWORD>(pos);
			PurgeComm(_handle, PURGE_RXCLEAR);
			_leftOver.assign(buffer, pos + 1, buffer.size() - pos - 1);
			break;
		}

		readCount += read;
		if (readCount >= bufSize)
		{
			bufSize *= ++it;
			pBuffer = static_cast<char*>(std::realloc(pBuffer, bufSize * sizeof(char)));
		}
	}while(true);

	return readCount;
}
开发者ID:RangelReale,项目名称:sandbox,代码行数:57,代码来源:SerialChannel_WIN32.cpp

示例14: switch

void Preparator::freeMemory() const
{
	IndexMap::iterator it = _varLengthArrays.begin();
	IndexMap::iterator end = _varLengthArrays.end();
	for (; it != end; ++it)
	{
		switch (it->second)
		{
			case DT_BOOL:
				deleteCachedArray<bool>(it->first);
				break;

			case DT_CHAR:
				deleteCachedArray<char>(it->first);
				break;

			case DT_WCHAR:
				deleteCachedArray<UTF16String>(it->first);
				break;

			case DT_UCHAR:
				deleteCachedArray<unsigned char>(it->first);
				break;

			case DT_CHAR_ARRAY:
			{
				char** pc = AnyCast<char*>(&_values[it->first]);
				if (pc) std::free(*pc);
				break;
			}

			case DT_WCHAR_ARRAY:
			{
				UTF16String::value_type** pc = AnyCast<UTF16String::value_type*>(&_values[it->first]);
				if (pc) std::free(*pc);
				break;
			}

			case DT_UCHAR_ARRAY:
			{
				unsigned char** pc = AnyCast<unsigned char*>(&_values[it->first]);
				if (pc) std::free(*pc);
				break;
			}

			case DT_BOOL_ARRAY:
			{
				bool** pb = AnyCast<bool*>(&_values[it->first]);
				if (pb) std::free(*pb);
				break;
			}

			default:
				throw InvalidArgumentException("Unknown data type.");
		}
	}
}
开发者ID:12307,项目名称:poco,代码行数:57,代码来源:Preparator.cpp

示例15: InvalidArgumentException

const Any& GraphicsEngine::GetEnvVariable(const std::string& name) {
	auto it = m_envVariables.find(name);
	if (it != m_envVariables.end()) {
		return it->second;
	}
	else {
		throw InvalidArgumentException("Environment variable does not exist.");
	}
}
开发者ID:petiaccja,项目名称:Inline-Engine,代码行数:9,代码来源:GraphicsEngine.cpp


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