WebAddress Class Reference

Represents a URL. More...

#include <webaddr.h>

Inheritance diagram for WebAddress:

CCObject CCObject SimpleCCObject SimpleCCObject List of all members.

Public Member Functions

WebAddressoperator= (const WebAddress &)
 Assignment operator.
void Combine (WebAddress Relative)
 Combines this Web Address with a base Web Address.
 WebAddress ()
 Default WebAddress class constructor.
 WebAddress (const WebAddress &InAddress)
 Copy Constructor for the WebAddress class.
 WebAddress (const String_256 &StringToParse, WebCorrectFlags wcfToUse=WebCorrectFlags())
INT32 operator== (WebAddress &Other)
 Equality operator.
String_256 GetWebAddress ()
 Returns the URL string.
const String_256GetScheme () const
const String_256GetNetLoc () const
const String_256GetPath () const
const String_256GetParameters () const
const String_256GetQuery () const
const String_256GetFragment () const
const BOOL IsAbsolute ()
BOOL IsHTTP () const
 Finds whether this Web Address starts with "HTTP:".
BOOL IsValidHTTP () const
 Finds whether this Web Address is a valid HTTP address.
BOOL IsLocalFile () const
 Works out if we consider this Web Address to be a local filename.
PathName GetPathName () const
const BOOL SchemeIsEmpty () const
const BOOL NetLocIsEmpty () const
const BOOL PathIsEmpty () const
const BOOL ParametersIsEmpty () const
const BOOL QueryIsEmpty () const
const BOOL FragmentIsEmpty () const
const BOOL IsEmpty () const
void SetScheme (String_256 &NewScheme)
void SetNetLoc (String_256 &NewNetLoc)
void SetPath (String_256 &NewPath)
void SetParameters (String_256 &NewPara)
void SetQuery (String_256 &NewQuery)
void SetFragment (String_256 &NewFragment)
WebAddressoperator= (const WebAddress &)
void Combine (WebAddress Relative)
 WebAddress ()
 WebAddress (const WebAddress &InAddress)
 WebAddress (const String_256 &StringToParse, WebCorrectFlags wcfToUse=WebCorrectFlags())
INT32 operator== (WebAddress &Other)
String_256 GetWebAddress ()
const String_256GetScheme () const
const String_256GetNetLoc () const
const String_256GetPath () const
const String_256GetParameters () const
const String_256GetQuery () const
const String_256GetFragment () const
const BOOL IsAbsolute ()
BOOL IsHTTP () const
BOOL IsValidHTTP () const
BOOL IsLocalFile () const
PathName GetPathName () const
const BOOL SchemeIsEmpty () const
const BOOL NetLocIsEmpty () const
const BOOL PathIsEmpty () const
const BOOL ParametersIsEmpty () const
const BOOL QueryIsEmpty () const
const BOOL FragmentIsEmpty () const
const BOOL IsEmpty () const
void SetScheme (String_256 &NewScheme)
void SetNetLoc (String_256 &NewNetLoc)
void SetPath (String_256 &NewPath)
void SetParameters (String_256 &NewPara)
void SetQuery (String_256 &NewQuery)
void SetFragment (String_256 &NewFragment)

Static Public Member Functions

static BOOL IsHTTP (const String_256 &strTest)
 Finds whether strTest starts with "HTTP:".
static BOOL IsHTTP (const String_256 &strTest)

Protected Member Functions

BOOL Parse (const String_256 &InString)
 Takes the string and splits it into its component parts.
BOOL SetFlags ()
 Sets the Web Address flags - at the moment the only flag is Absolute - by looking at the Web Address string member variables.
void Correct (String_256 *pstrCorrect, WebCorrectFlags wcfToUse=WebCorrectFlags())
 Corrects the URL string that the user has entered, according to the correction flags.
void CorrectBackslashes (String_256 *pstrCorrect)
 Corrects any backslashes in the entered string to slashes.
void CorrectLocalFilenames (String_256 *pstrCorrect)
 Assumes pstrCorrect is a local filename, then converts it to a URL referring to a local filename.
void CorrectNetscapeFilenames (String_256 *pstrCorrect)
 Converts a Netscape local filename (file:///xxxxxxx) to an IE3 local filename (file://xxxxxxx) by simply removing the third slash.
void CorrectFTP (String_256 *pstrCorrect)
 Puts "ftp:" on the start of pstrCorrect.
void CorrectHTTP (String_256 *pstrCorrect)
 Puts "http:" on the start of pstrCorrect.
void CorrectMailto (String_256 *pstrCorrect)
 Puts "mailto:" on the start of pstrCorrect.
void CorrectNoSlash (String_256 *pstrCorrect)
 Adds a slash to the end of the string.
void CorrectNoNetLoc (String_256 *pstrCorrect)
 Ensures that pstrCorrect starts with "http://".
BOOL ShouldCorrectLocalFilenames (String_256 *pstrCorrect)
 Works out if we consider this string to be a local filename.
BOOL ShouldCorrectNetscapeFilenames (String_256 *pstrCorrect)
 Works out if we consider this string to be a Netscape local filename.
BOOL ShouldCorrectFTP (String_256 *pstrCorrect)
 Works out if we consider this string to be a ftp address with the "ftp:" missing.
BOOL ShouldCorrectHTTP (String_256 *pstrCorrect)
 Works out if we consider this string to be a http address with the "http:" missing.
BOOL ShouldCorrectMailto (String_256 *pstrCorrect)
 Works out if we consider this string to be a mail address with the "mailto:" missing.
BOOL ShouldCorrectNoSlash (String_256 *pstrCorrect)
 Works out if we consider this string to be a URL with a trailing slash missing.
BOOL ShouldCorrectNoNetLoc (String_256 *pstrCorrect)
 Works out if we consider this string to be an HTTP address with the "//" to signify a network location missing. For example:.
BOOL Parse (const String_256 &InString)
BOOL SetFlags ()
void Correct (String_256 *pstrCorrect, WebCorrectFlags wcfToUse=WebCorrectFlags())
void CorrectBackslashes (String_256 *pstrCorrect)
void CorrectLocalFilenames (String_256 *pstrCorrect)
void CorrectNetscapeFilenames (String_256 *pstrCorrect)
void CorrectFTP (String_256 *pstrCorrect)
void CorrectHTTP (String_256 *pstrCorrect)
void CorrectMailto (String_256 *pstrCorrect)
void CorrectNoSlash (String_256 *pstrCorrect)
void CorrectNoNetLoc (String_256 *pstrCorrect)
BOOL ShouldCorrectLocalFilenames (String_256 *pstrCorrect)
BOOL ShouldCorrectNetscapeFilenames (String_256 *pstrCorrect)
BOOL ShouldCorrectFTP (String_256 *pstrCorrect)
BOOL ShouldCorrectHTTP (String_256 *pstrCorrect)
BOOL ShouldCorrectMailto (String_256 *pstrCorrect)
BOOL ShouldCorrectNoSlash (String_256 *pstrCorrect)
BOOL ShouldCorrectNoNetLoc (String_256 *pstrCorrect)

Protected Attributes

BOOL Absolute
String_256 Scheme
String_256 NetLoc
String_256 Path
String_256 Parameters
String_256 Query
String_256 Fragment

Private Member Functions

 CC_DECLARE_DYNAMIC (WebAddress)
 CC_DECLARE_DYNAMIC (WebAddress)

Detailed Description

Represents a URL.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/9/96

Definition at line 115 of file webaddr.h.


Constructor & Destructor Documentation

WebAddress::WebAddress  ) 
 

Default WebAddress class constructor.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/9/96
Parameters:
None [INPUTS]
None [OUTPUTS]
Returns:
None

Errors: None

Definition at line 126 of file webaddr.cpp.

00127 {
00128     Absolute = FALSE;
00129 }

WebAddress::WebAddress const WebAddress InAddress  ) 
 

Copy Constructor for the WebAddress class.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/9/96
Parameters:
InAddress [INPUTS]
None [OUTPUTS]
Returns:
None

Errors: None

Definition at line 145 of file webaddr.cpp.

00146 {
00147     Absolute = InAddress.Absolute;
00148 
00149     Scheme=InAddress.Scheme;
00150     NetLoc=InAddress.NetLoc;
00151     Path=InAddress.Path;
00152     Parameters=InAddress.Parameters;
00153     Query=InAddress.Query;                    
00154     Fragment=InAddress.Fragment;
00155 }

WebAddress::WebAddress const String_256 StringToParse,
WebCorrectFlags  wcfToUse = WebCorrectFlags()
 

Definition at line 205 of file webaddr.cpp.

00206 {
00207     //First make a copy of the string we've been given
00208     String_256 strCopy=StringToParse;
00209 
00210     //And correct the copy
00211     Correct(&strCopy, wcfToUse);
00212 
00213     //Then parse the corrected string
00214     Parse(strCopy);
00215 
00216     //And finally set the class's flags
00217     SetFlags();
00218 }

WebAddress::WebAddress  ) 
 

WebAddress::WebAddress const WebAddress InAddress  ) 
 

WebAddress::WebAddress const String_256 StringToParse,
WebCorrectFlags  wcfToUse = WebCorrectFlags()
 


Member Function Documentation

WebAddress::CC_DECLARE_DYNAMIC WebAddress   )  [private]
 

WebAddress::CC_DECLARE_DYNAMIC WebAddress   )  [private]
 

void WebAddress::Combine WebAddress  Relative  ) 
 

void WebAddress::Combine WebAddress  Base  ) 
 

Combines this Web Address with a base Web Address.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/9/96
Parameters:
A Base URL [INPUTS]
This is used when this Web Address is relative and the base web address is the address of the current document. This function allows this Web Address to inherit the appropriate components of the base address so this Address becomes relative.

This is quite hard to explain, so here's an example: if this Web address is "myfile.xar" and the base Web Address is "http://www.xara.com/currentfile.xar" then this function makes this Web Address into "http://www.xara.com/myfile.xar".

This function follows the guidelines given in some international standard somewhere. (The one I was talking about above)

Because it follows these guidelines (almost) exactly, this function contains one hell of a lot of loops within loops. Sorry! I've tried to comment them helpfully.

Notes: The parsing rules follow the guidelines given in http://ds,internic.net/rfc/rfc1808.txt.

Please* don't change the parsing rules unless you really know what you're doing and have read the guideline document referred to above. The code below is written according to that document. Do not imitate at home what you have seen on Gladiators, etc, etc.

Definition at line 462 of file webaddr.cpp.

00463 {
00464     //Strings are hard coded to reduce code size
00465     String_256 sSlashDotSlash="/./";
00466     String_256 sSlashDotDotSlash="/../";
00467     
00468     TCHAR cSlash='/';
00469 
00470     //Now start the parsing.
00471 
00472     //If the base Web Address is empty, this Web Address does not change
00473     if (Base.IsEmpty())
00474         goto ReturnNow;
00475 
00476     //If this Web Address is empty, then it inherits everything from the 
00477     //base Web Address
00478     if (IsEmpty())
00479     {
00480         Absolute = Base.Absolute;
00481 
00482         Scheme=Base.Scheme;
00483         NetLoc=Base.NetLoc;
00484         Path=Base.Path;
00485         Parameters=Base.Parameters;
00486         Query=Base.Query;
00487         Fragment=Base.Fragment;
00488         goto ReturnNow;
00489     }
00490 
00491     //If this Web Address is absolute, it does not change
00492     if (IsAbsolute())
00493         goto ReturnNow;
00494 
00495     //If none of the above apply, this Web Address inherits the scheme of
00496     //the Base address
00497     Scheme=Base.Scheme;
00498 
00499     //If this Web Address has a net location, we need do nothing more to it.
00500     if (!NetLoc.IsEmpty())
00501         goto ReturnNow;
00502 
00503     //Otherwise, this Web Address inherits the Net Location of the base address.
00504     NetLoc=Base.NetLoc;
00505 
00506     //If the path of this Web Address starts with a slash, it is non-relative
00507     //and we need only add it on to the Net Location
00508     if ((*(Path))==cSlash) goto ReturnNow;
00509 
00510 
00511     //This is where all the loops within loops start. Hang on to your curly brackets.
00512 
00513     //Does this Web Address have a path?
00514     if (!Path.IsEmpty())
00515     {
00516         //Yes. Then the full path is given by:
00517         //The Base URL path up to the rightmost slash + the URL of this Web Address
00518         
00519         //This string will hold the base URL path up to the rightmost slash
00520         String_256 sTempPath="";
00521         
00522         //First find the rightmost slash in Base.Path
00523         INT32 iFound=Base.Path.ReverseFind(cSlash);
00524         
00525         //Did we find a slash?
00526         if (iFound>=0)
00527         {
00528             //Yes. So copy everything up to that slash into sTempPath
00529 
00530 
00531             Base.Path.Split(&sTempPath, NULL, iFound, TRUE);
00532             
00533             sTempPath+=Path;
00534 
00535             Path=sTempPath;
00536         }//End IF there's a slash in Base.Path
00537 
00538         
00539         //We now need to check the path for ../ and ./
00540         //First let's search for /./
00541         iFound=Path.Sub(sSlashDotSlash);
00542 
00543         //If we've found a /./
00544         while (iFound>=0)
00545         {
00546             //Then remove the ./ part of it.
00547             Path.Remove(iFound+1, 2);
00548 
00549             //And look for the next /./ to remove
00550             iFound=Path.Sub(sSlashDotSlash);
00551         }
00552 
00553         //Now we want to remove all occurrences of /[path segment/../
00554         //So first let's do a search for /../
00555         
00556         iFound=Path.Sub(sSlashDotDotSlash);
00557 
00558         //If we've found a /./
00559         while (iFound>=0)
00560         {
00561             //Then go back until we find the start of the path segment before it
00562             INT32 iStartOfSection=iFound-1;
00563 
00564             while (iStartOfSection>=0 && Path[iStartOfSection]!=cSlash)
00565                 iStartOfSection--;
00566 
00567             if (iStartOfSection>=0)
00568             {
00569                 //Get iStartOfSection to represent the character after the slash,
00570                 //rather than the slash
00571                 iStartOfSection++;
00572 
00573                 //So if we've found something, then set a pointer to the end of that
00574                 //section
00575                 INT32 iEndOfSection=iFound+3;
00576 
00577                 Path.Remove(iStartOfSection, (iEndOfSection-iStartOfSection+1));
00578             }
00579             else
00580                 //If we found an unparsable /../, then break now before we
00581                 //get into trouble...
00582                 break;
00583 
00584             //And find the next /../
00585             iFound=Path.Sub(sSlashDotDotSlash);
00586         }   
00587     }
00588     else
00589     {
00590         //No, this Web Address doesn't have a path.
00591         //So it inherits the path of the base URL.
00592         Path=Base.Path;
00593 
00594         //If this Web Address has some parameters, we need do nothin more to it
00595         if (!Parameters.IsEmpty())
00596             goto ReturnNow;
00597 
00598         //Otherwise this Web Address inherits the parameters of the base URL
00599         Parameters=Base.Parameters;
00600 
00601         //If this Web Address has a query, we need do nothin more to it
00602         if (!Query.IsEmpty())
00603             goto ReturnNow;
00604 
00605         //Otherwise this Web Address inherits the parameters of the base URL
00606         Query=Base.Query;
00607 
00608         //And that's it. (Fragments are never inherited).
00609         //So we can return.
00610         goto ReturnNow;
00611 
00612     }//End if (!Path.IsEmpty()) else...
00613 
00614 ReturnNow:
00615     //Set the "Absolute" flag to whatever it's meant to be, and return
00616     SetFlags();
00617     return;
00618 }

void WebAddress::Correct String_256 pstrCorrect,
WebCorrectFlags  wcfToUse = WebCorrectFlags()
[protected]
 

void WebAddress::Correct String_256 pstrCorrect,
WebCorrectFlags  wcfToUse = WebCorrectFlags()
[protected]
 

Corrects the URL string that the user has entered, according to the correction flags.

void WebAddress::Correct(String_256* pstrCorrect, WebCorrectFlags wcfToUse)

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/5/97
Parameters:
pstrCorrect - the string to correct [INPUTS] wcfToUse - a set of flags which detail how to correct the string
pstrCorrect - the corrected string [OUTPUTS]
Returns:
-

Errors: -

See also:
WebAddress::ApplyWebAddressToSelection; WebCorrectFlags

Definition at line 855 of file webaddr.cpp.

00856 {   
00857     //If we should be correcting backslashes to forward slashes, do so now
00858     if (wcfToUse.CorrectBackslashes())
00859         CorrectBackslashes(pstrCorrect);
00860 
00861     //If we should be correcting local filenames
00862     if (wcfToUse.CorrectLocalFilenames() && ShouldCorrectLocalFilenames(pstrCorrect))
00863     {
00864         //Then correct it to a URL pointing to a local filename
00865         CorrectLocalFilenames(pstrCorrect);
00866     }
00867 
00868     //Now, if we should be correcting Netscape local URLs to IE3 ones
00869     if (wcfToUse.CorrectNetscapeFilenames() && ShouldCorrectNetscapeFilenames(pstrCorrect))
00870     {
00871         //Then correct it
00872         CorrectNetscapeFilenames(pstrCorrect);
00873     }
00874     //Otherwise if we should be correcting ftp addresses
00875     else if (wcfToUse.CorrectFTP() && ShouldCorrectFTP(pstrCorrect))
00876     {
00877         //Then add "ftp:" to the front
00878         CorrectFTP(pstrCorrect);
00879     }
00880     //Otherwise if we should be adding http:// to the front
00881     else if (wcfToUse.CorrectHTTP() && ShouldCorrectHTTP(pstrCorrect))
00882     {
00883         //Then add "http://" to the front
00884         CorrectHTTP(pstrCorrect);
00885             
00886     }
00887     //Otherwise if the string contains an @
00888     else if (ShouldCorrectMailto(pstrCorrect))
00889     {
00890         //Then add "mailto:" to the front
00891         CorrectMailto(pstrCorrect);
00892     }
00893 
00894     //If we should be ensuring that http addresses have a net location
00895     if (wcfToUse.CorrectNoNetLoc() && ShouldCorrectNoNetLoc(pstrCorrect))
00896     {
00897         //Then add a slash to the end
00898         CorrectNoNetLoc(pstrCorrect);
00899     }
00900 
00901 
00902     //And finally, if we should be adding a slash to the end
00903     if (wcfToUse.CorrectNoSlash() && ShouldCorrectNoSlash(pstrCorrect))
00904     {
00905         //Then add a slash to the end
00906         CorrectNoSlash(pstrCorrect);
00907     }
00908 
00909 }

void WebAddress::CorrectBackslashes String_256 pstrCorrect  )  [protected]
 

void WebAddress::CorrectBackslashes String_256 pstrCorrect  )  [protected]
 

Corrects any backslashes in the entered string to slashes.

void WebAddress::CorrectBackslashes(String_256* pstrCorrect)

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/5/97
Parameters:
pstrCorrect - the string to correct [INPUTS]
pstrCorrect - the corrected string [OUTPUTS]
Returns:
-

Errors: -

See also:
WebAddress::Correct()

Definition at line 930 of file webaddr.cpp.

00931 {   
00932     //Check our parameter
00933     if (pstrCorrect==NULL)
00934     {
00935         ERROR2RAW("WebAddress::CorrectBackslashes - NULL parameter");
00936         return;
00937     }
00938 
00939     //And correct all backslashes to forward slashes
00940     pstrCorrect->SwapChar('\\', '/');
00941 
00942 }

void WebAddress::CorrectFTP String_256 pstrCorrect  )  [protected]
 

void WebAddress::CorrectFTP String_256 pstrCorrect  )  [protected]
 

Puts "ftp:" on the start of pstrCorrect.

void WebAddress::CorrectFTP(String_256* pstrCorrect)

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/5/97
Parameters:
pstrCorrect - the string to correct [INPUTS]
pstrCorrect - the corrected string [OUTPUTS]
Returns:
-

Errors: -

See also:
WebAddress::Correct()

Definition at line 1182 of file webaddr.cpp.

01183 {   
01184     //Check our parameter
01185     if(pstrCorrect==NULL)
01186     {
01187         ERROR2RAW("WebAddress::CorrectBackslash - NULL parameter");
01188         return;
01189     }
01190     
01191     //If our string is over two hundred and fifty characters long, return
01192     if (pstrCorrect->Length()>250)
01193         return;
01194 
01195     //Otherwise, create a new string containing "ftp://"
01196     String_256 strToReturn="ftp://";
01197 
01198     //Add our other string onto the end of it
01199     strToReturn+=*pstrCorrect;
01200 
01201     //And copy our new string into our old string
01202     *pstrCorrect=strToReturn;
01203 }

void WebAddress::CorrectHTTP String_256 pstrCorrect  )  [protected]
 

void WebAddress::CorrectHTTP String_256 pstrCorrect  )  [protected]
 

Puts "http:" on the start of pstrCorrect.

void WebAddress::CorrectHTTP(String_256* pstrCorrect)

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/5/97
Parameters:
pstrCorrect - the string to correct [INPUTS]
pstrCorrect - the corrected string [OUTPUTS]
Returns:
-

Errors: -

See also:
WebAddress::Correct()

Definition at line 1322 of file webaddr.cpp.

01323 {   
01324     //Check our parameter
01325     if(pstrCorrect==NULL)
01326     {
01327         ERROR2RAW("WebAddress::CorrectBackslash - NULL parameter");
01328         return;
01329     }
01330     
01331     //If our string is over two hundred and fifty characters long, return
01332     if (pstrCorrect->Length()>250)
01333         return;
01334 
01335     //Otherwise, create a new string containing "http:"
01336     String_256 strToReturn="http://";
01337 
01338     //Add our other string onto the end of it
01339     strToReturn+=*pstrCorrect;
01340 
01341     //And copy our new string into our old string
01342     *pstrCorrect=strToReturn;
01343 }

void WebAddress::CorrectLocalFilenames String_256 pstrCorrect  )  [protected]
 

void WebAddress::CorrectLocalFilenames String_256 pstrCorrect  )  [protected]
 

Assumes pstrCorrect is a local filename, then converts it to a URL referring to a local filename.

void WebAddress::CorrectLocalFilenames(String_256* pstrCorrect)

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/5/97
Parameters:
pstrCorrect - the string to correct [INPUTS]
pstrCorrect - the corrected string [OUTPUTS]
Returns:
-
It does this by calling the function PathName::GetWebAddress()

Returns:
Errors: -
See also:
WebAddress::Correct(), PathName::GetWebAddress()

Definition at line 1017 of file webaddr.cpp.

01018 {   
01019     //Check our parameter
01020     if(pstrCorrect==NULL)
01021     {
01022         ERROR2RAW("WebAddress::CorrectBackslash - NULL parameter");
01023         return;
01024     }
01025 
01026     
01027     //Now, create a pathname out of our string
01028     PathName pthTemp=*pstrCorrect;
01029 
01030     //And call the GetWebAddress function
01031     *pstrCorrect=pthTemp.GetWebAddress();
01032 
01033 }

void WebAddress::CorrectMailto String_256 pstrCorrect  )  [protected]
 

void WebAddress::CorrectMailto String_256 pstrCorrect  )  [protected]
 

Puts "mailto:" on the start of pstrCorrect.

void WebAddress::CorrectMailto(String_256* pstrCorrect)

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/5/97
Parameters:
pstrCorrect - the string to correct [INPUTS]
pstrCorrect - the corrected string [OUTPUTS]
Returns:
-

Errors: -

See also:
WebAddress::Correct()

Definition at line 1553 of file webaddr.cpp.

01554 {   
01555     //Check our parameter
01556     if(pstrCorrect==NULL)
01557     {
01558         ERROR2RAW("WebAddress::CorrectBackslash - NULL parameter");
01559         return;
01560     }
01561     
01562     //If our string is over two hundred and fifty characters long, return
01563     if (pstrCorrect->Length()>250)
01564         return;
01565 
01566     //Otherwise, create a new string containing "mailto:"
01567     String_256 strToReturn="mailto:";
01568 
01569     //Add our other string onto the end of it
01570     strToReturn+=*pstrCorrect;
01571 
01572     //And copy our new string into our old string
01573     *pstrCorrect=strToReturn;
01574 }

void WebAddress::CorrectNetscapeFilenames String_256 pstrCorrect  )  [protected]
 

void WebAddress::CorrectNetscapeFilenames String_256 pstrCorrect  )  [protected]
 

Converts a Netscape local filename (file:///xxxxxxx) to an IE3 local filename (file://xxxxxxx) by simply removing the third slash.

void WebAddress::CorrectNetscapeFilenames(String_256* pstrCorrect)

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/5/97
Parameters:
pstrCorrect - the string to correct [INPUTS]
pstrCorrect - the corrected string [OUTPUTS]
Returns:
-

Errors: -

See also:
WebAddress::Correct(), PathName::GetWebAddress()

Definition at line 1112 of file webaddr.cpp.

01113 {   
01114     //Check our parameter
01115     if(pstrCorrect==NULL)
01116     {
01117         ERROR2RAW("WebAddress::CorrectBackslash - NULL parameter");
01118         return;
01119     }
01120                                                                         
01121     //Simply delete the fifth character, removing one of the slashes
01122     pstrCorrect->Remove(6, 1);
01123 
01124 }

void WebAddress::CorrectNoNetLoc String_256 pstrCorrect  )  [protected]
 

void WebAddress::CorrectNoNetLoc String_256 pstrCorrect  )  [protected]
 

Ensures that pstrCorrect starts with "http://".

void WebAddress::CorrectNoNetLoc(String_256* pstrCorrect)

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/5/97
Parameters:
pstrCorrect - the string to correct [INPUTS]
pstrCorrect - the corrected string [OUTPUTS]
Returns:
-

Errors: -

See also:
WebAddress::Correct()

Definition at line 1632 of file webaddr.cpp.

01633 {   
01634     //Check our parameter
01635     if(pstrCorrect==NULL)
01636     {
01637         ERROR2RAW("WebAddress::CorrectBackslash - NULL parameter");
01638         return;
01639     }
01640     
01641     //We already know that our string does not start with "http://"
01642     //But does it start with "http:/"?
01643     if (pstrCorrect->SubWithoutCase(String_256("http:/"))==0)
01644     {
01645         //Yes it does. So insert an extra slash
01646         pstrCorrect->Insert( String_256("/"), 5 );
01647     }
01648     else
01649     {
01650         //No it doesn't. So insert an extra two slashes after the HTTP
01651         pstrCorrect->Insert( String_256("//"), 5 );
01652     }
01653 }

void WebAddress::CorrectNoSlash String_256 pstrCorrect  )  [protected]
 

void WebAddress::CorrectNoSlash String_256 pstrCorrect  )  [protected]
 

Adds a slash to the end of the string.

void WebAddress::CorrectNoSlash(String_256* pstrCorrect)

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/5/97
Parameters:
pstrCorrect - the string to correct [INPUTS]
pstrCorrect - the corrected string [OUTPUTS]
Returns:
-

Errors: -

See also:
WebAddress::Correct(); WebAddress::ShouldCorrectNoSlash()

Definition at line 1466 of file webaddr.cpp.

01467 {   
01468     //Check our parameter
01469     if(pstrCorrect==NULL)
01470     {
01471         ERROR2RAW("WebAddress::CorrectNoSlash - NULL parameter");
01472         return;
01473     }
01474     
01475     //And if the string is long enough
01476     if (pstrCorrect->Length()<255)
01477     {
01478         //Add a slash to the end
01479         *pstrCorrect+='/';
01480     }
01481 }

const BOOL WebAddress::FragmentIsEmpty  )  const [inline]
 

Definition at line 174 of file stemplate.h.

00174 {return Fragment.IsEmpty();}

const BOOL WebAddress::FragmentIsEmpty  )  const [inline]
 

Definition at line 174 of file webaddr.h.

00174 {return Fragment.IsEmpty();}

const String_256& WebAddress::GetFragment  )  const [inline]
 

Definition at line 154 of file stemplate.h.

00154 {return Fragment;}

const String_256& WebAddress::GetFragment  )  const [inline]
 

Definition at line 154 of file webaddr.h.

00154 {return Fragment;}

const String_256& WebAddress::GetNetLoc  )  const [inline]
 

Definition at line 150 of file stemplate.h.

00150 {return NetLoc;}

const String_256& WebAddress::GetNetLoc  )  const [inline]
 

Definition at line 150 of file webaddr.h.

00150 {return NetLoc;}

const String_256& WebAddress::GetParameters  )  const [inline]
 

Definition at line 152 of file stemplate.h.

00152 {return Parameters;}

const String_256& WebAddress::GetParameters  )  const [inline]
 

Definition at line 152 of file webaddr.h.

00152 {return Parameters;}

const String_256& WebAddress::GetPath  )  const [inline]
 

Definition at line 151 of file stemplate.h.

00151 {return Path;}

const String_256& WebAddress::GetPath  )  const [inline]
 

Definition at line 151 of file webaddr.h.

00151 {return Path;}

PathName WebAddress::GetPathName  )  const
 

PathName WebAddress::GetPathName  )  const
 

Definition at line 793 of file webaddr.cpp.

00794 {   
00795     //We needn't actually do anything to remove the Scheme - we just don't
00796     //use it
00797 
00798     //First concatenate the net location and the path
00799     String_256 strToReturn=NetLoc;
00800     strToReturn+=Path;
00801     
00802     //So, does that string start with "//"?
00803     if (strToReturn.Sub(String_256("//"))==0)
00804     {
00805         //Yes. So remove it
00806         strToReturn.Split(NULL, &strToReturn, 1, TRUE);
00807     }
00808 
00809     //Convert all forward slashes to backslashes
00810     strToReturn.SwapChar('/', '\\');
00811 
00812     //Convert all | characters to colons
00813     strToReturn.SwapChar('|', ':');
00814 
00815     //Put our string into a PathName object
00816     PathName pthToReturn(strToReturn);
00817 
00818     //And return it
00819     return pthToReturn;
00820 
00821 }

const String_256& WebAddress::GetQuery  )  const [inline]
 

Definition at line 153 of file stemplate.h.

00153 {return Query;}

const String_256& WebAddress::GetQuery  )  const [inline]
 

Definition at line 153 of file webaddr.h.

00153 {return Query;}

const String_256& WebAddress::GetScheme  )  const [inline]
 

Definition at line 149 of file stemplate.h.

00149 {return Scheme;}

const String_256& WebAddress::GetScheme  )  const [inline]
 

Definit