• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • KDevelop Utility Library
 

KDevelop Utility Library

  • lib
  • util
rurl.h
Go to the documentation of this file.
1 #ifndef RURL_H_LIB
2 #define RURL_H_LIB
3 
4 #include <kurl.h>
5 
12 namespace Relative
13 {
14 
16 class Name{
17 public:
18  enum Type { File, Directory, Auto };
19 
26  Name(const TQString &rurl, const Type type = Auto);
27  Name(const char *rurl, const Type type = Auto);
28 
30  void setRURL(const TQString &rurl, const Type type);
35  TQString rurl() const;
36 
40  void addPath(const TQString &addendum);
42  void cleanRURL();
43 
47  TQString extension(bool complete = true) const;
50  TQString fileName() const;
52  TQString directory() const;
53 
55  bool isFile() const;
57  bool isDirectory() const;
59  bool isValid() const;
60 
62  Type type() const;
65  void setType(const Type type);
66 
69  static Name relativeName(const TQString &base, const TQString &url);
71  static TQString cleanName(const TQString &rurl);
74  static TQString correctName(const TQString &rurl, const Type type = Auto);
75 
76  bool operator == (const Name &rname);
77  bool operator != (const Name &rname);
78 
79 protected:
83  void correct();
84 
85 private:
86  TQString m_rurl;
87  Type m_type;
88 };
89 
91 class URL: public Name{
92 public:
97  URL(KURL base, KURL url, Type type = Auto);
100  URL(KURL base, TQString url, bool isUrlRelative, Type type = Auto);
101 
103  void setBase(const KURL &base);
106  void setBase(const TQString &base);
108  KURL base() const;
110  TQString basePath() const;
111 
118  KURL url() const;
123  TQString urlPath() const;
129  TQString urlDirectory() const;
130 
133  URL relativeTo(KURL base);
134 
136  static URL relativeURL(KURL base, KURL url);
139  static URL relativeURL(KURL base, TQString url, bool isUrlRelative);
140 
141  bool operator == (const URL &url);
142  bool operator != (const URL &url);
143 
144 private:
145  KURL m_base;
146 };
147 
149 class Directory: public URL{
150 public:
152  Directory(KURL base, KURL url);
154  Directory(KURL base, TQString url, bool isRelativeUrl);
155 
157  void setRURL(TQString rurl);
158 
159 private:
160  void setRURL(TQString rurl, Type type);
161 
162 };
163 
165 class File: public URL{
166 public:
168  File(KURL base, KURL url);
170  File(KURL base, TQString url, bool isRelativeUrl);
171 
173  void setRURL(TQString rurl);
174 
175 private:
176  void setRURL(TQString rurl, Type type);
177 
178 };
179 
180 }
181 
182 #endif
Relative::Name::addPath
void addPath(const TQString &addendum)
Adds addendum to the directory path.
Definition: rurl.cpp:80
Relative::Name::type
Type type() const
Returns a type of the relative name - file or directory.
Definition: rurl.cpp:174
Relative::Name::setRURL
void setRURL(const TQString &rurl, const Type type)
Sets the relative name.
Definition: rurl.cpp:68
Relative::Name::extension
TQString extension(bool complete=true) const
Returns the extension of a file or TQString() for directories.
Definition: rurl.cpp:110
Relative::File
Relative file name.
Definition: rurl.h:165
Relative::Name::Name
Name(const TQString &rurl, const Type type=Auto)
Constructor takes the relative name of a directory or file.
Definition: rurl.cpp:10
Relative::URL
Relative name of file or directory to some base location.
Definition: rurl.h:91
Relative::Name::isFile
bool isFile() const
Returns true if the type of RName is file.
Definition: rurl.cpp:138
Relative::Directory
Relative directory name.
Definition: rurl.h:149
Relative::Name::correctName
static TQString correctName(const TQString &rurl, const Type type=Auto)
Corrects rurl according to the given type and returns corrected url.
Definition: rurl.cpp:46
Relative
Classes and functions to work with relative URLs.
Definition: rurl.cpp:5
Relative::Name::relativeName
static Name relativeName(const TQString &base, const TQString &url)
Creates and returns relative name between base and url.
Definition: rurl.cpp:184
Relative::Name
Relative name of a file or directory.
Definition: rurl.h:16
Relative::Name::correct
void correct()
Corrects m_rurl and m_type according to the relative name storing policy, i.e.
Definition: rurl.cpp:22
Relative::Name::setType
void setType(const Type type)
Sets a type of the relative name - file or directory.
Definition: rurl.cpp:179
Relative::Name::rurl
TQString rurl() const
Gets the relative name in form dir/dir/ -> directory or dir/dir/file -> file.
Definition: rurl.cpp:75
Relative::Name::directory
TQString directory() const
Returns the name of the directory or TQString() if there are no dirs in path.
Definition: rurl.cpp:130
Relative::Name::cleanRURL
void cleanRURL()
Removes "//" from the name.
Definition: rurl.cpp:86
Relative::Name::cleanName
static TQString cleanName(const TQString &rurl)
Cleans rurl by removing extra slashes.
Definition: rurl.cpp:91
Relative::Name::isDirectory
bool isDirectory() const
Returns true if the type of RName is directory.
Definition: rurl.cpp:143
Relative::Name::fileName
TQString fileName() const
Returns the name of the file without the path or TQString() for directories.
Definition: rurl.cpp:123
Relative::Name::isValid
bool isValid() const
Checks if RName is valid.
Definition: rurl.cpp:158

KDevelop Utility Library

Skip menu "KDevelop Utility Library"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

KDevelop Utility Library

Skip menu "KDevelop Utility Library"
  • buildtools
  •   lib
  •     base
  •     parsers
  •       autotools
  •       qmake
  •     widgets
  •   api
  • languages
  •   lib
  •     debugger
  •     designer_integration
  •     interfaces
  • lib
  •   catalog
  •   interfaces
  •     extensions
  •     external
  •     extras
  •   util
  •   widgets
  •     propeditor
  • parts
  •   documentation
  •     interfaces
  • src
  •   profileengine
  •     lib
Generated for KDevelop Utility Library by doxygen 1.8.13
This website is maintained by Timothy Pearson.