本文整理汇总了C++中LineSplitter::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ LineSplitter::c_str方法的具体用法?C++ LineSplitter::c_str怎么用?C++ LineSplitter::c_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LineSplitter
的用法示例。
在下文中一共展示了LineSplitter::c_str方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadBasicNodeInfo_Ascii
// ------------------------------------------------------------------------------------------------
void COBImporter::ReadBasicNodeInfo_Ascii(Node& msh, LineSplitter& splitter, const ChunkInfo& /*nfo*/)
{
for(;splitter;++splitter) {
if (splitter.match_start("Name")) {
msh.name = std::string(splitter[1]);
// make nice names by merging the dupe count
std::replace(msh.name.begin(),msh.name.end(),
',','_');
}
else if (splitter.match_start("Transform")) {
for(unsigned int y = 0; y < 4 && ++splitter; ++y) {
const char* s = splitter->c_str();
for(unsigned int x = 0; x < 4; ++x) {
SkipSpaces(&s);
msh.transform[y][x] = fast_atof(&s);
}
}
// we need the transform chunk, so we won't return until we have it.
return;
}
}
}
示例2: ReadPolH_Ascii
// ------------------------------------------------------------------------------------------------
void COBImporter::ReadPolH_Ascii(Scene& out, LineSplitter& splitter, const ChunkInfo& nfo)
{
if(nfo.version > 8) {
return UnsupportedChunk_Ascii(splitter,nfo,"PolH");
}
out.nodes.push_back(std::shared_ptr<Mesh>(new Mesh()));
Mesh& msh = (Mesh&)(*out.nodes.back().get());
msh = nfo;
ReadBasicNodeInfo_Ascii(msh,++splitter,nfo);
// the chunk has a fixed order of components, but some are not interesting of us so
// we're just looking for keywords in arbitrary order. The end of the chunk is
// either the last `Face` or the `DrawFlags` attribute, depending on the format ver.
for(;splitter;++splitter) {
if (splitter.match_start("World Vertices")) {
const unsigned int cnt = strtoul10(splitter[2]);
msh.vertex_positions.resize(cnt);
for(unsigned int cur = 0;cur < cnt && ++splitter;++cur) {
const char* s = splitter->c_str();
aiVector3D& v = msh.vertex_positions[cur];
SkipSpaces(&s);
v.x = fast_atof(&s);
SkipSpaces(&s);
v.y = fast_atof(&s);
SkipSpaces(&s);
v.z = fast_atof(&s);
}
}
else if (splitter.match_start("Texture Vertices")) {
const unsigned int cnt = strtoul10(splitter[2]);
msh.texture_coords.resize(cnt);
for(unsigned int cur = 0;cur < cnt && ++splitter;++cur) {
const char* s = splitter->c_str();
aiVector2D& v = msh.texture_coords[cur];
SkipSpaces(&s);
v.x = fast_atof(&s);
SkipSpaces(&s);
v.y = fast_atof(&s);
}
}
else if (splitter.match_start("Faces")) {
const unsigned int cnt = strtoul10(splitter[1]);
msh.faces.reserve(cnt);
for(unsigned int cur = 0; cur < cnt && ++splitter ;++cur) {
if (splitter.match_start("Hole")) {
LogWarn_Ascii(splitter,"Skipping unsupported `Hole` line");
continue;
}
if (!splitter.match_start("Face")) {
ThrowException("Expected Face line");
}
msh.faces.push_back(Face());
Face& face = msh.faces.back();
face.indices.resize(strtoul10(splitter[2]));
face.flags = strtoul10(splitter[4]);
face.material = strtoul10(splitter[6]);
const char* s = (++splitter)->c_str();
for(size_t i = 0; i < face.indices.size(); ++i) {
if(!SkipSpaces(&s)) {
ThrowException("Expected EOL token in Face entry");
}
if ('<' != *s++) {
ThrowException("Expected < token in Face entry");
}
face.indices[i].pos_idx = strtoul10(s,&s);
if (',' != *s++) {
ThrowException("Expected , token in Face entry");
}
face.indices[i].uv_idx = strtoul10(s,&s);
if ('>' != *s++) {
ThrowException("Expected < token in Face entry");
}
}
}
if (nfo.version <= 4) {
break;
}
}
else if (splitter.match_start("DrawFlags")) {
msh.draw_flags = strtoul10(splitter[1]);
break;
}
}
}