⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 htbind.h

📁 www工具包. 这是W3C官方支持的www支撑库. 其中提供通用目的的客户端的WebAPI: complete HTTP/1.1 (with caching, pipelining, PUT, POS
💻 H
字号:
/*    					W3C Sample Code Library libwww File Suffix Binding!  File Suffix Binding Manager!*//***	(c) COPYRIGHT MIT 1995.**	Please first read the full copyright statement in the file COPYRIGH.*//*The preferences that we described in sectionRequest Preferences did not mentionwhat libwww should do if it doesn't know the data format of a document. Inmany protocols this information is provided by the remote server. Typicalexamples are MIME like protocols where the metainformation such as theContent-Type and the Content-Language is provided togetherwith the document. However, applications often have access to the local filesystem using file URLs which in general do not keep any or at leastvery little information of the file type. It is therefore required to havesome kind of binding between the file system and the preferences registeredin the Library which provides this mateinformation about the object.Often files in a file system is classified by some sort of a suffix, forexample, GIF files are often ending in .gif, text filesin .txt etc. This binding is not static and it is therefore requiredto have a dynamic binding just like the preferences themselves. An exampleof the latter is HTML files which on most Unix systems end in .htmlwhereas they on many MS-DOS based systems end in .htm.This module provides a generic binding mechanism between a file and itsrepresentation internally in libwww. It is not limited to simple file suffixclassification but can also be used in more advanced environments using databases etc. However, at this point we are interested in how we can registerbindings between file suffixes and for example content types, content languagesetc. The Bind manager is born with a certain knowledge about the set ofdelimiters but more can be added to provide the functionality desired.All the binding management could of course be replaced by a database interface.This module is implemented by HTBind.c, and it isa part of the  W3C Sample CodeLibrary.*/#ifndef HTBIND_H#define HTBIND_H#include "HTFormat.h"#include "HTAnchor.h"/*.  Initialization of the Module.These functions must be called on startup and termination of the application.This is done automatically by HTLibInit() andHTLibTerminate().*/extern BOOL HTBind_init		(void);extern BOOL HTBind_deleteAll	(void);/*.  Case Sensitivity.Should the search for suffixes be case sensitive or not? The default valueis case sensitive.*/extern void HTBind_caseSensitive	(BOOL sensitive);/*.  Suffix Delimiters.Change the set of suffix delimiters. The default is a platform dependentset defined in the tcp module.*/extern const char *HTBind_delimiters	(void);extern void HTBind_setDelimiters	(const char * new_suffixes);/*.  Set up Bindings Associated with a File Suffix.There are four types of bindings:	 	   o 	     Content Type (media type)	   o 	     Language	   o 	     Content Encoding	   o 	     Content Transfer Encoding	 	 And the associated set of methods is defined as:*/extern BOOL HTBind_add		(const char *	suffix,				 const char *	representation,				 const char *	encoding,				 const char *	transfer,				 const char *	language,				 double		value);extern BOOL HTBind_addType	(const char *	suffix,				 const char *	format,				 double		value);extern BOOL HTBind_addEncoding	(const char *	suffix,				 const char *	encoding,				 double		value);extern BOOL HTBind_addTransfer	(const char *	suffix,				 const char *	transfer,				 double		value);extern BOOL HTBind_addLanguage	(const char *	suffix,				 const char *	language,				 double		value);/*The first method is a "super" method for binding information to a file suffic.Any of the string values can be NULL. If filename suffix isalready defined its previous definition is overridden or modified. For example,a HTBind_setType and HTBind_setEncoding can becalled with the same suffix.Calling this with suffix set to "*" will set the default representation.Calling this with suffix set to "*.*" will set the default representationfor unknown suffix files which contain a "."NOTE: The suffixes can contain characters that must be escapedin a URL. However, they should not be encoded when parsed as thesuffix parameter..  Determine a suitable suffix.Use the set of bindings to find a suitable suffix (or index) for a certaincombination of language, media type and encoding given in the anchor. Returnsa pointer to a suitable suffix string that must be freed by the caller. Ifmore than one suffix is found they are all concatenated. If no suffix isfound, NULL is returned.*/extern char * HTBind_getSuffix	(HTParentAnchor * anchor);/*.  Determine the content of an Anchor.Use the set of bindings to find the combination of language, media type andencoding of a given anchor. If more than one suffix is found they are allsearched. The last suffix has highest priority, the first one lowest. Returnsthe HTAnchor object with the representationsfound. See also HTBind_getFormat*/extern BOOL HTBind_getAnchorBindings	(HTParentAnchor * anchor);/*.  Determine the content of a Response.Use the set of bindings to find the combination of language, media type andencoding of a given anchor. If more than one suffix is found they are allsearched. The last suffix has highest priority, the first one lowest. Returnsthe HTResponse object with the representationsfound. See also HTBind_getFormat*/extern BOOL HTBind_getResponseBindings	(HTResponse * response,                                         const char * url);/*.  Determine the content of File.Use the set of bindings to find the combination of language, media type andencoding of a given anchor. If more than one suffix is found they are allsearched. The last suffix has highest priority, the first one lowest. Returnsthe format, encoding, and language found. See alsoHTBind_getBindings.*/extern BOOL HTBind_getFormat (const char *	filename,			      HTFormat *	format,			      HTEncoding *	enc,			      HTEncoding *	cte,			      HTLanguage *	lang,			      double *		quality);/*End of declaration module*/#endif /* HTBIND_H *//*    @(#) $Id: HTBind.html,v 2.18 1999/06/30 21:05:13 frystyk Exp $*/

⌨️ 快捷键说明

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