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

📄 xmluri.hpp

📁 基于属性证书的访问控制源代码,由c++编写,包括openssl,xercesc等
💻 HPP
📖 第 1 页 / 共 2 页
字号:
     * if this is a URI conforming to the generic URI syntax and     * the path value is not null.     *     * @param newFragment the fragment for this URI     *     */     void setFragment(const XMLCh* const newFragment);     // -----------------------------------------------------------------------    //  Miscellaneous methods    // -----------------------------------------------------------------------    /**     * Determine whether a given string contains only URI characters (also     * called "uric" in RFC 2396). uric consist of all reserved     * characters, unreserved characters and escaped characters.     *     * @return true if the string is comprised of uric, false otherwise     */    static bool isURIString(const XMLCh* const uric);    /**     * Determine whether a given string is a valid URI     */    static bool isValidURI( const XMLUri* const baseURI                          , const XMLCh* const uriStr);    /**     * Determine whether a given string is a valid URI     */    static bool isValidURI( bool haveBaseURI                          , const XMLCh* const uriStr);    /***     * Support for Serialization/De-serialization     ***/    DECL_XSERIALIZABLE(XMLUri)    XMLUri(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);private:    static const XMLCh MARK_OR_RESERVED_CHARACTERS[];    static const XMLCh RESERVED_CHARACTERS[];    static const XMLCh MARK_CHARACTERS[];    static const XMLCh SCHEME_CHARACTERS[];    static const XMLCh USERINFO_CHARACTERS[];    static const XMLCh REG_NAME_CHARACTERS[];    static const XMLCh PATH_CHARACTERS[];    //helper method for getUriText    void buildFullText();    // -----------------------------------------------------------------------    //  Private helper methods    // -----------------------------------------------------------------------    /**     * Determine whether a character is a reserved character:     *     * @return true if the string contains any reserved characters     */    static bool isReservedCharacter(const XMLCh theChar);        /**     * Determine whether a character is a path character:     *     * @return true if the character is path character     */    static bool isPathCharacter(const XMLCh theChar);    /**     * Determine whether a char is an unreserved character.     *     * @return true if the char is unreserved, false otherwise     */    static bool isUnreservedCharacter(const XMLCh theChar);    /**     * Determine whether a char is an reserved or unreserved character.     *     * @return true if the char is reserved or unreserved, false otherwise     */                    static bool isReservedOrUnreservedCharacter(const XMLCh theChar);    /**     * Determine whether a scheme conforms to the rules for a scheme name.     * A scheme is conformant if it starts with an alphanumeric, and     * contains only alphanumerics, '+','-' and '.'.     *     * @return true if the scheme is conformant, false otherwise     */    static bool isConformantSchemeName(const XMLCh* const scheme);    /**     * Determine whether a userInfo conforms to the rules for a userinfo.     *     * @return true if the scheme is conformant, false otherwise     */    static void isConformantUserInfo(const XMLCh* const userInfo        , MemoryManager* const manager);        /**     * Determines whether the components host, port, and user info     * are valid as a server authority.     *     * @return true if the given host, port, and userinfo compose     * a valid server authority     */    static bool isValidServerBasedAuthority(const XMLCh* const host                                           , const int hostLen                                           , const int port                                           , const XMLCh* const userinfo                                           , const int userLen);                                               /**     * Determines whether the components host, port, and user info     * are valid as a server authority.     *     * @return true if the given host, port, and userinfo compose     * a valid server authority     */    static bool isValidServerBasedAuthority(const XMLCh* const host                                           , const int port                                           , const XMLCh* const userinfo                                           , MemoryManager* const manager);         /**    * Determines whether the given string is a registry based authority.    *     * @param authority the authority component of a URI    *     * @return true if the given string is a registry based authority    */    static bool isValidRegistryBasedAuthority(const XMLCh* const authority                                             , const int authLen);   /**    * Determines whether the given string is a registry based authority.    *     * @param authority the authority component of a URI    *     * @return true if the given string is a registry based authority    */    static bool isValidRegistryBasedAuthority(const XMLCh* const authority);    /**     * Determine whether a string is syntactically capable of representing     * a valid IPv4 address, IPv6 reference or the domain name of a network host.     *     * A valid IPv4 address consists of four decimal digit groups     * separated by a '.'.     *     * See RFC 2732 Section 3, and RFC 2373 Section 2.2, for the      * definition of IPv6 references.     *     * A hostname consists of domain labels (each of which must begin and     * end with an alphanumeric but may contain '-') separated by a '.'.     * See RFC 2396 Section 3.2.2.     *     * @return true if the string is a syntactically valid IPv4 address     *              or hostname     */     static bool isWellFormedAddress(const XMLCh* const addr         , MemoryManager* const manager);         /**     * Determines whether a string is an IPv4 address as defined by      * RFC 2373, and under the further constraint that it must be a 32-bit     * address. Though not expressed in the grammar, in order to satisfy      * the 32-bit address constraint, each segment of the address cannot      * be greater than 255 (8 bits of information).     *     * @return true if the string is a syntactically valid IPv4 address     */     static bool isWellFormedIPv4Address(const XMLCh* const addr, const int length);         /**     * Determines whether a string is an IPv6 reference as defined     * by RFC 2732, where IPv6address is defined in RFC 2373. The      * IPv6 address is parsed according to Section 2.2 of RFC 2373,     * with the additional constraint that the address be composed of     * 128 bits of information.     *     * Note: The BNF expressed in RFC 2373 Appendix B does not      * accurately describe section 2.2, and was in fact removed from     * RFC 3513, the successor of RFC 2373.     *     * @return true if the string is a syntactically valid IPv6 reference     */     static bool isWellFormedIPv6Reference(const XMLCh* const addr, const int length);         /**     * Helper function for isWellFormedIPv6Reference which scans the      * hex sequences of an IPv6 address. It returns the index of the      * next character to scan in the address, or -1 if the string      * cannot match a valid IPv6 address.      *     * @param address the string to be scanned     * @param index the beginning index (inclusive)     * @param end the ending index (exclusive)     * @param counter a counter for the number of 16-bit sections read     * in the address     *     * @return the index of the next character to scan, or -1 if the     * string cannot match a valid IPv6 address     */     static int scanHexSequence (const XMLCh* const addr, int index, int end, int& counter);    /**     * Get the indicator as to whether this URI uses the "generic URI"     * syntax.     *     * @return true if this URI uses the "generic URI" syntax, false     *         otherwise     */     bool isGenericURI();    // -----------------------------------------------------------------------    //  Miscellaneous methods    // -----------------------------------------------------------------------    /**     * Initialize all fields of this URI from another URI.     *     * @param toCopy the URI to copy (cannot be null)     */     void initialize(const XMLUri& toCopy);    /**     * Initializes this URI from a base URI and a URI specification string.     * See RFC 2396 Section 4 and Appendix B for specifications on parsing     * the URI and Section 5 for specifications on resolving relative URIs     * and relative paths.     *     * @param baseURI the base URI (may be null if uriSpec is an absolute     *               URI)     *     * @param uriSpec the URI spec string which may be an absolute or     *                  relative URI (can only be null/empty if base     *                  is not null)     *     */     void initialize(const XMLUri* const baseURI                   , const XMLCh*  const uriSpec);    /**     * Initialize the scheme for this URI from a URI string spec.     *     * @param uriSpec the URI specification (cannot be null)     *     */     void initializeScheme(const XMLCh* const uriSpec);    /**     * Initialize the authority (userinfo, host and port) for this     * URI from a URI string spec.     *     * @param uriSpec the URI specification (cannot be null)     *     */     void initializeAuthority(const XMLCh* const uriSpec);    /**     * Initialize the path for this URI from a URI string spec.     *     * @param uriSpec the URI specification (cannot be null)     *     */     void initializePath(const XMLCh* const uriSpec);     /**      * cleanup the data variables      *      */     void cleanUp();    static bool isConformantSchemeName(const XMLCh* const scheme,                                       const int schemeLen);    static bool processScheme(const XMLCh* const uriStr, int& index);    static bool processAuthority(const XMLCh* const uriStr, const int authLen);    static bool isWellFormedAddress(const XMLCh* const addr, const int addrLen);    static bool processPath(const XMLCh* const pathStr, const int pathStrLen,                            const bool isSchemePresent);    // -----------------------------------------------------------------------    //  Data members    //    //  for all the data member, we own it,    //  responsible for the creation and/or deletion for    //  the memory allocated.    //    // -----------------------------------------------------------------------    XMLCh*          fScheme;    XMLCh*          fUserInfo;    XMLCh*          fHost;    int             fPort;    XMLCh*          fRegAuth;    XMLCh*          fPath;    XMLCh*          fQueryString;    XMLCh*          fFragment;    XMLCh*          fURIText;    MemoryManager*  fMemoryManager;};// ---------------------------------------------------------------------------//  XMLUri: Getter methods// ---------------------------------------------------------------------------inline const XMLCh* XMLUri::getScheme() const{    return fScheme;}inline const XMLCh* XMLUri::getUserInfo() const{	return fUserInfo;}inline const XMLCh* XMLUri::getHost() const{	return fHost;}inline int XMLUri::getPort() const{	return fPort;}inline const XMLCh* XMLUri::getRegBasedAuthority() const{	return fRegAuth;}inline const XMLCh* XMLUri::getPath() const{	return fPath;}inline const XMLCh* XMLUri::getQueryString() const{	return fQueryString;}inline const XMLCh* XMLUri::getFragment() const{	return fFragment;}inline const XMLCh* XMLUri::getUriText() const{    //    //  Fault it in if not already. Since this is a const method and we    //  can't use mutable members due the compilers we have to support,    //  we have to cast off the constness.    //    if (!fURIText)        ((XMLUri*)this)->buildFullText();    return fURIText;}// ---------------------------------------------------------------------------//  XMLUri: Helper methods// ---------------------------------------------------------------------------inline bool XMLUri::isReservedOrUnreservedCharacter(const XMLCh theChar){   return (XMLString::isAlphaNum(theChar) ||           XMLString::indexOf(MARK_OR_RESERVED_CHARACTERS, theChar) != -1);}inline bool XMLUri::isReservedCharacter(const XMLCh theChar){    return (XMLString::indexOf(RESERVED_CHARACTERS, theChar) != -1);}inline bool XMLUri::isPathCharacter(const XMLCh theChar){    return (XMLString::indexOf(PATH_CHARACTERS, theChar) != -1);}inline bool XMLUri::isUnreservedCharacter(const XMLCh theChar){    return (XMLString::isAlphaNum(theChar) ||            XMLString::indexOf(MARK_CHARACTERS, theChar) != -1);}XERCES_CPP_NAMESPACE_END#endif

⌨️ 快捷键说明

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