本文整理汇总了C++中XMLURL::isRelative方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLURL::isRelative方法的具体用法?C++ XMLURL::isRelative怎么用?C++ XMLURL::isRelative使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLURL
的用法示例。
在下文中一共展示了XMLURL::isRelative方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: conglomerateWithBase
bool XMLURL::conglomerateWithBase(const XMLURL& baseURL, bool useExceptions)
{
// The base URL cannot be relative
if (baseURL.isRelative())
{
if (useExceptions)
ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_RelativeBaseURL, fMemoryManager);
else
return false;
}
//
// Check a special case. If all we have is a fragment, then we want
// to just take the base host and path, plus our fragment.
//
if ((fProtocol == Unknown)
&& !fHost
&& !fPath
&& fFragment)
{
// Just in case, make sure we don't leak the user or password values
fMemoryManager->deallocate(fUser);//delete [] fUser;
fUser = 0;
fMemoryManager->deallocate(fPassword);//delete [] fPassword;
fPassword = 0;
// Copy over the protocol and port number as is
fProtocol = baseURL.fProtocol;
fPortNum = baseURL.fPortNum;
// Replicate the base fields that are provided
fHost = XMLString::replicate(baseURL.fHost, fMemoryManager);
fUser = XMLString::replicate(baseURL.fUser, fMemoryManager);
fPassword = XMLString::replicate(baseURL.fPassword, fMemoryManager);
fPath = XMLString::replicate(baseURL.fPath, fMemoryManager);
return true;
}
//
// All we have to do is run up through our fields and, for each one
// that we don't have, use the based URL's. Once we hit one field
// that we have, we stop.
//
if (fProtocol != Unknown)
return true;
fProtocol = baseURL.fProtocol;
//
// If the protocol is not file, and we either already have our own
// host, or the base does not have one, then we are done.
//
if (fProtocol != File)
{
if (fHost || !baseURL.fHost)
return true;
}
// Replicate all of the hosty stuff if the base has one
if (baseURL.fHost)
{
// Just in case, make sure we don't leak a user or password field
fMemoryManager->deallocate(fUser);//delete [] fUser;
fUser = 0;
fMemoryManager->deallocate(fPassword);//delete [] fPassword;
fPassword = 0;
fMemoryManager->deallocate(fHost);//delete [] fHost;
fHost = 0;
fHost = XMLString::replicate(baseURL.fHost, fMemoryManager);
fUser = XMLString::replicate(baseURL.fUser, fMemoryManager);
fPassword = XMLString::replicate(baseURL.fPassword, fMemoryManager);
fPortNum = baseURL.fPortNum;
}
// If we have a path and its absolute, then we are done
const bool hadPath = (fPath != 0);
if (hadPath)
{
if (*fPath == chForwardSlash)
return true;
}
// Its a relative path, so weave them together.
if (baseURL.fPath) {
XMLCh* temp = XMLPlatformUtils::weavePaths(baseURL.fPath, fPath ,fMemoryManager);
fMemoryManager->deallocate(fPath);//delete [] fPath;
fPath = temp;
}
// If we had any original path, then we are done
if (hadPath)
return true;
// We had no original path, so go on to deal with the query/fragment parts
if (fQuery || !baseURL.fQuery)
return true;
fQuery = XMLString::replicate(baseURL.fQuery, fMemoryManager);
if (fFragment || !baseURL.fFragment)
//.........这里部分代码省略.........