// 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); }
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; } } }
/** * 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(); } } }
// Appends to a existing File using istream, B+T void File::append(std::istream& data,uintmax_t n){ open(APPEND); streamCopy(data, n); }