本文整理汇总了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");
}
}
示例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");
}
}
示例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");
}
}
示例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);
}
}
示例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.");
}
示例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;
}
示例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;
}
示例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];
}
示例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);
}
示例10: InvalidArgumentException
AppearanceDataIC ICAAMModel::getModel(int scale) const
{
if (scale < 0 || scale >= this->modelData.size())
{
throw InvalidArgumentException();
}
return this->modelData[scale];
}
示例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.");
}
示例12: InvalidArgumentException
DynamicAny DynamicAny::operator -- (int)
{
if (!isInteger())
throw InvalidArgumentException("Invalid operation for this data type.");
DynamicAny tmp(*this);
*this -= 1;
return tmp;
}
示例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;
}
示例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.");
}
}
}
示例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.");
}
}