url.h

来自「一百个病毒的源代码 包括熊猫烧香等 极其具有研究价值」· C头文件 代码 · 共 84 行

H
84
字号
// Larbin// Sebastien Ailleret// 15-11-99 -> 02-12-99/* This class describes an URL */#ifndef URL_H#define URL_H#include <stdlib.h>#include "types.h"#include "xutils/string.h"struct global;class url { private:  char *host;  uint port;  char *file;  uint depth;  /* parse the url */  void parse (char *s);  /** parse a file with base */  void parseWithBase (char *u, char *base);  /* normalize file name */  bool normalize (char *file);  /* Does this url starts with a protocol name */  bool isProtocol (char *s); public:  /* Constructor : Parses an url (u is deleted) */  url (char *u, uint depth, char *base = NULL);  /* Constructor : read the url from a file (cf serialize) */  url (String *line);  /* Destructor */  ~url ();  /* Is it a valid url ? */  int isValid ();  /* print an URL */  void print ();  /* return the host */  char *getHost ();  /* return the port */  uint getPort ();  /* return the file */  char *getFile ();  /** Depth in the Site */  uint getDepth ();  /** Set depth to one if we are at an entry point in the site */  void setDepth (char *fromHost);  /** return the base of the url   * give means that you have to delete the string yourself   */  char *giveBase ();  /** return a char * representation of the url   * give means that you have to delete the string yourself   */  char *giveUrl ();  /* return a hashcode for the host of this url */  uint hostHashCode ();  /* return a hashcode for this url */  uint hashCode ();  /* serialize the url */  char *serialize (int fds);};#endif // URL_H

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?