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


C++ TextOutput::popIndent方法代码示例

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


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

示例1: formatIP

void NetworkDevice::EthernetAdapter::describe(TextOutput& t) const {
    t.writeSymbol("{");
    t.pushIndent();
    t.writeNewline();
    
    t.writeSymbols("hostname", "=");
    t.writeString(hostname + ";");
    t.writeNewline();

    t.writeSymbols("name", "=");
    t.writeString(name + ";");
    t.writeNewline();    

    t.writeSymbols("ip", "=");
    t.writeSymbol("\"" + formatIP(ip) + "\";");
    t.writeNewline();    

    t.writeSymbols("subnet", "=");
    t.writeSymbol("\"" + formatIP(subnet) + "\";");
    t.writeNewline();    

    t.writeSymbols("broadcast", "=");
    t.writeSymbol("\"" + formatIP(broadcast) + "\";");
    t.writeNewline();    

    t.writeSymbols("mac", "=");
    t.writeSymbol("\"" + formatMAC(mac) + "\";");
    t.writeNewline();    

    t.popIndent();
    t.writeSymbol("};");
    t.writeNewline();
}
开发者ID:090809,项目名称:TrinityCore,代码行数:33,代码来源:NetworkDevice.cpp

示例2: describeSystem

void NetworkDevice::describeSystem(
    TextOutput& t) {

    t.writeSymbols("Network", "{");
    t.writeNewline();
    t.pushIndent();

    t.popIndent();
    t.writeSymbols("}");
    t.writeNewline();
    t.writeNewline();
}
开发者ID:luaman,项目名称:g3d-cpp,代码行数:12,代码来源:NetworkDevice.cpp

示例3: describeSystem

void NetworkDevice::describeSystem(
    TextOutput& t) {

    t.writeSymbols("Network", "=", "{");
    t.writeNewline();
    t.pushIndent();
    
    for (int i = 0; i < m_adapterArray.size(); ++i) {
        t.printf("Adapter%d =", i);
        m_adapterArray[i].describe(t);
    }

    t.popIndent();
    t.writeSymbols("};");
    t.writeNewline();
    t.writeNewline();
}
开发者ID:090809,项目名称:TrinityCore,代码行数:17,代码来源:NetworkDevice.cpp

示例4: serialize

void XML::serialize(TextOutput& t) const {
    if (m_type == VALUE) {
        // Raw string; no quotes
        t.writeSymbol(m_value);
    } else {
        t.printf("<%s", m_name.c_str());
        for (AttributeTable::Iterator it = m_attribute.begin(); it.hasMore(); ++it) {
            t.printf(" %s=\"%s\"", it->key.c_str(), it->value.m_value.c_str());
        }
        t.printf(">");
        t.writeNewline();
        t.pushIndent();
        for (int i = 0; i < m_child.size(); ++i) {
            m_child[i].serialize(t);
            if (m_child[i].m_type == VALUE) {
                // Only tags know to append a newline
                t.writeNewline();
            }
        }
        t.popIndent();
        t.printf("</%s>", m_name.c_str());
        t.writeNewline();
    }
}
开发者ID:Blumfield,项目名称:TBCPvP,代码行数:24,代码来源:XML.cpp

示例5: serialize

	// TODO: if the output will fit on one line, compress tables and arrays into a single line
	void Any::serialize(TextOutput& to) const {
		beforeRead();
		if (m_data && !m_data->comment.empty()) {
			to.printf("\n/* %s */\n", m_data->comment.c_str());
		}

		switch (m_type) {
		case NONE:
			to.writeSymbol("NONE");
			break;

		case BOOLEAN:
			to.writeBoolean(m_simpleValue.b);
			break;

		case NUMBER:
			to.writeNumber(m_simpleValue.n);
			break;

		case STRING:
			debugAssert(m_data != NULL);
			to.writeString(*(m_data->value.s));
			break;

		case TABLE: {
			debugAssert(m_data != NULL);
			if (!m_data->name.empty()) {
				if (needsQuotes(m_data->name)) {
					to.writeString(m_data->name);
				}
				else {
					to.writeSymbol(m_data->name);
				}
			}
			to.writeSymbol("{");
			to.writeNewline();
			to.pushIndent();
			AnyTable& table = *(m_data->value.t);
			Array<std::string> keys;
			table.getKeys(keys);
			keys.sort();

			for (int i = 0; i < keys.size(); ++i) {
				to.writeSymbol(keys[i]);
				to.writeSymbol("=");
				table[keys[i]].serialize(to);

				if (i < keys.size() - 1) {
					to.writeSymbol(",");
				}
				to.writeNewline();

				// Skip a line between table entries
				to.writeNewline();
			}

			to.popIndent();
			to.writeSymbol("}");
			break;
		}

		case ARRAY: {
			debugAssert(m_data != NULL);
			if (!m_data->name.empty()) {
				// For arrays, leave no trailing space between the name and the paren
				to.writeSymbol(format("%s(", m_data->name.c_str()));
			}
			else {
				to.writeSymbol("(");
			}
			to.writeNewline();
			to.pushIndent();
			Array<Any>& array = *(m_data->value.a);
			for (int ii = 0; ii < size(); ++ii) {
				array[ii].serialize(to);
				if (ii < size() - 1) {
					to.writeSymbol(",");
					to.writeNewline();
				}

				// Put the close paren on an array right behind the last element
			}
			to.popIndent();
			to.writeSymbol(")");
			break;
		}
		}
	}
开发者ID:lev1976g,项目名称:easywow,代码行数:89,代码来源:Any.cpp


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