Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Attributes | Friends
nsPersistentFileDescriptor Class Reference

#include <nsFileSpec.h>

Collaboration diagram for nsPersistentFileDescriptor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsPersistentFileDescriptor ()
 nsPersistentFileDescriptor (const nsPersistentFileDescriptor &inEncodedData)
virtual ~nsPersistentFileDescriptor ()
void operator= (const nsPersistentFileDescriptor &inEncodedData)
NS_EXPLICIT nsPersistentFileDescriptor (const nsFileSpec &inSpec)
void operator= (const nsFileSpec &inSpec)
void GetData (nsAFlatCString &outData) const
void SetData (const nsAFlatCString &inData)
void SetData (const char *inData, PRInt32 inSize)
 nsPersistentFileDescriptor ()
 nsPersistentFileDescriptor (const nsPersistentFileDescriptor &inEncodedData)
virtual ~nsPersistentFileDescriptor ()
void operator= (const nsPersistentFileDescriptor &inEncodedData)
NS_EXPLICIT nsPersistentFileDescriptor (const nsFileSpec &inSpec)
void operator= (const nsFileSpec &inSpec)
void GetData (nsAFlatCString &outData) const
void SetData (const nsAFlatCString &inData)
void SetData (const char *inData, PRInt32 inSize)

Protected Attributes

nsSimpleCharString mDescriptorString

Friends

class nsFileSpec
nsresult Read (nsIInputStream *aStream, nsPersistentFileDescriptor &)
nsresult Write (nsIOutputStream *aStream, const nsPersistentFileDescriptor &)
NS_COM_OBSOLETE nsInputStream & operator>> (nsInputStream &, nsPersistentFileDescriptor &)
NS_COM_OBSOLETE nsOutputStream & operator<< (nsOutputStream &, const nsPersistentFileDescriptor &)
nsresult Read (nsIInputStream *aStream, nsPersistentFileDescriptor &)
nsresult Write (nsIOutputStream *aStream, const nsPersistentFileDescriptor &)
NS_COM_OBSOLETE nsInputStream & operator>> (nsInputStream &, nsPersistentFileDescriptor &)
NS_COM_OBSOLETE nsOutputStream & operator<< (nsOutputStream &, const nsPersistentFileDescriptor &)

Detailed Description

Definition at line 636 of file nsFileSpec.h.


Constructor & Destructor Documentation

Definition at line 644 of file nsFileSpec.h.

{}

Definition at line 1188 of file nsFileSpec.cpp.

    : mDescriptorString(inDesc.mDescriptorString)
{
} // nsPersistentFileDescriptor::nsPersistentFileDescriptor

Definition at line 1255 of file nsFileSpec.cpp.

{
} // nsPersistentFileDescriptor::~nsPersistentFileDescriptor

Definition at line 1202 of file nsFileSpec.cpp.

{
    *this = inSpec;
} // nsPersistentFileDescriptor::nsPersistentFileDescriptor

Definition at line 644 of file nsIFileSpec.idl.


Member Function Documentation

Definition at line 1261 of file nsFileSpec.cpp.

{
    outData.Assign(mDescriptorString, mDescriptorString.Length());
}
void nsPersistentFileDescriptor::operator= ( const nsPersistentFileDescriptor inEncodedData)

Definition at line 1195 of file nsFileSpec.cpp.

{
    mDescriptorString = inDesc.mDescriptorString;
} // nsPersistentFileDescriptor::operator =
void nsPersistentFileDescriptor::operator= ( const nsPersistentFileDescriptor inEncodedData)
void nsPersistentFileDescriptor::operator= ( const nsFileSpec inSpec)

Definition at line 1209 of file nsFileSpec.cpp.

{
#if defined(XP_MAC)
    if (inSpec.Error())
        return;
    AliasHandle    aliasH;
    OSErr err = NewAlias(nil, inSpec.GetFSSpecPtr(), &aliasH);
    if (err != noErr)
        return;

    PRUint32 bytes = GetHandleSize((Handle) aliasH);
    HLock((Handle) aliasH);
    char* buf = PL_Base64Encode((const char*)*aliasH, bytes, nsnull);
    DisposeHandle((Handle) aliasH);

    mDescriptorString = buf;
    PR_Free(buf);
#elif  defined(XP_MACOSX)
    if (inSpec.Error())
        return;
    
    FSRef fileRef;
    Boolean isDir;
    OSErr err = ::FSPathMakeRef((const UInt8*)inSpec.GetCString(), &fileRef, &isDir);
    if (err != noErr)
        return;
    
    AliasHandle    aliasH;
    err = ::FSNewAlias(nsnull, &fileRef, &aliasH);
    if (err != noErr)
        return;

    PRUint32 bytes = ::GetHandleSize((Handle) aliasH);
    ::HLock((Handle)aliasH);
    char* buf = PL_Base64Encode((const char*)*aliasH, bytes, nsnull);
    ::DisposeHandle((Handle) aliasH);

    mDescriptorString = buf;
    PR_Free(buf);
#else
    mDescriptorString = inSpec.GetCString();
#endif // XP_MAC
} // nsPersistentFileDescriptor::operator =

Here is the call graph for this function:

void nsPersistentFileDescriptor::operator= ( const nsFileSpec inSpec)

Definition at line 1268 of file nsFileSpec.cpp.

{
    mDescriptorString.CopyFrom(inData.get(), inData.Length());
}

Here is the call graph for this function:

void nsPersistentFileDescriptor::SetData ( const char *  inData,
PRInt32  inSize 
)
void nsPersistentFileDescriptor::SetData ( const char *  inData,
PRInt32  inSize 
)

Definition at line 1275 of file nsFileSpec.cpp.

{
    mDescriptorString.CopyFrom(inData, inSize);
}

Here is the call graph for this function:


Friends And Related Function Documentation

nsFileSpec [friend]

Definition at line 664 of file nsFileSpec.h.

NS_COM_OBSOLETE nsOutputStream& operator<< ( nsOutputStream &  ,
const nsPersistentFileDescriptor  
) [friend]
NS_COM_OBSOLETE nsOutputStream& operator<< ( nsOutputStream &  ,
const nsPersistentFileDescriptor  
) [friend]
NS_COM_OBSOLETE nsInputStream& operator>> ( nsInputStream &  ,
nsPersistentFileDescriptor  
) [friend]
NS_COM_OBSOLETE nsInputStream& operator>> ( nsInputStream &  ,
nsPersistentFileDescriptor  
) [friend]
nsresult Read ( nsIInputStream aStream,
nsPersistentFileDescriptor  
) [friend]
nsresult Read ( nsIInputStream aStream,
nsPersistentFileDescriptor  
) [friend]

Member Data Documentation

Definition at line 676 of file nsFileSpec.h.


The documentation for this class was generated from the following files: