本文整理汇总了C++中std::filebuf类的典型用法代码示例。如果您正苦于以下问题:C++ filebuf类的具体用法?C++ filebuf怎么用?C++ filebuf使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了filebuf类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: start
void ImageFileRecorder::start()
{
if ( !m_running )
{
filebuffer.open ( m_logfile.string().c_str(), std::ios::out );
if( !filebuffer.is_open() )
UBITRACK_THROW( "Error opening file" );
m_running = true;
}
}
示例2: stop
void ImageFileRecorder::stop()
{
if ( m_running )
{
filebuffer.close();
m_running = false;
}
}
示例3: PATH
boost::filesystem::path Appender::DoOpen(std::filebuf &file, Path& path)
{
const boost::filesystem::path PATH(SelectPathToUseHideErrors(path));
CreateDirectoryTree(PATH.branch_path( ));
using namespace std;
file.open(PATH.string( ).c_str( ), ios::out | ios::app | ios::ate);
return PATH;
}
示例4: parseFaceList
static void parseFaceList()
{
unsigned short cnt;
in.sgetn((char*)&cnt, 2);
_log("FaceList cnt=" + itoa(cnt));
while (cnt--) {
unsigned short v[4];
in.sgetn((char*)v, 8);
Face3DS face;
face.verts[0] = v[0];
face.verts[1] = v[1];
face.verts[2] = v[2];
if (flip_tris)
std::swap(face.verts[1], face.verts[2]);
faces.push_back(face);
}
enterChunk();
while (int id = nextChunk()) {
switch (id) {
case CHUNK_FACEMAT:
parseFaceMat();
break;
}
}
leaveChunk();
}
示例5: parseKeyFramer
static void parseKeyFramer(MeshModel* root)
{
_log("KeyFramer");
enterChunk();
std::string file_3ds;
unsigned short rev, curr_time = 0;
while (int id = nextChunk()) {
switch (id) {
case 0xb009: //CURR_TIME
in.sgetn((char*)&curr_time, 2);
_log("CURR_TIME: " + itoa(curr_time));
break;
case 0xb00a: //KFHDR
in.sgetn((char*)&rev, 2);
file_3ds = parseString();
in.sgetn((char*)&anim_len, 2);
_log("KFHDR: revision=" + itoa(rev) + " 3dsfile=" + file_3ds + " anim_len=" + itoa(anim_len));
break;
case 0xb002: //object keyframer data...
parseMeshInfo(root, curr_time);
break;
}
}
if (!collapse) {
root->setAnimator(new Animator(root, anim_len));
}
leaveChunk();
}
示例6: parseFile
static MeshModel* parseFile()
{
unsigned short id;
int len;
in.sgetn((char*)&id, 2);
in.sgetn((char*)&len, 4);
if (id != CHUNK_MAIN)
return 0;
chunk_end = (int)in.pubseekoff(0, std::ios_base::cur) + len - 6;
enterChunk();
MeshModel* root = new MeshModel();
while (int id = nextChunk()) {
switch (id) {
case CHUNK_SCENE:
parseScene(root);
break;
case CHUNK_KEYFRAMER:
parseKeyFramer(root);
break;
}
}
leaveChunk();
return root;
}
示例7: pluginUnload
void pluginUnload()
{
if(fileBuf.is_open()){
fileBuf.close();
}
/* called when plugin is unloaded, cleanup here */
}
示例8: nextChunk
static int nextChunk()
{
in.pubseekoff(chunk_end, std::ios_base::beg);
if (chunk_end == parent_end.back())
return 0;
unsigned short id;
int len;
in.sgetn((char*)&id, 2);
in.sgetn((char*)&len, 4);
chunk_end = (int)in.pubseekoff(0, std::ios_base::cur) + len - 6;
return id;
}
示例9: parseVertList
static void parseVertList()
{
unsigned short cnt;
in.sgetn((char*)&cnt, 2);
_log("VertList cnt=" + itoa(cnt));
while (cnt--) {
Surface::Vertex v;
in.sgetn((char*)&v.coords, 12);
if (conv)
v.coords = conv_tform * v.coords;
MeshLoader::addVertex(v);
}
}
示例10: parseFaceMat
static void parseFaceMat()
{
std::string name = parseString();
_log("FaceMat: " + name);
Brush mat = materials_map[name];
unsigned short cnt;
in.sgetn((char*)&cnt, 2);
while (cnt--) {
unsigned short face;
in.sgetn((char*)&face, 2);
faces[face].brush = mat;
}
}
示例11: parseMapList
static void parseMapList()
{
_log("MapList");
unsigned short cnt;
in.sgetn((char*)&cnt, 2);
for (int k = 0; k < cnt; ++k) {
float uv[2];
in.sgetn((char*)uv, 8);
Surface::Vertex& v = MeshLoader::refVertex(k);
v.tex_coords[0][0] = v.tex_coords[1][0] = uv[0];
v.tex_coords[0][1] = v.tex_coords[1][1] = 1 - uv[1];
// v->tex_coords[0]=v->tex_coords[1]=Vector( uv[0],1-uv[1],1 );
}
}
示例12: pluginLoad
void pluginLoad() {
if(notifyPeriod != 0) {
Environment<>::get().PluginConnector().setNotificationPeriod(this, notifyPeriod);
// Set default resources to log
if (properties.empty()) {
properties.push_back("rank");
properties.push_back("position");
properties.push_back("currentStep");
properties.push_back("cellCount");
properties.push_back("particleCount");
propertyMap["rank"] = true;
propertyMap["position"] = true;
propertyMap["currentStep"] = true;
propertyMap["particleCount"] = true;
propertyMap["cellCount"] = true;
}
else {
for (size_t i = 0; i < properties.size(); ++i) {
propertyMap[properties[i]] = true;
}
}
// Prepare file for output stream
if (streamType == "file") {
size_t rank = static_cast<size_t>(Environment<simDim>::get().GridController().getGlobalRank());
std::stringstream ss;
ss << outputFilePrefix << rank;
boost::filesystem::path resourceLogPath(ss.str());
fileBuf.open(resourceLogPath.string().c_str(), std::ios::out);
}
}
}
示例13: parseString
static std::string parseString()
{
std::string t;
while (int c = in.sbumpc())
t += char(c);
return t;
}
示例14: parseColor
static Vector parseColor()
{
Vector v;
unsigned char rgb[3];
enterChunk();
while (int id = nextChunk()) {
switch (id) {
case CHUNK_RGBF:
in.sgetn((char*)&v, 12);
break;
case CHUNK_RGBB:
in.sgetn((char*)rgb, 3);
v = Vector(rgb[0] / 255.0f, rgb[1] / 255.0f, rgb[2] / 255.0f);
}
}
leaveChunk();
return v;
}
示例15: enterChunk
static void enterChunk()
{
parent_end.push_back(chunk_end);
chunk_end = (int)in.pubseekoff(0, std::ios_base::cur);
}