String UnnamedPipe::readAll() { char buf[1024]; int readbytes; StringBuffer retval; do { readbytes = this->read(buf, sizeof(buf)-1, true); // throws on error buf[readbytes] = 0; // null-terminate the buffer retval += buf; } while (readbytes > 0); // keep going until we don't fill up the buffer. return retval.releaseString(); }
String URL::toString() const { StringBuffer retval; if (!scheme.empty()) { retval += scheme; retval += "://"; } if (!principal.empty() || !credential.empty()) { retval += principal; if (!credential.empty()) { retval += ':'; retval += credential; } retval += '@'; } retval += host; if (!port.empty()) { retval += ":"; retval += port; } if (!namespaceName.empty()) { retval += '/'; retval += namespaceName; // can only have a modelPath if we have namespaceName if (!modelPath.empty()) { retval += "/:"; retval += modelPath; } } return retval.releaseString(); }
String CIMQualifierType::toMOF() const { size_t i; StringBuffer rv; rv = "Qualifier "; rv += m_pdata->m_name.toString(); rv += " : "; rv += m_pdata->m_dataType.toMOF(); if (m_pdata->m_dataType.isArrayType()) { rv += '['; if (m_pdata->m_dataType.getSize() != -1) // -1 means unlimited { rv += m_pdata->m_dataType.getSize(); } rv += ']'; } if (m_pdata->m_defaultValue) { rv += " = "; rv += m_pdata->m_defaultValue.toMOF(); } if (m_pdata->m_scope.size() > 0) { rv += ", Scope("; CIMScopeArray scopes(m_pdata->m_scope); std::sort(scopes.begin(), scopes.end()); for (i = 0; i < scopes.size(); i++) { if (i > 0) { rv += ','; } rv += scopes[i].toMOF(); } rv += ')'; } if (m_pdata->m_flavor.size() > 0) { CIMFlavorArray toPrint; // first filter out the default flavors. for (i = 0; i < m_pdata->m_flavor.size(); i++) { if (m_pdata->m_flavor[i].getFlavor() != CIMFlavor::ENABLEOVERRIDE && m_pdata->m_flavor[i].getFlavor() != CIMFlavor::TOSUBCLASS) { toPrint.push_back(m_pdata->m_flavor[i]); } } if (toPrint.size() > 0) { rv += ", Flavor("; for (i = 0; i < toPrint.size(); i++) { if (i > 0) { rv += ','; } rv += toPrint[i].toMOF(); } rv += ')'; } } rv += ";\n"; return rv.releaseString(); }