Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

MNUri.h

Go to the documentation of this file.
00001 /* Copyright (C) 2000 KOM/Darmstadt University of Technology 00002 * 00003 * You are allowed to use all other parts of the code under the following terms: 00004 * 00005 * For non-commercial use, code may be used in unmodified form provided 00006 * that this copyright notice and this permission notice appear in 00007 * supporting documentation. 00008 * 00009 * This software is provided "as is" and without any express or implied 00010 * warranties, including, without limitation, the implied warranty of 00011 * fitness for a particular purpose. 00012 * 00013 * The code may be subjected to the GNU General Public License, Version 2, 00014 * and re-distributed under the terms of this license. 00015 * As a special exception, permission is granted to link this code 00016 * with the Qt library and distribute executables, as long as you 00017 * follow the requirements of the GNU GPL in regard to all of the 00018 * software in the executable aside from Qt. 00019 * 00020 * Commercial use other than under the terms of the GNU General Public 00021 * License is allowed only after express negotiation of conditions 00022 * with the authors. 00023 */ 00024 #ifndef _MN_URI_H 00025 #define _MN_URI_H 00026 00027 #include <config.h> 00028 00029 #include <stdlib.h> 00030 #include <assert.h> 00031 00032 #include "mnstream.h" 00033 #include "MNString.h" 00034 00035 class MNUri : public MNString { 00036 private: 00037 MNString _protocol; 00038 MNString _machine; 00039 int _port; 00040 MNString _localPath; 00041 00042 // splits a string into the Uri-parts (protocol, machine...) 00043 void split(const MNString name, MNString& _protocol, MNString& _machine, int& _port, MNString& _localPath); 00044 00045 // the opposite split: create the one Uri-String 00046 MNString assembleUri(const MNString& protocol, const MNString& machine, const int& port, const MNString& localPath); 00047 // and this version calls makeAbsoluteOf before assembly: 00048 MNString assembleUri(const MNUri& base, const MNString& protocol, const MNString& machine, const int& port, const MNString& localPath); 00049 00050 // changes member vars in a way, that the Uri is an absolute Uri 00051 // if anything is relative, the Uri is constructed relative to the base argument 00052 void makeAbsoluteOf(const MNUri& base); 00053 00054 // to be called after every other change of member vars 00055 void normalize(); 00056 00057 public: 00058 MNUri(const MNString name=""); 00059 MNUri(const MNUri& base, const MNString name=""); 00060 MNUri(const MNString protocol, const MNString machine, const int port=80, const MNString localpath="/"); 00061 MNUri(const MNUri& base, const MNString protocol, const MNString machine, const int port=-1, const MNString localpath=""); 00062 const MNString getProtocol() const; 00063 const MNString getMachine() const; 00064 const int getPort() const; 00065 const MNString getLocalPath() const; 00066 00067 }; 00068 00069 ostream& operator<<(ostream& o, const MNUri&u); 00070 00071 00072 #endif

Generated on Sun Mar 6 13:35:49 2005 for Komssys by doxygen 1.3.8