本文整理汇总了C++中TextStream类的典型用法代码示例。如果您正苦于以下问题:C++ TextStream类的具体用法?C++ TextStream怎么用?C++ TextStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: layerTreeAsText
String GraphicsLayer::layerTreeAsText(LayerTreeAsTextBehavior behavior) const
{
TextStream ts;
dumpLayer(ts, 0, behavior);
return ts.release();
}
示例2: htmlForLink
static String htmlForLink(int x, int y, int width, int height, const char* url)
{
TextStream ts;
ts << "<a style='position: absolute; left: " << x << "px; top: " << y << "px; width: " << width << "px; height: " << height
<< "px' href='" << url << "'>" << url << "</a>";
return ts.release();
}
示例3: dump
void PDFDocumentImage::dump(TextStream& ts) const
{
Image::dump(ts);
ts.dumpProperty("page-count", pageCount());
ts.dumpProperty("crop-box", m_cropBox);
if (m_rotationDegrees)
ts.dumpProperty("rotation", m_rotationDegrees);
}
示例4: readEfpParamsSection
void QChemInput::readEfpParamsSection(TextStream& textStream)
{
EfpFragment parser;
while (!textStream.atEnd()) {
parser.loadNextFragment(textStream);
if (textStream.previousLine().contains("$end", Qt::CaseInsensitive)) break;
}
}
示例5: dump
void Image::dump(TextStream& ts) const
{
if (isAnimated())
ts.dumpProperty("animated", isAnimated());
if (isNull())
ts.dumpProperty("is-null-image", true);
ts.dumpProperty("size", size());
}
示例6: TextStream
bool
AsxParser::ParseBuffer (MemoryBuffer *buffer)
{
this->buffer = buffer;
TextStream *stream = new TextStream ();
buffer->SeekSet (0);
stream->OpenBuffer ((char *) buffer->GetCurrentPtr (), buffer->GetSize ());
return parser->parse_stream (stream);
}
示例7: externalRepresentation
static String externalRepresentation(RenderBox* renderer, RenderAsTextBehavior behavior)
{
TextStream ts;
if (!renderer->hasLayer())
return ts.release();
RenderLayer* layer = renderer->layer();
RenderTreeAsText::writeLayers(ts, layer, layer, layer->rect(), 0, behavior);
return ts.release();
}
示例8: layerTreeAsText
String LayerRendererChromium::layerTreeAsText() const
{
TextStream ts;
if (rootLayer()) {
ts << rootLayer()->layerTreeAsText();
ts << "RenderSurfaces:\n";
dumpRenderSurfaces(ts, 1, rootLayer());
}
return ts.release();
}
示例9: while
MacroDef::eAppendStat MacroDef::AppendMacroExpansion
(TextStream & text)
{
char c;
bool stat;
while (text.Consume(c))
{
if ('%' == c)
{
if (text.Expect ("%"))
{
// escape of '%' character: that's OK
_definition.Append (c);
_definition.Append (c);
continue;
}
int argIdx = 0;
for (int digitCount = 0; digitCount < 2; digitCount++)
{
stat = text.Consume(c);
if (! stat)
{
return kAppendBadArg;
}
if ((c >= '0') && (c <= '9'))
{
// valid arg values
if (0 == digitCount)
{
_definition.Append ('%');
}
_definition.Append (c);
argIdx = argIdx*10 + (c - '0');
if (argIdx > _numArgs)
{
return kAppendArgRange;
}
continue;
}
else
{
return kAppendBadArg;
}
}
}
else
{
_definition.Append (c);
}
}
return kAppendNoError;
}
示例10: readEfpFragmentSection
void QChemInput::readEfpFragmentSection(TextStream& textStream)
{
// Check for an existing list from the $molecule section
Data::EfpFragmentList* efps(0);
QList<Data::EfpFragmentList*> lists = m_dataBank.findData<Data::EfpFragmentList>();
if (lists.isEmpty()) {
efps = new Data::EfpFragmentList;
m_dataBank.append(efps);
}else {
efps = lists.last();
}
QString msg("Invalid $efp_fragments format on line ");
QStringList tokens;
bool ok, allOk;
int count(1);
while (!textStream.atEnd()) {
tokens = textStream.nextLineAsTokens();
if (tokens.size() == 1 && tokens[0].contains("$end", Qt::CaseInsensitive)) {
break;
}else if (tokens.size() < 7) {
Data::EfpFragment* efp(0);
if (count <= efps->size()) {
efp = efps->at(count-1);
}else {
efp = new Data::EfpFragment;
efps->append(efp);
}
efp->setName(tokens[0]);
}else {
allOk = true;
QString name(tokens[0]);
double x, y, z, a, b, c;
if (allOk) x = tokens[1].toDouble(&ok); allOk = allOk && ok;
if (allOk) y = tokens[2].toDouble(&ok); allOk = allOk && ok;
if (allOk) z = tokens[3].toDouble(&ok); allOk = allOk && ok;
if (allOk) a = tokens[4].toDouble(&ok); allOk = allOk && ok;
if (allOk) b = tokens[5].toDouble(&ok); allOk = allOk && ok;
if (allOk) c = tokens[6].toDouble(&ok); allOk = allOk && ok;
if (allOk) {
efps->append(new Data::EfpFragment(name, qglviewer::Vec(x,y,z), a, b, c));
}else {
m_errors.append(msg += QString::number(textStream.lineNumber()));
}
}
++count;
}
}
示例11: group
void DisplayList::dump(TextStream& ts) const
{
TextStream::GroupScope group(ts);
ts << "display list";
size_t numItems = m_list.size();
for (size_t i = 0; i < numItems; ++i) {
TextStream::GroupScope scope(ts);
ts << i << " " << m_list[i].get();
}
ts.startGroup();
ts << "size in bytes: " << sizeInBytes();
ts.endGroup();
}
示例12: counterValueForElement
String counterValueForElement(Element* element)
{
// Make sure the element is not freed during the layout.
RefPtr<Element> elementRef(element);
element->document()->updateLayout();
TextStream stream;
bool isFirstCounter = true;
// The counter renderers should be children of :before or :after pseudo-elements.
if (RenderObject* before = element->pseudoElementRenderer(BEFORE))
writeCounterValuesFromChildren(stream, before, isFirstCounter);
if (RenderObject* after = element->pseudoElementRenderer(AFTER))
writeCounterValuesFromChildren(stream, after, isFirstCounter);
return stream.release();
}
示例13: LOG_DOWNLOADER
char *
Downloader::GetResponseText (const char *partname, gint64 *size)
{
LOG_DOWNLOADER ("Downloader::GetResponseText (%s, %p)\n", partname, size);
TextStream *stream;
char buffer[4096];
GByteArray *buf;
struct stat st;
ssize_t nread;
char *data;
char *path;
if (!(path = GetDownloadedFilename (partname)))
return NULL;
if (g_stat (path, &st) == -1) {
g_free (path);
return NULL;
}
if (st.st_size > 0) {
stream = new TextStream ();
if (!stream->OpenFile (path, true)) {
delete stream;
g_free (path);
return NULL;
}
g_free (path);
buf = g_byte_array_new ();
while ((nread = stream->Read (buffer, sizeof (buffer))) > 0)
g_byte_array_append (buf, (const guint8 *) buffer, nread);
*size = buf->len;
g_byte_array_append (buf, (const guint8 *) "", 1);
data = (char *) buf->data;
g_byte_array_free (buf, false);
delete stream;
} else {
data = g_strdup ("");
*size = 0;
}
return data;
}
示例14: testConstructFromStream
void testConstructFromStream(){
TextStream stream;
stream.writeLine( "MasterFeder=1" );
stream.writeLine( "MasterPanpot=2" );
stream.writeLine( "MasterMute=3" );
stream.writeLine( "OutputMode=4" );
stream.writeLine( "Tracks=1" );
stream.writeLine( "Feder0=5" );
stream.writeLine( "Panpot0=6" );
stream.writeLine( "Mute0=7" );
stream.writeLine( "Solo0=8" );
stream.setPointer( -1 );
std::string lastLine = "";
Mixer mixer( stream, lastLine );
CPPUNIT_ASSERT_EQUAL( (std::size_t)1, mixer.slave.size() );
CPPUNIT_ASSERT_EQUAL( 1, mixer.masterFeder );
CPPUNIT_ASSERT_EQUAL( 2, mixer.masterPanpot );
CPPUNIT_ASSERT_EQUAL( 3, mixer.masterMute );
CPPUNIT_ASSERT_EQUAL( 4, mixer.outputMode );
CPPUNIT_ASSERT_EQUAL( 5, mixer.slave[0].feder );
CPPUNIT_ASSERT_EQUAL( 6, mixer.slave[0].panpot );
CPPUNIT_ASSERT_EQUAL( 7, mixer.slave[0].mute );
CPPUNIT_ASSERT_EQUAL( 8, mixer.slave[0].solo );
}
示例15: parse
bool ExternalCharges::parse(TextStream& textStream)
{
int max(INT_MAX);
bool allOk(true), isDouble;
bool maxSet(false), invalidFormat(false);
double x, y, z, q;
QStringList tokens;
Data::PointChargeList* charges(new Data::PointChargeList);
while (!textStream.atEnd() && charges->size() < max) {
tokens = textStream.nextLineAsTokens();
if (tokens.size() >= 4) {
x = tokens[0].toDouble(&isDouble); allOk = allOk && isDouble;
y = tokens[1].toDouble(&isDouble); allOk = allOk && isDouble;
z = tokens[2].toDouble(&isDouble); allOk = allOk && isDouble;
q = tokens[3].toDouble(&isDouble); allOk = allOk && isDouble;
if (allOk) {
charges->append(new Data::PointCharge(q, qglviewer::Vec(x,y,z)));
}else {
invalidFormat = true;
break;
}
}else if (tokens.size() >= 1) {
if (tokens.first().contains("$end", Qt::CaseInsensitive) || maxSet) {
break;
}else {
max = tokens[0].toInt(&maxSet);
}
}
}
if (maxSet && charges->size() != max) {
if (invalidFormat) {
QString msg("Invalid format on line ");
m_errors.append(msg += QString::number(textStream.lineNumber()));
}else {
m_errors.append("End of stream encountered");
}
delete charges;
}else if (charges->isEmpty()) {
m_errors.append("No charges found");
delete charges;
}else {
m_dataBank.append(charges);
}
return m_errors.isEmpty();
}