- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# FUtils/FUUri.h

    00001 /*
    00002     Copyright (C) 2005-2007 Feeling Software Inc.
    00003     Portions of the code are:
    00004     Copyright (C) 2005-2007 Sony Computer Entertainment America
    00005
    00006     MIT License: http://www.opensource.org/licenses/mit-license.php
    00007 */
    00008 /*
    00009     Based on the FS Import classes:
    00010     Copyright (C) 2005-2006 Feeling Software Inc
    00011     Copyright (C) 2005-2006 Autodesk Media Entertainment
    00012     MIT License: http://www.opensource.org/licenses/mit-license.php
    00013 */
    00014
    00015 #ifndef _FU_URI_H_
    00016 #define _FU_URI_H_
    00017
    00033 class FCOLLADA_EXPORT FUUri
    00034 {
    00035 public:
    00036     enum Scheme
    00037     {
    00038         NONE,
    00039         FILE,
    00040         FTP,
    00041         HTTP,
    00042         HTTPS
    00043     };
    00044
    00045 private:
    00047     Scheme scheme;
    00049     fstring schemeDelimiter;
    00051     fstring username;
    00053     fstring password;
    00055     fstring hostname;
    00057     uint32 port;
    00059     fstring path;
    00061     fstring query;
    00063     fstring fragment;
    00064
    00065     static bool IsAlpha(fchar fc);
    00066     static bool IsDigit(fchar fc);
    00067     static bool IsAlphaNumeric(fchar fc);
    00068     static bool IsMark(fchar fc);
    00069     static bool IsHex(fchar fc);
    00070     static bool IsReserved(fchar fc);
    00071
    00076     void ExtractPathStack(const fstring& name, FStringList& list, bool includeFilename = false) const;
    00077 public:
    00079     FUUri();
    00080
    00084     FUUri(const fstring& uri, bool escape = false);
    00085
    00095     FUUri(Scheme scheme, const fstring& username, const fstring& passwd, const fstring& host, uint32 port, const fstring& path = FC(""), const fstring& query = FC(""), const fstring& fragment = FC(""));
    00096
    00102     FUUri(Scheme scheme, const fstring& host, const fstring& path = FC(""), const fstring& fragment = FC(""));
    00103
    00107     FUUri(const fstring& path, const fstring& fragment);
    00108
    00111     inline Scheme GetScheme() const { return scheme; }
    00112
    00115     inline const fstring& GetSchemeDelimiter() const { return schemeDelimiter; }
    00116
    00119     fstring GetUserInformations() const;
    00120
    00123     inline const fstring& GetHostname() const { return hostname; }
    00124
    00127     inline uint32 GetPort() const { return port; }
    00128
    00131     inline void SetPort(uint32 _port) { port = _port; }
    00132
    00135     inline const fstring& GetPath() const { return path; }
    00136
    00139     inline const fstring& GetQuery() const { return query; }
    00140
    00143     inline void SetQuery(const fstring& _query) { query = _query; }
    00144
    00147     inline const fstring& GetFragment() const { return fragment; }
    00148
    00151     inline void SetFragment(const fstring& _fragment) { fragment = _fragment; }
    00152
    00155     fstring GetAuthority() const;
    00156
    00159     fstring GetAbsolutePath() const;
    00160
    00164     fstring GetAbsoluteUri(bool fragment = true) const;
    00165
    00168     fstring GetRelativeUri(const FUUri& uri) const;
    00169
    00173     fstring MakeRelative(const fstring& path) const;
    00174
    00178     fstring MakeAbsolute(const fstring& relativePath) const;
    00179
    00182     void MakeAbsolute(FUUri& uri) const;
    00183
    00187     FUUri Resolve(const fstring& relativePath) const;
    00188
    00191     bool IsFile() const;
    00192
    00196     static fstring Escape(const fstring& path);
    00197 };
    00198
    00199 typedef fm::vector<FUUri> FUUriList;
    00201 #endif // _FU_URI_H_
    00202