本文整理汇总了C++中Next::read方法的典型用法代码示例。如果您正苦于以下问题:C++ Next::read方法的具体用法?C++ Next::read怎么用?C++ Next::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Next
的用法示例。
在下文中一共展示了Next::read方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main () {
// Redirect stdout to this stream, so that involuntary
// writes to stdout do not interfere with our protocol.
std::ostringstream oss;
stdout_redir = oss.rdbuf();
stdout_orig = std::cout.rdbuf();
std::cout.rdbuf(stdout_redir);
#ifdef SET_BINARY_STREAMS
_setmode(_fileno(stdout), _O_BINARY);
std::cout.setf(std::ios_base::binary);
_setmode(_fileno(stdin), _O_BINARY);
std::cin.setf(std::ios_base::binary);
#endif
bool has_more = false;
IfcGeom::Iterator<float>* iterator = 0;
Hello().write(std::cout);
int exit_code = 0;
for (;;) {
const int32_t msg_type = sread<int32_t>(std::cin);
switch (msg_type) {
case IFC_MODEL: {
IfcModel m; m.read(std::cin);
std::string::size_type len = m.string().size();
char* data = new char[len];
memcpy(data, m.string().c_str(), len);
IfcGeom::IteratorSettings settings;
settings.set(IfcGeom::IteratorSettings::USE_WORLD_COORDS, false);
settings.set(IfcGeom::IteratorSettings::WELD_VERTICES, false);
settings.set(IfcGeom::IteratorSettings::CONVERT_BACK_UNITS, true);
settings.set(IfcGeom::IteratorSettings::INCLUDE_CURVES, true);
iterator = new IfcGeom::Iterator<float>(settings, data, (int)len);
has_more = iterator->initialize();
More(has_more).write(std::cout);
continue;
}
case GET: {
Get g; g.read(std::cin);
if (!has_more) {
exit_code = 1;
break;
}
const IfcGeom::TriangulationElement<float>* geom = static_cast<const IfcGeom::TriangulationElement<float>*>(iterator->get());
Entity(geom).write(std::cout);
continue;
}
case NEXT: {
Next n; n.read(std::cin);
has_more = iterator->next();
if (!has_more) {
delete iterator;
iterator = 0;
}
More(has_more).write(std::cout);
continue;
}
case GET_LOG: {
GetLog gl; gl.read(std::cin);
WriteLog(iterator->getLog()).write(std::cout);
continue;
}
case BYE: {
Bye().write(std::cout);
exit_code = 0;
break;
}
default:
exit_code = 1;
break;
}
break;
}
std::cout.rdbuf(stdout_orig);
return exit_code;
}