Skip to content

Commit

Permalink
delete BufferStream::setPath() and can save sc file with your favorit…
Browse files Browse the repository at this point in the history
…e name
  • Loading branch information
satoshi okami committed Jun 1, 2012
1 parent f8f5407 commit cd628f0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 27 deletions.
14 changes: 14 additions & 0 deletions src/renderer/RenderOption.h
@@ -0,0 +1,14 @@
//
// SFRenderOption.h
// emptyExample
//
// Created by Okami Satoshi on 12/06/01.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#ifndef emptyExample_SFRenderOption_h
#define emptyExample_SFRenderOption_h



#endif
17 changes: 5 additions & 12 deletions src/utils/BufferStream.cpp
Expand Up @@ -19,17 +19,17 @@ float BufferStream::omit(float v)

void BufferStream::clear()
{
if (remove(filePath.c_str()) != 0)
{
//cout << "[WARNING] sc file not found " << filePath.c_str() << endl;
if (remove(filePath.c_str()) != 0) {
return;
}

cout << "[INFO] delete sc file" << endl;
}

void BufferStream::save()
void BufferStream::save(string name)
{
filePath = getBinDir() + '/' + name;

FILE *fp = fopen(filePath.c_str(), "w");

if (fp == NULL)
Expand All @@ -41,19 +41,12 @@ void BufferStream::save()
fputs(osstream.str().c_str(), fp);
fclose(fp);

cout << "[INFO] save " << SUNFLOW_SC << endl;
cout << "[INFO] save " << name << endl;

// clear buffer
osstream.str("");
}

void BufferStream::setPath(std::string path)
{
filePath = path;

cout << "[INFO] change sc file path " << path << endl;
}

std::string BufferStream::getPath()
{
return filePath;
Expand Down
19 changes: 4 additions & 15 deletions src/utils/BufferStream.h
Expand Up @@ -11,6 +11,7 @@

#include <sstream>
#include <iostream.h>
#include "sunflow.h"
#include "Constants.h"

namespace sf {
Expand All @@ -31,30 +32,18 @@ namespace sf {

public:

BufferStream()
{
BufferStream() {
depth = 0;

char buf[1024];
getcwd(buf, sizeof(buf));
std::string ss = buf;
setPath(ss + '/' + SUNFLOW_SC);
}

~BufferStream()
{
~BufferStream() {
depth = 0;

osstream.clear();

//clear();
}

/// output as sc file and clear osstream buffer
void save();

// set sc file path
void setPath(std::string path);
void save(string name);

// get sc file path
std::string getPath();
Expand Down

0 comments on commit cd628f0

Please sign in to comment.