00001 // This is core/vil1/vil1_stream_url.h 00002 #ifndef vil1_stream_url_h_ 00003 #define vil1_stream_url_h_ 00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00005 #pragma interface 00006 #endif 00007 //: 00008 // \file 00009 // \brief open an URL 00010 // \author fsm 00011 00012 #include <vil1/vil1_stream.h> 00013 00014 //: open an URL 00015 00016 class vil1_stream_url : public vil1_stream 00017 { 00018 vil1_stream *u_; // underlying stream 00019 // Make private to prevent use. 00020 vil1_stream_url(vil1_stream_url const &): vil1_stream() { } 00021 void operator=(vil1_stream_url const &) { } 00022 public: 00023 vil1_stream_url(char const *); 00024 ~vil1_stream_url(); 00025 00026 // implement virtual vil1_stream interface: 00027 bool ok() const { return u_ && u_->ok(); } 00028 vil1_streampos write(void const *buf, vil1_streampos n) { return u_ ? u_->write(buf, n) : 0L; } 00029 // strictly speaking, writes should fail, but that isn't useful in any way. 00030 vil1_streampos read(void *buf, vil1_streampos n) { return u_ ? u_->read(buf, n) : 0L; } 00031 vil1_streampos tell() const { return u_ ? u_->tell() : (vil1_streampos)(-1L); } 00032 void seek(vil1_streampos position) { if (u_) u_->seek(position); } 00033 }; 00034 00035 #endif // vil1_stream_url_h_
1.5.1