UCS2String GetFileExtension(const Path& p) { UCS2String::size_type pos = p.GetFile().find_last_of('.'); if(pos != UCS2String::npos) return UCS2String(p.GetFile(), pos); return UCS2String(); }
UCS2String Path::GetFolder() const { if(folders.empty() == false) return folders.back(); else return UCS2String(); }
OTextStream::OTextStream(const UCS2 *sname, OStream *sstream) { if(sname == NULL) throw POV_EXCEPTION_CODE(kParamErr); if(sstream == NULL) throw POV_EXCEPTION_CODE(kParamErr); stream = sstream; filename = UCS2String(sname); }
OTextStream::OTextStream(const UCS2 *sname, unsigned int stype, bool append) { if(sname == NULL) throw POV_EXCEPTION_CODE(kParamErr); stream = NewOStream(sname, stype, append); if(stream == NULL) throw POV_EXCEPTION(kCannotOpenFileErr, string("Cannot open file '") + UCS2toASCIIString(sname) + "' for output."); filename = UCS2String(sname); }
UCS2String DefaultPlatformBase::CreateTemporaryFile() { static int cnt = 0; char buffer[32]; cnt++; sprintf(buffer, "/tmp/pov%08x.dat", cnt); FILE *f = fopen(buffer, "wb"); if(f != NULL) fclose(f); return UCS2String(ASCIItoUCS2String(buffer)); }
ITextStream::ITextStream(const UCS2 *sname, IStream *sstream) { if(sname == NULL) throw POV_EXCEPTION_CODE(kParamErr); if(sstream == NULL) throw POV_EXCEPTION_CODE(kParamErr); stream = sstream; filename = UCS2String(sname); lineno = 1; bufferoffset = 0; maxbufferoffset = 0; filelength = 0; ungetbuffer = EOF; curpos = 0 ; stream->seekg(0, IOBase::seek_end); filelength = stream->tellg(); stream->seekg(0, IOBase::seek_set); RefillBuffer(); }
ITextStream::ITextStream(const UCS2 *sname, unsigned int stype) { if(sname == NULL) throw POV_EXCEPTION_CODE(kParamErr); stream = NewIStream(sname, stype); if(stream == NULL) throw POV_EXCEPTION(kCannotOpenFileErr, string("Cannot open file '") + UCS2toASCIIString(sname) + "' for input."); filename = UCS2String(sname); lineno = 1; bufferoffset = 0; maxbufferoffset = 0; filelength = 0; ungetbuffer = EOF; curpos = 0 ; stream->seekg(0, IOBase::seek_end); filelength = stream->tellg(); stream->seekg(0, IOBase::seek_set); RefillBuffer(); }
Path::Path(const UCS2 *p) { ParsePathString(UCS2String(p)); }
void Path::SetFile(const UCS2 *p) { file = UCS2String(p); }
void Path::AppendFolder(const UCS2 *p) { folders.push_back(UCS2String(p)); }
void Path::SetVolume(const UCS2 *p) { volume = UCS2String(p); }