-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathURL.cpp
More file actions
88 lines (70 loc) · 1.47 KB
/
URL.cpp
File metadata and controls
88 lines (70 loc) · 1.47 KB
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
#include "StdAfx.h"
#include "URL.h"
CString CURL::m_strURL;
CString CURL::m_strIP;
CString CURL::m_strFileName;
CString CURL::m_strAlias;
CURL::CURL(const CString& strURL)
{
m_strURL.Empty();
m_strIP.Empty();
m_strFileName.Empty();
m_strAlias.Empty();
ExtraIP(strURL);
ExtraFileName(strURL);
ExtraAlias(strURL);
ExtraURL(strURL);
}
CURL::~CURL(void)
{
}
void CURL::ExtraIP(const CString& strSource)
{
const TCHAR szHttp[] = _T("http://");
if (strSource.IsEmpty())
{
return;
}
m_strIP.Empty();
const TCHAR* pIpStart = strSource;
pIpStart += _tcslen(szHttp);
while (*pIpStart != TEXT('/'))
{
m_strIP += *pIpStart++;
}
}
void CURL::ExtraFileName(const CString& strSource)
{
if (strSource.IsEmpty())
{
return;
}
int nNameStart = strSource.ReverseFind(_T('/'));
const TCHAR* pName = strSource;
pName += nNameStart;
CString strTemp;
while (*pName++ != '\0')
{
strTemp += *pName;
}
int nIndex = strTemp.Find('|');
m_strFileName = strTemp.Left(nIndex);
}
void CURL::ExtraAlias(const CString& strSource)
{
int nIndex = nIndex = strSource.Find('|');
if (-1 == nIndex)
{
return;
}
m_strAlias = strSource.Right(strSource.GetLength() - (nIndex + 1));
}
void CURL::ExtraURL(const CString& strSource)
{
int nIndex = nIndex = strSource.Find('|');
if (-1 == nIndex)
{
return;
}
m_strURL = strSource.Left(nIndex);
}