本文整理汇总了C++中StringBuffer::releaseString方法的典型用法代码示例。如果您正苦于以下问题:C++ StringBuffer::releaseString方法的具体用法?C++ StringBuffer::releaseString怎么用?C++ StringBuffer::releaseString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringBuffer
的用法示例。
在下文中一共展示了StringBuffer::releaseString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
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();
}
示例2:
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();
}
示例3: scopes
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();
}