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


C++ printIndent函数代码示例

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


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

示例1: printIndent

void SParts::dumpODEInfo(int level)
{
	printIndent(level);
	printf("*** %s ***\n", m_name.c_str());

	printIndent(level+1);
	printf("m_odeobj=(0x%0p)\n", m_odeobj);
	if (!m_odeobj) printf("+++++ ERROR! m_odeobj=NULL! +++++\n");

	const dReal *pos = getPosition();
	printIndent(level+1);
	printf("pos=(%f, %f, %f)\n", pos[0], pos[1], pos[2]);

	const dReal *q = getQuaternion();
	printIndent(level+1);
	printf("q=(%f, %f, %f, %f)\n", q[0], q[1], q[2], q[3]);

	ChildC::iterator i;
	for (i=m_children.begin(); i!=m_children.end(); i++) {
		Child *c = *i;
		if (c) {
			SParts *childP = c->nextp;
			if (childP) childP->dumpODEInfo(level+2);
		}
	}
}
开发者ID:SIGVerse,项目名称:SIGServer,代码行数:26,代码来源:SParts.cpp

示例2: serialize

	virtual void serialize(std::stringstream& ss, size_t indentLevel) const
	{	
		ss << "[";
		if (indentLevel > 0)
		{
			ss << "\n";
		}
		else
		{
			printIndent(ss, indentLevel);
		}

		for (size_t i=1; i < data.size(); ++i)
		{
			printIndent(ss, indentLevel+1);
			data[i-1]->serialize(ss, indentLevel+1);
			ss << ",\n";
		}
		if (data.size() > 0)
		{
			printIndent(ss, indentLevel+1);
			data[size() - 1]->serialize(ss, indentLevel+1);
		}

		ss << "\n";
		printIndent(ss, indentLevel);
		ss << "]";
	}
开发者ID:wallace-luo,项目名称:EasyJson,代码行数:28,代码来源:EasyJson.cpp

示例3: printIndent

bool ASTPrintVisitor::visit_while(AST_While* node) {
    stream << "while ";
    node->test->accept(this);
    stream << "\n";

    indent += 4;
    for (int i = 0; i < node->body.size(); i++) {
        printIndent();
        node->body[i]->accept(this);
        stream << "\n";
    }
    indent -= 4;

    if (node->orelse.size()) {
        printIndent();
        stream << "else\n";
        indent += 4;
        for (int i = 0; i < node->orelse.size(); i++) {
            printIndent();
            node->orelse[i]->accept(this);
            stream << "\n";
        }
        indent -= 4;
    }
    return true;
}
开发者ID:Daetalus,项目名称:pyston,代码行数:26,代码来源:ast.cpp

示例4: serialize

	virtual void serialize(std::stringstream& ss, size_t indentLevel) const
	{
		if (indentLevel > 0)
		{
			ss << "\n";
		}
		printIndent(ss, indentLevel);
		ss << "{\n";
		for (auto i = data.begin(); i < data.end() - 1; ++i)
		{
			printIndent(ss, indentLevel + 1);
			ss << '"' << i->first.asSTLString() << "\" : ";
			i->second->serialize(ss, indentLevel + 1);
			ss << ",\n";
		}
		if (data.size() > 0)
		{
			auto last = data.end() - 1;
			printIndent(ss, indentLevel + 1);
			ss << '"' << last->first.asSTLString() << "\" : ";
			last->second->serialize(ss, indentLevel + 1);
		}
		ss << "\n";
		printIndent(ss, indentLevel);
		ss << "}";
	}
开发者ID:heleifz,项目名称:EzJson,代码行数:26,代码来源:ezjson.cpp

示例5: printTerm

/** Print the alternatives of a @a Term
	@param term The @a Term to print
*/
static void printTerm(Term *term) {
	int i;
	Alternative *alternative;
	for (i = 0; i < listSize(term->rule); i++) {
		alternative = (Alternative *) listIndex(term->rule, i);
		if (listSize(term->rule) != 1)
			printSet("Alternative on", alternative->first);
		if (alternative->flags & ALTERNATIVE_PREFER) {
			printIndent();
			fputs("%prefer\n", printRuleOutput);
		}
		if (alternative->flags & ALTERNATIVE_AVOID) {
			printIndent();
			fputs("%avoid\n", printRuleOutput);
		}
		if (alternative->flags & ALTERNATIVE_IF) {
			printIndent();
			fprintf(printRuleOutput, "%%if %s\n", alternative->expression->text);
		}
		if (alternative->flags & ALTERNATIVE_DEFAULT && listSize(term->rule) != 1) {
			printIndent();
			fputs("%default\n", printRuleOutput);
		}
	
		printAlternative(alternative);
		if (i < listSize(term->rule) - 1) {
			indent--;
			printIndent();
			fputs("|\n", printRuleOutput);
			indent++;
		}
	}
}
开发者ID:guilhermealles,项目名称:cclabs,代码行数:36,代码来源:printInput.c

示例6: printOutAlias

static void printOutAlias(FILE *out,  UConverter *converter, UResourceBundle *parent, Resource r, const char *key, int32_t indent, const char *pname, UErrorCode *status) {
    static const UChar cr[] = { '\n' };
    int32_t len = 0;
    const UChar* thestr = derb_getString(&(parent->fResData), r, &len);
    UChar *string = quotedString(thestr);
    if(trunc && len > truncsize) {
        char msg[128];
        printIndent(out, converter, indent);
        sprintf(msg, "// WARNING: this resource, size %li is truncated to %li\n",
            (long)len, (long)truncsize/2);
        printCString(out, converter, msg, -1);
        len = truncsize;
    }
    if(U_SUCCESS(*status)) {
        static const UChar openStr[] = { 0x003A, 0x0061, 0x006C, 0x0069, 0x0061, 0x0073, 0x0020, 0x007B, 0x0020, 0x0022 }; /* ":alias { \"" */
        static const UChar closeStr[] = { 0x0022, 0x0020, 0x007D, 0x0020 }; /* "\" } " */
        printIndent(out, converter, indent);
        if(key != NULL) {
            printCString(out, converter, key, -1);
        }
        printString(out, converter, openStr, (int32_t)(sizeof(openStr) / sizeof(*openStr)));
        printString(out, converter, string, len);
        printString(out, converter, closeStr, (int32_t)(sizeof(closeStr) / sizeof(*closeStr)));
        if(verbose) {
            printCString(out, converter, " // ALIAS", -1);
        }
        printString(out, converter, cr, (int32_t)(sizeof(cr) / sizeof(*cr)));
    } else {
        reportError(pname, status, "getting binary value");
    }
    uprv_free(string);
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:32,代码来源:derb.c

示例7: builtin_include

OBJ
builtin_include(int numArgs){

	if( numArgs != 1){
		js_error("(include): expects 1 argument", js_nil);
	}
	OBJ arg1 = POP();
	char *fileName;
	FILE *theFile;

	if( !ISSTRING(arg1) ){
		js_error("(include): string arg expected:", arg1);
	}
	fileName = STRINGVAL(arg1);
	theFile = fopen(fileName, "r");
	if( theFile == NULL){
		js_error("(include): cannot open file:", arg1); 	
	}

	OBJ inputStream = newFileStream(theFile);

#ifdef DEBUG
	if( PRINT_INCLUDE->state){
		printIndent(indentLevelForInclude);
	       	fprintf(stdout, "<include file:" YEL " %s" RESET" >\n", fileName);
		indentLevelForInclude++;
	}
	if( CONTINUATION_PASSING->state){
		enterTrampoline1(inputStream);
	} 
	else{
		OBJ expr = js_read(inputStream);
		OBJ result;

		while( expr != js_eof){	
			result = js_eval(globalEnvironment, expr);
			if(PRINT_INCLUDE->state){
				printIndent(indentLevelForInclude);
				js_print(stdout, result,1);
				printf("\n");
			}
			expr = js_read(inputStream);
		}
	}
	if( PRINT_INCLUDE->state){
		indentLevelForInclude--;
		printIndent(indentLevelForInclude);
	       	fprintf(stdout, "<EOF:" YEL " %s" RESET" >\n", fileName);
	}
#else
	enterTrampoline1(inputStream);
#endif
	fclose( inputStream->u.fileStream.file );
	free( inputStream);
	
	return js_void;
}
开发者ID:JohannesTheo,项目名称:JScheme,代码行数:57,代码来源:builtinFunctions.c

示例8: peekUint8

void Script_v6::o6_assign(FuncParams &params) {
	uint8 type = peekUint8();
	uint16 var_0, var_4;
	std::string varIndex = readVarIndex(&var_0, &var_4);

	if (var_0 != 0) {
		std::string varIndex2;
		uint16 var_6;

		uint32 savedPos = getPos();

		varIndex2 = readVarIndex(&var_6, 0);

		printIndent();
		print("memcpy(%s, %s, %d);\n", varIndex.c_str(), varIndex2.c_str(), var_6 * 4);

		seek(savedPos);
		skipExpr(99);

		return;
	}

	if (peekUint8() == 98) {
		skip(1);
		uint8 loopCount = readUint8();

		uint32 off = 0;
		for (uint16 i = 0; i < loopCount; i++) {
			uint8 c = readUint8();
			uint16 n = readUint16();

			printIndent();
			print("memset(%s + %d, %d, %d);\n", varIndex.c_str(), off, c, n);

			off += n;
		}
	} else if (peekUint8() == 99) {
		skip(1);
		uint8 loopCount = readUint8();

		for (uint16 i = 0; i < loopCount; i++) {
			std::string expr = readExpr();
			printIndent();
			print("%s[%d] = %s;\n", varIndex.c_str(), (type == 24) ? (i * 2) : i, expr.c_str());
		}
	} else {
		std::string expr = readExpr();

		printIndent();
		print("%s = %s;\n", varIndex.c_str(), expr.c_str());
	}
}
开发者ID:CobaltBlues,项目名称:scummvm-tools,代码行数:52,代码来源:degob_script_v6.cpp

示例9: printIndent

void space::print() {
  printIndent();
  lprintf("%4s: oops: 0x%-6lx -> 0x%-6lx; used: %ld bytes\n",
         name, objs_bottom, objs_top,
         (char*) objs_top - (char*) objs_bottom);
  printIndent();
  lprintf("     bytes: 0x%-6lx -> 0x%-6lx; used: %ld bytes\n",
         bytes_bottom, bytes_top,
         (char*) bytes_top - (char*) bytes_bottom);
  printIndent();
  lprintf("     total: used: %ld bytes; free: %ld bytes\n",
         used(), bytes_free());
}
开发者ID:ardeujho,项目名称:self,代码行数:13,代码来源:space.cpp

示例10: printFrames

static void printFrames(const WebCore::Frame& frame, const WebCore::Frame* targetFrame, int indent)
{
    if (&frame == targetFrame) {
        printf("--> ");
        printIndent(indent - 1);
    } else
        printIndent(indent);

    WebCore::FrameView* view = frame.view();
    printf("Frame %p %dx%d\n", &frame, view ? view->width() : 0, view ? view->height() : 0);
    printIndent(indent);
    printf("  ownerElement=%p\n", frame.ownerElement());
    printIndent(indent);
    printf("  frameView=%p (needs layout %d)\n", view, view ? view->needsLayout() : false);
    printIndent(indent);
    printf("  renderView=%p\n", view ? view->renderView() : nullptr);
    printIndent(indent);
    printf("  ownerRenderer=%p\n", frame.ownerRenderer());
    printIndent(indent);
    printf("  document=%p (needs style recalc %d)\n", frame.document(), frame.document() ? frame.document()->childNeedsStyleRecalc() : false);
    printIndent(indent);
    printf("  uri=%s\n", frame.document()->documentURI().utf8().data());

    for (WebCore::Frame* child = frame.tree().firstChild(); child; child = child->tree().nextSibling())
        printFrames(*child, targetFrame, indent + 1);
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:26,代码来源:FrameTree.cpp

示例11: printAlternative

/** Print the parts of an @a Alternative
	@param alternative The @a Alternative to print

	Note: actions are printed only as {...}
*/
static void printAlternative(Alternative *alternative) {
	GrammarPart *grammarPart;
	int i;
	
	for (i = 0; i < listSize(alternative->parts); i++) {
		grammarPart = (GrammarPart *) listIndex(alternative->parts, i);
		printIndent();
		switch (grammarPart->subtype) {
			case PART_ACTION:
				fputs("{...}", printRuleOutput);
				break;
			case PART_TERMINAL:
			case PART_LITERAL:
				fputs(grammarPart->token->text, printRuleOutput);
				break;
			case PART_NONTERMINAL:
			case PART_UNDETERMINED:
				fputs(grammarPart->token->text, printRuleOutput);
				break;
			case PART_TERM:
				fputs("[\n", printRuleOutput);
				/* Only print the sets for repeating terms */
				if (!(grammarPart->uTerm.repeats.subtype == FIXED && grammarPart->uTerm.repeats.number == 1)) {
					printSet("First-set", grammarPart->uTerm.first);
					printSet("Contains-set", grammarPart->uTerm.contains);
					printSet("Follow-set", grammarPart->uTerm.follow);
				}
				indent++;
				if (grammarPart->uTerm.flags & TERM_WHILE) {
					printIndent();
					fprintf(printRuleOutput, "%%while %s\n", grammarPart->uTerm.expression->text);
				}
				if (grammarPart->uTerm.flags & TERM_PERSISTENT) {
					printIndent();
					fputs("%persistent\n", printRuleOutput);
				}
				printTerm(&grammarPart->uTerm);
				indent--;
				printIndent();
				fputc(']', printRuleOutput);
				printRepeats(grammarPart->uTerm.repeats);
				break;
			default:
				PANIC();
		}
		fputc('\n', printRuleOutput);
	}
}
开发者ID:guilhermealles,项目名称:cclabs,代码行数:53,代码来源:printInput.c

示例12: printIndent

void ExprFromBool::PrintDebug(int level) {
   printIndent(level);
   if(m_value)
      std::cout << "True";
   else
      std::cout << "False";
}
开发者ID:ismaelbelghiti,项目名称:MetaCode,代码行数:7,代码来源:Expression.cpp

示例13: printIndent

void realSlotRef::print() {
  holder->print();
  printIndent();
  lprintf("desc: 0x%lx (", desc);
  desc->name->string_print();
  lprintf(")\n");
}
开发者ID:ardeujho,项目名称:self,代码行数:7,代码来源:slotRef.cpp

示例14: printIndent

void ScopedLogger::indent()
{
    if (m_parent) {
        m_parent->indent();
        printIndent();
    }
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:7,代码来源:Assertions.cpp

示例15: printIndent

void PrintingContext::print (const char *name, dReal x)
{
    printIndent();
    fprintf (file,"%s = ",name);
    printReal (x);
    fprintf (file,",\n");
}
开发者ID:Yanzqing,项目名称:BHumanCodeRelease,代码行数:7,代码来源:export-dif.cpp


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