-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
CFPP-URL.hpp
158 lines (137 loc) · 6.73 KB
/
CFPP-URL.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/*******************************************************************************
* Copyright (c) 2014, Jean-David Gadina - www.xs-labs.com / www.digidna.net
* Distributed under the Boost Software License, Version 1.0.
*
* Boost Software License - Version 1.0 - August 17th, 2003
*
* Permission is hereby granted, free of charge, to any person or organization
* obtaining a copy of the software and accompanying documentation covered by
* this license (the "Software") to use, reproduce, display, distribute,
* execute, and transmit the Software, and to prepare derivative works of the
* Software, and to permit third-parties to whom the Software is furnished to
* do so, all subject to the following:
*
* The copyright notices in the Software and this entire statement, including
* the above license grant, this restriction and the following disclaimer,
* must be included in all copies of the Software, in whole or in part, and
* all derivative works of the Software, unless such copies or derivative
* works are solely in the form of machine-executable object code generated by
* a source language processor.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
******************************************************************************/
/*!
* @header CFPP-URL.h
* @copyright (c) 2014 - Jean-David Gadina - www.xs-labs.com / www.digidna.net
* @abstract CoreFoundation++ CFURLRef wrapper
*/
#ifndef CFPP_URL_H
#define CFPP_URL_H
namespace CF
{
class CFPP_EXPORT URL: public Type
{
public:
typedef enum
{
PartAll = 0x00,
PartFileSystemPath = 0x01,
PartFragment = 0x02,
PartHostName = 0x03,
PartLastPathComponent = 0x04,
PartNetLocation = 0x05,
PartParameterString = 0x06,
PartPassword = 0x07,
PartPath = 0x08,
PartPathExtension = 0x09,
PartQueryString = 0x0A,
PartResourceSpecifier = 0x0B,
PartScheme = 0x0C,
PartStrictPath = 0x0D,
PartUserName = 0x0E
}
Part;
typedef enum
{
PathStylePOSIX = 0x00,
PathStyleWindows = 0x01
}
PathStyle;
static URL FileSystemURL( const std::string & path, bool isDir = false );
static URL FileSystemURL( const char * path, bool isDir = false );
static URL FileSystemURL( CFTypeRef path, bool isDir = false );
static URL FileSystemURL( CFStringRef path, bool isDir = false );
URL( void );
URL( const URL & value );
URL( const AutoPointer & value );
URL( CFTypeRef value );
URL( CFURLRef value );
URL( CFStringRef value );
URL( const std::string & value );
URL( const char * value );
#ifdef CFPP_HAS_CPP11
URL( URL && value );
#endif
virtual ~URL( void );
URL & operator = ( URL value );
URL & operator = ( const AutoPointer & value );
URL & operator = ( CFTypeRef value );
URL & operator = ( CFURLRef value );
URL & operator = ( CFStringRef value );
URL & operator = ( const std::string & value );
URL & operator = ( const char * value );
bool operator == ( const URL & value ) const;
bool operator == ( CFTypeRef value ) const;
bool operator == ( CFURLRef value ) const;
bool operator == ( CFStringRef value ) const;
bool operator == ( const std::string & value ) const;
bool operator == ( const char * value ) const;
bool operator != ( const URL & value ) const;
bool operator != ( CFTypeRef value ) const;
bool operator != ( CFURLRef value ) const;
bool operator != ( CFStringRef value ) const;
bool operator != ( const std::string & value ) const;
bool operator != ( const char * value ) const;
URL & operator /= ( CFStringRef value );
URL & operator /= ( const std::string & value );
URL & operator /= ( const char * value );
std::string operator [] ( Part part ) const;
operator std::string () const;
virtual CFTypeID GetTypeID( void ) const;
virtual CFTypeRef GetCFObject( void ) const;
String GetFileSystemPath( PathStyle style = PathStylePOSIX ) const;
String GetFragment( void ) const;
String GetHostName( void ) const;
String GetLastPathComponent( void ) const;
String GetNetLocation( void ) const;
String GetParameterString( void ) const;
String GetPassword( void ) const;
String GetPath( void ) const;
String GetPathExtension( void ) const;
String GetQueryString( void ) const;
String GetResourceSpecifier( void ) const;
String GetScheme( void ) const;
String GetStrictPath( void ) const;
String GetUserName( void ) const;
Number GetPortNumber( void ) const;
bool HasDirectoryPath( void ) const;
void AppendPathComponent( CFStringRef component, bool isDirectory = false );
void AppendPathComponent( const std::string & component, bool isDirectory = false );
void AppendPathComponent( const char * component, bool isDirectory = false );
void AppendPathExtension( CFStringRef extension );
void AppendPathExtension( const std::string & extension );
void AppendPathExtension( const char * extension );
void DeleteLastPathComponent( void );
void DeletePathExtension( void );
friend void swap( URL & v1, URL & v2 );
private:
CFURLRef _cfObject;
};
}
#endif /* CFPP_URL_H */