Пример #1
0
/** Lists the bus configuration.
 */
void CommandConfig::execute(const StringVector &args)
{
    MasterIndexList masterIndices;
    bool doIndent;
    ConfigList configs;

    if (args.size()) {
        stringstream err;
        err << "'" << getName() << "' takes no arguments!";
        throwInvalidUsageException(err);
    }

    masterIndices = getMasterIndices();
    doIndent = masterIndices.size() > 1;
    MasterIndexList::const_iterator mi;
    for (mi = masterIndices.begin();
            mi != masterIndices.end(); mi++) {
        MasterDevice m(*mi);
        m.open(MasterDevice::Read);
        configs = selectedConfigs(m);

        if (configs.size() && doIndent) {
            cout << "Master" << dec << m.getIndex() << endl;
        }

        if (getVerbosity() == Verbose) {
            showDetailedConfigs(m, configs, doIndent);
        } else {
            listConfigs(m, configs, doIndent);
        }
    }
}
Пример #2
0
void Config::print(ostream &os)
{
	ConfigList children = getChildren();

	if (getLevel() == 0) {
		ConfigList::const_iterator iter = children.begin();
		for (; iter != children.end(); ++iter) (*iter)->print(os);
		os << endl;
	}
	else {
		if (children.size() == 0) {
			for (int i = 1; i < getLevel(); ++i) os << '\t';
			os << '<' << getName();
			printAttributes(os);
			os << '>';

			os << getValue("");
			os << "</" << getName() << '>' << endl;
		}
		else {
			os << '\n';
			for (int i = 1; i < getLevel(); ++i) os << '\t';
			os << '<' << getName();
			printAttributes(os);
			os << '>';
			os << '\n';

			ConfigList::const_iterator iter = children.begin();
			for (; iter != children.end(); ++iter) (*iter)->print(os);
			for (int i = 1; i < getLevel(); ++i) os << '\t';
			os << "</" << getName() << ">" << endl;
		}
	}
}
Пример #3
0
void PDFConfig::print(ostream &os)
{
	ConfigList children = getChildren();

	for (int i = 0; i < getLevel(); ++i) os << "\t";
	if (children.size() == 0) {
		os << getName() << "=" << getValue() << endl;
	}
	else {
		ConfigList::const_iterator iter = children.begin();
		for (; iter != children.end(); ++iter) {
			(*iter)->print(os);
		}
	}
}