r=warren, 15457. Added file extension attribute to URL implementations

This commit is contained in:
valeski%netscape.com 1999-10-06 14:36:22 +00:00
Родитель 7f2673dfa8
Коммит 43edbee475
3 изменённых файлов: 31 добавлений и 0 удалений

Просмотреть файл

@ -332,6 +332,11 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetFileName(char * *aFileName)
return m_baseURL->GetFileName(aFileName);
}
NS_IMETHODIMP nsMsgMailNewsUrl::GetFileExtension(char * *aFileExtension)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsMsgMailNewsUrl::SetFileName(const char * aFileName)
{
return m_baseURL->SetFileName(aFileName);

Просмотреть файл

@ -52,6 +52,12 @@ interface nsIURL : nsIURI
*/
attribute string FileName;
/**
* Returns the file extension portion of a filename in a url.
* If a file extension does not exist, the empty string is returned.
*/
readonly attribute string FileExtension;
/**
* Returns the parameters specified after the ; in the URL.
*

Просмотреть файл

@ -129,6 +129,26 @@ nsStdURL::GetFileName(char* *o_FileName)
return DupString(o_FileName, mFileName);
}
inline NS_METHOD
nsStdURL::GetFileExtension(char* *o_FileExtension)
{
if (!o_FileExtension)
return NS_ERROR_NULL_POINTER;
char *dot = mFileName;
if (dot) {
while (*dot && (*dot != '.')) dot++; // goto the dot.
if (*dot) {
nsCAutoString ext(dot+1);
*o_FileExtension = ext.ToNewCString();
if (!*o_FileExtension) return NS_ERROR_OUT_OF_MEMORY;
} else {
*o_FileExtension = nsnull;
}
}
return NS_OK;
}
inline NS_METHOD
nsStdURL::GetRef(char* *o_Ref)
{