removed URI.cpp/.h

This commit is contained in:
hyzboy 2024-03-08 22:08:26 +08:00
parent f2519a16be
commit bcc686f35d
No known key found for this signature in database
GPG Key ID: 067EE4525D4FB6D3
2 changed files with 0 additions and 186 deletions

View File

@ -1,97 +0,0 @@
#ifndef HGL_URI_INCLUDE
#define HGL_URI_INCLUDE
#include<hgl/type/String.h>
namespace hgl
{
const uint16 GetSchemePort(const char *scheme);
/**
* <br>
* <p>/</p>
*
* <p>example 1:
* http:// www.hyzgame.com / index .php
* ------- --------------- ----- ---
* scheme path main_name ext_name
*
* scheme: http
* path: www.hyzgame.com
* main_name: index
* ext_name: php
* </p>
*
* <p> example 2:
* file:// C:/windows/system32/1234.dll
*
* scheme: file
* driver: C
* path: Windows\System32
* main_name: 1234
* ext_name: dll
* fullname: C:\windows\system32\1234.dll
* </p>
*
* <p> example 3:
* C:\windows\system32\1234.dll
*
* scheme:
* driver: C
* path: Windows\System32
* main_name: 1234
* ext_name: dll
* fullname: C:\windows\system32\1234.dll
* </p>
*/
class URI
{
public:
enum class SchemeType
{
Unknow=0,
LocalFile, ///<本地文件系统
ArachivesFile, ///<档案文件(压缩包/tar/ISO镜像之类)
Device, ///<设备虚拟文件
Network, ///<网络
};
protected:
OSString origin_name;
OSString scheme_name; ///<协议名称(如http,ftp之类)
SchemeType scheme_type; ///<协议
UTF8String network_host; ///<网络主机(IP或网址)
uint16 network_port; ///<网络协议默认端口
OSString fullname; ///<完整文件名
OSString path_name; ///<路径名
OSString main_name; ///<主名称
OSString ext_name; ///<文件扩展名
UTF8String url;
public:
URI(const OSString &);
URI(const OSString &scheme,const OSString &path,const OSString &filename);
~URI()=default;
const bool isFile();
const bool isDevice();
const bool isNetwork();
public:
const OSString &path();
const OSString &main();
const OSString &ext();
const OSString &full();
const UTF8String &URL();
};//class Filename
}//namespace hgl
#endif//HGL_URI_INCLUDE

View File

@ -1,89 +0,0 @@
#include<hgl/URI.h>
namespace hgl
{
namespace
{
// https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
struct SchemePort
{
uint16 port;
char scheme[16];
};
const SchemePort SchemePortList[]=
{
{7, "echo"},
{21, "ftp"},
{22, "ssh"},
{23, "telnet"},
{25, "smtp"},
{53, "dns"},
{69, "tftp"},
{80, "http"},
{80, "ws"},
{110, "pop3"},
{119, "nntp"},
{123, "ntp"},
{143, "imap"},
{161, "snmp"},
{162, "snmptrap"},
{194, "irc"},
{199, "smux"},
{389, "ldap"},
{443, "https"},
{443, "wss"},
{445, "smb"},
{465, "smtps"},
{548, "afp"}, //Apple File Services
{554, "rtsp"},
{636, "ldaps"},
{853, "dnss"},
{873, "rsync"},
{993, "imaps"},
{5060, "sip"},
{5061, "sips"},
{5222, "xmpp"}
};
}
const uint16 GetSchemePort(const char *scheme)
{
for(const SchemePort &sp:SchemePortList)
if(strcmp(scheme,sp.scheme)==0)
return sp.port;
return 0;
}
URI::URI(const OSString &fn)
{
origin_name=fn;
scheme_type=SchemeType::Unknow;
}
URI::URI(const OSString &scheme,const OSString &path,const OSString &filename)
{
scheme_name=scheme;
if(scheme=="file")
scheme_type=SchemeType::LocalFile;
else
}
const bool URI::isFile()
{
if(scheme_type==SchemeType::Unknow)
{
}
if(scheme_type==SchemeType::LocalFile)
return(true);
return(false);
}
}//namespace hgl