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


C++ ErrorHandler::prematureEnd方法代码示例

本文整理汇总了C++中ErrorHandler::prematureEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ ErrorHandler::prematureEnd方法的具体用法?C++ ErrorHandler::prematureEnd怎么用?C++ ErrorHandler::prematureEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ErrorHandler的用法示例。


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

示例1: parseObject

	inline Iterator parseObject(Iterator begin, Iterator end, ObjectBodyParser objectBodyParser, ErrorHandler &errorHandler)
	{
		Iterator i = skipLeadingSpaces<spacePolicy>(begin, end);
		if (unlikely(i == end)) {
			goto prematureEnd;
		}
		if (unlikely(*i != u8"{"[0])) {
			goto malformedJson;
		}

		i = objectBodyParser(++i, end, errorHandler);
		if (unlikely(!errorHandler.valid())) {
			return end;
		}
		if (unlikely(i == end)) {
			goto prematureEnd;
		}
		if (unlikely(*i != u8"}"[0])) {
			goto malformedJson;
		}
		return skipTrailingSpaces<spacePolicy>(++i, end);
	prematureEnd:
		errorHandler.prematureEnd();
		return end;
	malformedJson:
		errorHandler.malformedJson(i);
		return end;
	}
开发者ID:dzidzitop,项目名称:libafc,代码行数:28,代码来源:json.hpp

示例2: parseComma

	inline Iterator parseComma(Iterator begin, Iterator end, ErrorHandler &errorHandler)
	{
		Iterator i = skipLeadingSpaces<spacePolicy>(begin, end);
		if (unlikely(i == end)) {
			errorHandler.prematureEnd();
			return end;
		}
		if (unlikely(*i != u8","[0])) {
			errorHandler.malformedJson(i);
			return i;
		}
		return skipTrailingSpaces<spacePolicy>(++i, end);
	}
开发者ID:dzidzitop,项目名称:libafc,代码行数:13,代码来源:json.hpp

示例3: if

	inline typename std::enable_if<!_impl::isRandomAccessIterator<Iterator>(), Iterator>::type
	parseBoolean(Iterator begin, Iterator end, bool &dest, ErrorHandler &errorHandler)
	{
		Iterator i = skipLeadingSpaces<spacePolicy>(begin, end);

		char c;

		if (unlikely(i == end)) {
			goto prematureEnd;
		}

		c = *i;
		if (c == u8"t"[0]) {
			if (unlikely(++i == end)) goto prematureEnd;
			if (unlikely(*i != u8"r"[0])) goto malformedJson;
			if (unlikely(++i == end)) goto prematureEnd;
			if (unlikely(*i != u8"u"[0])) goto malformedJson;
			if (unlikely(++i == end)) goto prematureEnd;
			if (unlikely(*i != u8"e"[0])) goto malformedJson;
			dest = true;
		} else if (c == u8"f"[0]) {
			if (unlikely(++i == end)) goto prematureEnd;
			if (unlikely(*i != u8"a"[0])) goto malformedJson;
			if (unlikely(++i == end)) goto prematureEnd;
			if (unlikely(*i != u8"l"[0])) goto malformedJson;
			if (unlikely(++i == end)) goto prematureEnd;
			if (unlikely(*i != u8"s"[0])) goto malformedJson;
			if (unlikely(++i == end)) goto prematureEnd;
			if (unlikely(*i != u8"e"[0])) goto malformedJson;
			dest = false;
		} else {
			goto malformedJson;
		}

		return skipTrailingSpaces<spacePolicy>(++i, end);
	prematureEnd:
		errorHandler.prematureEnd();
		return end;
	malformedJson:
		errorHandler.malformedJson(i);
		return end;
	}
开发者ID:dzidzitop,项目名称:libafc,代码行数:42,代码来源:json.hpp

示例4: parseArray

	inline Iterator parseArray(Iterator begin, Iterator end, ArrayElementParser arrayElementParser, ErrorHandler &errorHandler)
	{
		Iterator i = skipLeadingSpaces<spacePolicy>(begin, end);
		if (unlikely(i == end)) {
			goto prematureEnd;
		}
		if (unlikely(*i != u8"["[0])) {
			goto malformedJson;
		}
		if (unlikely(++i == end)) {
			goto prematureEnd;
		}
		if (*i == u8"]"[0]) {
			return skipTrailingSpaces<spacePolicy>(++i, end);
		}

		for (;;) {
			i = arrayElementParser(i, end, errorHandler);
			if (unlikely(!errorHandler.valid())) {
				return end;
			}
			if (unlikely(i == end)) {
				goto prematureEnd;
			}
			const char c = *i;

			if (c == u8"]"[0]) {
				return skipTrailingSpaces<spacePolicy>(++i, end);
			}
			if (likely(c == u8","[0])) {
				++i;
			} else {
				goto malformedJson;
			}
		}
	prematureEnd:
		errorHandler.prematureEnd();
		return end;
	malformedJson:
		errorHandler.malformedJson(i);
		return end;
	}
开发者ID:dzidzitop,项目名称:libafc,代码行数:42,代码来源:json.hpp


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