Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

doc2.hpp

00001 //
00002 // OpenVRML
00003 //
00004 // Copyright (C) 2000  Braden N. McDaniel
00005 // 
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License, or (at your option) any later version.
00010 // 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 // 
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 // 
00020 
00021 # ifndef OPENVRML_DOC2_HPP
00022 #   define OPENVRML_DOC2_HPP
00023 
00024 #   include <iosfwd>
00025 #   include <string>
00026 #   include "common.h"
00027 
00028 namespace OpenVRML {
00029 
00030     class OPENVRML_SCOPE Doc2 {
00031         std::string url_;
00032         char * tmpfile_;            // Local copy of http: files
00033         std::istream * istm_;
00034         std::ostream * ostm_;
00035 
00036     public:
00037         explicit Doc2(const std::string & url = std::string(),
00038                       const Doc2 * relative = 0);
00039         ~Doc2();
00040 
00041         void seturl(const std::string & url, const Doc2 * relative = 0);
00042 
00043         const std::string url() const;         // "http://www.foo.com/dir/file.xyz#Viewpoint"
00044         const std::string urlBase() const;     // "file" or ""
00045         const std::string urlExt() const;      // "xyz" or ""
00046         const std::string urlPath() const;     // "http://www.foo.com/dir/" or ""
00047         const std::string urlProtocol() const; // "http"
00048         const std::string urlModifier() const; // "#Viewpoint" or ""
00049 
00050         const char *localName();    // "/tmp/file.xyz" or NULL
00051         const char *localPath();    // "/tmp/" or NULL
00052 
00053         std::istream & inputStream();
00054         std::ostream & outputStream();
00055 
00056     private:
00057         // Non-copyable.
00058         Doc2(const Doc2 &);
00059         Doc2 & operator=(const Doc2 &);
00060 
00061         bool filename(char * fn, int nfn);
00062 
00063 #   ifdef macintosh
00064         char * convertCommonToMacPath(char * fn, int nfn);
00065 #   endif
00066     };
00067 }
00068 
00069 # endif