зеркало из https://github.com/mozilla/pjs.git
r=warren, 15457. Added file extension attribute to URL implementations
This commit is contained in:
Родитель
02937b74c2
Коммит
a5c9151b68
|
@ -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)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче