本文整理汇总了C++中StringWriter::write方法的典型用法代码示例。如果您正苦于以下问题:C++ StringWriter::write方法的具体用法?C++ StringWriter::write怎么用?C++ StringWriter::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringWriter
的用法示例。
在下文中一共展示了StringWriter::write方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startCell
//------------------------------------------------------------------------
bool XmlRepresentationHelper::startCell ()
{
if (!checkState (kInCell))
return false;
StringWriter writer (stream);
String string;
string.printf ("%s", START_TAG_STRING(CELL_TAG));
writer.write (string);
writer.write (ENDLINE_A);
return true;
}
示例2: endLayer
//------------------------------------------------------------------------
bool XmlRepresentationHelper::endLayer ()
{
if (!checkState (kInCell))
return false;
StringWriter writer (stream);
String string;
string.printf ("%s", END_TAG_STRING(LAYER_TAG));
writer.write (string);
writer.write (ENDLINE_A);
return true;
}
示例3: startEndCell
//------------------------------------------------------------------------
bool XmlRepresentationHelper::startEndCell ()
{
if (!checkState (kInCell))
return false;
StringWriter writer (stream);
String string;
string.printf ("<%s/>", CELL_TAG);
writer.write (string);
writer.write (ENDLINE_A);
if (!checkState (kInPage))
return false;
return true;
}
示例4: startPage
//------------------------------------------------------------------------
bool XmlRepresentationHelper::startPage (FIDString name, int32 unitID)
{
if (!checkState (kInPage))
return false;
StringWriter writer (stream);
String string;
if (unitID != -1)
string.printf ("<%s %s=\"%s\" %s=\"%d\">", PAGE_TAG, ATTR_NAME, name, ATTR_UNITID, unitID);
else
string.printf ("<%s %s=\"%s\">", PAGE_TAG, ATTR_NAME, name);
writer.write (string);
writer.write (ENDLINE_A);
return true;
}
示例5: writer
//------------------------------------------------------------------------
XmlRepresentationHelper::~XmlRepresentationHelper ()
{
if (state == kInLayer)
endLayer ();
if (state == kInCell)
endCell ();
if (state == kInPage)
endPage ();
StringWriter writer (stream);
String string;
// end representation
string.printf ("\t%s", END_TAG_STRING(REPRESENTATION_TAG));
writer.write (string);
writer.write (ENDLINE_A);
// end piper
writer.write (END_TAG_STRING(ROOTXML_TAG));
writer.write (ENDLINE_A);
}
示例6: sw
void * send_request(void * gg){
Socket s = Socket("localhost",80);
StringWriter sw ( s.getOutputStream() );
StringReader sr ( s.getInputStream() );
struct timeval start,end;
static char * request =
"GET /index.html HTTP/1.1\n"
"Host: oink\n\n";
gettimeofday( &start , NULL );
sw.write( request );
sr.readLine();
gettimeofday( &end , NULL );
long long val =
(long long)
( end.tv_sec - start.tv_sec) * 1000000L +
( end.tv_usec - start.tv_usec);
update_times( (int) val);
--thread_count;
}
示例7: startLayer
//------------------------------------------------------------------------
bool XmlRepresentationHelper::startLayer (int32 type, int32 id, FIDString _function, FIDString style, bool ended)
{
if (!checkState (kInLayer))
return false;
StringWriter writer (stream);
String string;
string.printf ("<%s %s=\"%s\" %s=\"%d\"", LAYER_TAG, ATTR_TYPE, Vst::LayerType::layerTypeFIDString[type], ATTR_PARAMID, id);
writer.write (string);
if (_function)
{
string.printf (" %s=\"%s\"", Vst::Attributes::kFunction, _function);
writer.write (string);
}
if (style)
{
string = Vst::LayerType::layerTypeFIDString[type];
if (type == Vst::LayerType::kSwitch)
string.printf (" %s=\"%s\"", Vst::Attributes::kSwitchStyle, style);
else if (type == Vst::LayerType::kLED)
string.printf (" %s=\"%s\"", Vst::Attributes::kLEDStyle, style);
else
string.printf (" %s=\"%s\"", Vst::Attributes::kStyle, style);
writer.write (string);
}
if (ended)
{
writer.write ("/>");
if (!checkState (kInCell))
return false;
}
else
writer.write (">");
writer.write (ENDLINE_A);
return true;
}
示例8: startEndTitleDisplay
//------------------------------------------------------------------------
bool XmlRepresentationHelper::startEndTitleDisplay (Vst::ParameterInfo& info)
{
String nameString (info.title);
if (nameString.isEmpty ())
return false;
if (!checkState (kInTitleDisplay))
return false;
StringWriter writer (stream);
String string;
string.printf ("<%s>", TITLEDISPLAY_TAG);
writer.write (string);
writer.write (ENDLINE_A);
// start of name scope
if (!checkState (kInName))
{
string.printf ("%s", END_TAG_STRING (TITLEDISPLAY_TAG));
writer.write (string);
writer.write (ENDLINE_A);
return false;
}
string.printf ("<%s>%s</%s>", NAME_TAG, nameString.text8 (), NAME_TAG);
writer.write (string);
writer.write (ENDLINE_A);
if (nameString.length () > MEDIUM_TITLE_LIMIT)
{
nameString.assign (info.shortTitle);
if (! nameString.isEmpty ())
{
nameString.removeChars (); // remove space
if (nameString.length () > MEDIUM_TITLE_LIMIT)
nameString.remove (MEDIUM_TITLE_LIMIT); // Trimming the rest to get a short string
string.printf ("<%s>%s</%s>", NAME_TAG, nameString.text8 (), NAME_TAG);
writer.write (string);
writer.write (ENDLINE_A);
}
}
if (nameString.length () > SHORT_TITLE_LIMIT)
{
nameString.remove (SHORT_TITLE_LIMIT); // Trimming the rest to get a short string
string.printf ("<%s>%s</%s>", NAME_TAG, nameString.text8 (), NAME_TAG);
writer.write (string);
writer.write (ENDLINE_A);
}
if (!checkState (kInTitleDisplay))
return false;
// end of name scope
string.printf ("%s", END_TAG_STRING (TITLEDISPLAY_TAG));
writer.write (string);
writer.write (ENDLINE_A);
if (!checkState (kInLayer))
return false;
return true;
}
示例9: print
static size_t print(StringWriter& sb, const char* s) {
return sb.write(reinterpret_cast<const uint8_t*>(s), strlen(s));
}