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


C++ streambuf::sputc方法代码示例

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


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

示例1:

	std::streambuf::int_type Indenter::operator()(std::streambuf &destination,
	                                              std::streambuf::int_type character) {
		std::streambuf::char_type tmpChar = std::streambuf::traits_type::to_char_type(character);

		if (atStartOfLine && tmpChar != Whitespace::NEW_LINE) {
			destination.sputc(Whitespace::HORIZONTAL_TAB);
		}

		atStartOfLine = (tmpChar == Whitespace::NEW_LINE);
		return destination.sputc(tmpChar);
	}
开发者ID:57-Wolve,项目名称:NodeManager,代码行数:11,代码来源:Indenter.cpp

示例2: if

	std::streambuf::int_type SolidusEscaper::operator()(std::streambuf &destination,
	                                                    std::streambuf::int_type character) {
		bool notEscaped = true;
		std::streambuf::char_type tmpChar = std::streambuf::traits_type::to_char_type(character);

		// If we encounter a quotation mark.
		if (tmpChar == Strings::Json::Escape::QUOTATION_MARK) {
			// If we're not in a string, we change that. If we're in a string,
			// we change that only if we're not after an escape back slash.
			inString = !inString || (afterBackSlash);

		} else if (inString && !afterBackSlash) {
			// If we are in a string definition and we're not after a backslash
			// escape.
			if (tmpChar == Strings::Std::SOLIDUS) {
				destination.sputn(Strings::Json::SOLIDUS.c_str(), Strings::Json::SOLIDUS.size());
				notEscaped = false;

			}

		}

		// We determine if we start a backslash escape or not.
		afterBackSlash = inString && !afterBackSlash && (tmpChar == Strings::Json::Escape::BEGIN_ESCAPE);
		return (notEscaped) ? (destination.sputc(tmpChar)) : (0);
	}
开发者ID:edison9888,项目名称:__graduation_project,代码行数:26,代码来源:SolidusEscaper.cpp

示例3: operator

 int operator()(std::streambuf& sbuf, int c)
 {
     int result = eof();
     if (c != eof() && new_line)
     {
         std::ostream(&sbuf) << ++line_number << ": ";
     }
     new_line = (c == '\n');
     
     return result != eof() ? result : sbuf.sputc(c);
 }
开发者ID:CCJY,项目名称:coliru,代码行数:11,代码来源:main.cpp

示例4: tmp

	std::streambuf::int_type Escaper::operator()(std::streambuf &destination,
	                                             std::streambuf::int_type character) {
		bool notEscaped = true;
		std::streambuf::char_type tmpChar = std::streambuf::traits_type::to_char_type(character);

		// If we encounter a quotation mark.
		if (tmpChar == Structural::BEGIN_END_STRING) {
			// If we're not in a string, we change that. If we're in a string,
			// we change that only if we're not after an escape back slash.
			inString = !inString || (afterBackSlash);

		} else if (inString && !afterBackSlash) {
			// If we are in a string definition and we're not after a backslash
			// escape.
			if (tmpChar == Strings::Std::REVERSE_SOLIDUS) {
				destination.sputn(Strings::Json::REVERSE_SOLIDUS.c_str(), Strings::Json::REVERSE_SOLIDUS.size());
				notEscaped = false;

			} else if (tmpChar == Strings::Std::BACKSPACE) {
				destination.sputn(Strings::Json::BACKSPACE.c_str(), Strings::Json::BACKSPACE.size());
				notEscaped = false;

			} else if (tmpChar == Strings::Std::FORM_FEED) {
				destination.sputn(Strings::Json::FORM_FEED.c_str(), Strings::Json::FORM_FEED.size());
				notEscaped = false;

			} else if (tmpChar == Strings::Std::LINE_FEED) {
				destination.sputn(Strings::Json::LINE_FEED.c_str(), Strings::Json::LINE_FEED.size());
				notEscaped = false;

			} else if (tmpChar == Strings::Std::TAB) {
				destination.sputn(Strings::Json::TAB.c_str(), Strings::Json::TAB.size());
				notEscaped = false;

			} else if (tmpChar >= '\0' && tmpChar <= '\x1f') {
				std::string tmp(Value::escapeToUnicode(tmpChar));
				destination.sputn(tmp.c_str(), tmp.size());
				notEscaped = false;
			}

		}

		// We determine if we start a backslash escape or not.
		afterBackSlash = inString && !afterBackSlash && (tmpChar == Strings::Json::Escape::BEGIN_ESCAPE);
		return (notEscaped) ? (destination.sputc(tmpChar)) : (0);
	}
开发者ID:BetaS,项目名称:cocos2d-x,代码行数:46,代码来源:Escaper.cpp

示例5:

	std::streambuf::int_type IndentCanceller::operator()(std::streambuf &destination,
	                                                     std::streambuf::int_type character) {
		std::streambuf::char_type tmpChar = std::streambuf::traits_type::to_char_type(character);

		// If we encounter a quotation mark.
		if (tmpChar == Structural::BEGIN_END_STRING) {
			// If we're not in a string, we change that. If we're in a string,
			// we change that only if we're not after an escape back slash.
			inString = !inString || (afterBackSlash);
		}

		// We determine if we start a backslash escape or not.
		afterBackSlash = inString && !afterBackSlash && (tmpChar == Strings::Json::Escape::BEGIN_ESCAPE);

		return (tmpChar != Whitespace::NEW_LINE && tmpChar != Whitespace::HORIZONTAL_TAB && tmpChar != Whitespace::CARRIAGE_RETURN && (inString || tmpChar != Whitespace::SPACE)) ? (destination.sputc(tmpChar)) : (0);
	}
开发者ID:LitQoo,项目名称:SportsWorldCupOriginal,代码行数:16,代码来源:IndentCanceller.cpp


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