00001 /*****************************************************************************
00002 * Author: Valient Gough <vgough@pobox.com>
00003 *
00004 *****************************************************************************
00005 * Copyright (c) 2001, Valient Gough
00006 *
00007 * This library is free software; you can distribute it and/or modify it under
00008 * the terms of the GNU Lesser General Public License (LGPL), as published by
00009 * the Free Software Foundation; either version 2.1 of the License, or (at your
00010 * option) any later version.
00011 *
00012 * This library is distributed in the hope that it will be useful, but WITHOUT
00013 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 * FITNESS FOR A PARTICULAR PURPOSE. See the LGPL in the file COPYING for more
00015 * details.
00016 *
00017 */
00018
00019
00020 #ifndef _Path_incl_
00021 #define _Path_incl_
00022
00023 #include <rel/TypeStream.h>
00024 #include <rel/StringIODevice.h>
00025
00026
00027 namespace rel
00028 {
00029
00030
00031 // TypeStream is not virtual, so we can't overwrite it's operation, but we
00032 // can add our own functions..
00033 class Path : public TypeStream
00034 {
00035 public:
00036 Path(const std::string &path, char separator = '/');
00037 Path(const char *path, char separator = '/');
00038 Path(const Path &src);
00039 Path();
00040 virtual ~Path();
00041
00042 Path &operator = (const Path &src);
00043
00044 // single path element
00045 bool append(const string &name);
00046 // possibly multi-element
00047 bool append(const string &name, char separator);
00048 bool append(const char *name, char separator = '/');
00049
00050 // create new path from arguments.
00051 static OpaqueValue New(const TypeStream *);
00052
00053 // empty path
00054 void clear();
00055
00056
00057 // These are public so that associated operators can call them..
00058 void Encode(TypeStream &) const;
00059 void Decode(const TypeStream &);
00060 private:
00061
00062 StreamCoder fCoder;
00063 StringIODevice fBuffer;
00064 };
00065
00066 } // namespace rel
00067
00068 rel::TypeStream &operator << (rel::TypeStream &output, const rel::Path &src);
00069
00070 #endif
00071
1.2.10 written by Dimitri van Heesch,
© 1997-2001