Qore Programming Language  0.8.7
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
QoreURL.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  QoreURL.h
4 
5  Network functions and macros
6 
7  Qore Programming Language
8 
9  Copyright 2003 - 2013 David Nichols
10 
11  This library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU Lesser General Public
13  License as published by the Free Software Foundation; either
14  version 2.1 of the License, or (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  Lesser General Public License for more details.
20 
21  You should have received a copy of the GNU Lesser General Public
22  License along with this library; if not, write to the Free Software
23  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24  */
25 
26 #ifndef _QORE_QOREURL_H
27 
28 #define _QORE_QOREURL_H
29 
31 class QoreURL {
32 private:
34  struct qore_url_private *priv;
35 
36  DLLLOCAL void zero();
37  DLLLOCAL void reset();
38  DLLLOCAL void parseIntern(const char* url);
39 
41  DLLLOCAL QoreURL(const QoreURL&);
42 
44  DLLLOCAL QoreURL& operator=(const QoreURL&);
45 
46 public:
48 
50  DLLEXPORT QoreURL();
51 
53 
56  DLLEXPORT QoreURL(const char* url);
57 
59 
62  DLLEXPORT QoreURL(const QoreString* url);
63 
65 
69  DLLEXPORT QoreURL(const char* url, bool keep_brackets);
70 
72 
76  DLLEXPORT QoreURL(const QoreString* url, bool keep_brackets);
77 
79  DLLEXPORT ~QoreURL();
80 
82 
86  DLLEXPORT int parse(const char* url);
87 
89 
93  DLLEXPORT int parse(const QoreString* url);
94 
96 
102  DLLEXPORT int parse(const char* url, bool keep_brackets);
103 
105 
111  DLLEXPORT int parse(const QoreString* url, bool keep_brackets);
112 
114 
116  DLLEXPORT bool isValid() const;
117 
119 
131  DLLEXPORT QoreHashNode* getHash();
132 
134 
136  DLLEXPORT const QoreString* getHost() const;
137 
139 
141  DLLEXPORT const QoreString* getUserName() const;
142 
144 
146  DLLEXPORT const QoreString* getPassword() const;
147 
149 
151  DLLEXPORT const QoreString* getPath() const;
152 
154  DLLEXPORT const QoreString* getProtocol() const;
155 
157 
159  DLLEXPORT int getPort() const;
160 
161  // the "take" methods return the char* pointers for the data
162  // the caller owns the memory
163 
165 
168  DLLEXPORT char* take_path();
169 
171 
174  DLLEXPORT char* take_username();
175 
177 
180  DLLEXPORT char* take_password();
181 
183 
186  DLLEXPORT char* take_host();
187 };
188 
189 #endif