Exemple #1
0
ParseResult NumParser::ParseRange(openpal::RSlice& buffer, Range& range, openpal::Logger* pLogger) const
{
	if (buffer.Size() < (2 * static_cast<uint32_t>(size)))
	{
		SIMPLE_LOGGER_BLOCK(pLogger, flags::WARN, "Not enough data for start / stop");
		return ParseResult::NOT_ENOUGH_DATA_FOR_RANGE;
	}
	else
	{
		range.start = this->ReadNum(buffer);
		range.stop = this->ReadNum(buffer);

		if (range.IsValid())
		{
			return ParseResult::OK;
		}
		else
		{
			FORMAT_LOGGER_BLOCK(pLogger, flags::WARN, "start (%u) > stop (%u)", range.start, range.stop);
			return ParseResult::BAD_START_STOP;
		}
	}
}
Exemple #2
0
 bool Range::Contains(const Range& range) const
 {
     return IsValid() && range.IsValid() &&
         GetMin()<=range.GetMin() && range.GetMax()<=GetMax();
 }
Exemple #3
0
 bool Range::Intersects(const Range& range) const
 {
     return IsValid() && range.IsValid() &&
         !(range.GetMax()<GetMin() || range.GetMin()>=GetMax());
 }