diff --git a/inc/hgl/URI.h b/inc/hgl/URI.h deleted file mode 100644 index c60fb05..0000000 --- a/inc/hgl/URI.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef HGL_URI_INCLUDE -#define HGL_URI_INCLUDE - -#include -namespace hgl -{ - const uint16 GetSchemePort(const char *scheme); - - /** - * 统一地址标识符类
- *

注:此类只处理名称,与真实文件系统/网络系统没有任何相关操作

- * - *

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 - *

- * - *

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 - *

- * - *

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 - *

- */ - 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 diff --git a/src/URI.cpp b/src/URI.cpp deleted file mode 100644 index 305e009..0000000 --- a/src/URI.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include - -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