Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Attributes
nsPathParser Class Reference

List of all members.

Public Member Functions

 nsPathParser (const nsACString &path)
 ~nsPathParser ()
const char * First ()
const char * Next ()
const char * Remainder ()

Private Attributes

char mAutoBuffer [512]
char * mAllocatedBuffer
char * mBuffer
char * mNewString

Detailed Description

Definition at line 111 of file nsLocalFileMac.cpp.


Constructor & Destructor Documentation

nsPathParser::nsPathParser ( const nsACString &  path)

Definition at line 141 of file nsLocalFileMac.cpp.

                                                   :
    mAllocatedBuffer(nsnull), mNewString(nsnull)
{
    PRUint32 inPathLen = inPath.Length();
    if (inPathLen >= sizeof(mAutoBuffer)) {
        mAllocatedBuffer = (char *)nsMemory::Alloc(inPathLen + 1);
        mBuffer = mAllocatedBuffer;
    }
    else
       mBuffer = mAutoBuffer;
    
    // copy inPath into mBuffer    
    nsACString::const_iterator start, end;
    inPath.BeginReading(start);
    inPath.EndReading(end);
       
       PRUint32 size, offset = 0;
    for ( ; start != end; start.advance(size)) {
        const char* buf = start.get();
        size = start.size_forward();
        memcpy(mBuffer + offset, buf, size);
        offset += size;
    }
    mBuffer[offset] = '\0';
}

Here is the call graph for this function:

Definition at line 116 of file nsLocalFileMac.cpp.

    {
        if (mAllocatedBuffer)
            nsMemory::Free(mAllocatedBuffer);
    }

Member Function Documentation

const char* nsPathParser::First ( void  ) [inline]

Definition at line 122 of file nsLocalFileMac.cpp.

    {
        return nsCRT::strtok(mBuffer, ":", &mNewString);
    }
const char* nsPathParser::Next ( ) [inline]

Definition at line 126 of file nsLocalFileMac.cpp.

    {
        return nsCRT::strtok(mNewString, ":", &mNewString);
    }
const char* nsPathParser::Remainder ( ) [inline]

Definition at line 130 of file nsLocalFileMac.cpp.

    {
        return mNewString;
    }

Member Data Documentation

Definition at line 137 of file nsLocalFileMac.cpp.

char nsPathParser::mAutoBuffer[512] [private]

Definition at line 136 of file nsLocalFileMac.cpp.

char* nsPathParser::mBuffer [private]

Definition at line 138 of file nsLocalFileMac.cpp.

char * nsPathParser::mNewString [private]

Definition at line 138 of file nsLocalFileMac.cpp.


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