Exemplo n.º 1
0
// Creates a File using istream, B+T ??
// Throws ex::filesystem::AlreadyThere
void File::write(std::istream& data,Conflict c,uintmax_t n){
    if( exists() ){
        if(c == LEAVE)
            Throw(ex::filesystem::AlreadyThere,m_name.string());
        else if(c == NEW)
            path(newpath());
    }
    open(WRITE);
    streamCopy(data, n);
}
Exemplo n.º 2
0
void inject(ostream& dst, const string fname)
{
    if (alreadyIncluded.find(fname) == alreadyIncluded.end()) {
        alreadyIncluded.insert(fname);
        istream* src = open_arch_stream( fname.c_str());
        if (src) {
            streamCopy(*src, dst);
        } else {
            cerr << "NOT FOUND " << fname << endl;
        }
    }
}
Exemplo n.º 3
0
/**
 * Inject file fname into dst ostream 
 */
static void inject(ostream& dst, const string& fname)
{
    if (gGlobal->gAlreadyIncluded.find(fname) == gGlobal->gAlreadyIncluded.end()) {
        gGlobal->gAlreadyIncluded.insert(fname);
        istream* src = open_arch_stream(fname.c_str());
        if (src) {
            streamCopy(*src, dst);
            delete src;
        } else {
            stringstream error;
            error << "NOT FOUND " << fname << endl;
            gGlobal->gErrorMsg = error.str();
        }
    }
}
Exemplo n.º 4
0
// Appends to a existing File using istream, B+T
void File::append(std::istream& data,uintmax_t n){
    open(APPEND);
    streamCopy(data, n);
}