Public Types | Public Member Functions | Friends

ShellPath Struct Reference

wrapper class for item ID lists More...

#include <shellclasses.h>

Inheritance diagram for ShellPath:
Inheritance graph
[legend]
Collaboration diagram for ShellPath:
Collaboration graph
[legend]

List of all members.

Public Types

typedef SShellPtr< ITEMIDLIST > super

Public Member Functions

 ShellPath ()
 ShellPath (IShellFolder *folder, LPCWSTR path)
 ShellPath (LPCWSTR path)
 ShellPath (IShellFolder *folder, LPCSTR path)
 ShellPath (LPCSTR path)
 ShellPath (const ShellPath &o)
 ShellPath (LPITEMIDLIST p)
 ShellPath (LPCITEMIDLIST p)
void operator= (const ShellPath &o)
void operator= (ITEMIDLIST *p)
void operator= (const SHITEMID &o)
void operator+= (const SHITEMID &o)
void assign (LPCITEMIDLIST pidl, size_t size)
void assign (LPCITEMIDLIST pidl)
void split (ShellPath &parent, ShellPath &obj) const
void GetUIObjectOf (REFIID riid, LPVOID *ppvOut, HWND hWnd=0, ShellFolder &sf=GetDesktopFolder())
ShellFolder get_folder ()
ShellFolder get_folder (IShellFolder *parent)
ShellPath create_absolute_pidl (LPCITEMIDLIST parent_pidl) const

Friends

bool operator< (const ShellPath &a, const ShellPath &b)

Detailed Description

wrapper class for item ID lists

Definition at line 651 of file shellclasses.h.


Member Typedef Documentation

typedef SShellPtr<ITEMIDLIST> ShellPath::super

Definition at line 653 of file shellclasses.h.


Constructor & Destructor Documentation

ShellPath::ShellPath (  ) [inline]

Definition at line 655 of file shellclasses.h.

    {
    }
ShellPath::ShellPath ( IShellFolder *  folder,
LPCWSTR  path 
) [inline]

Definition at line 659 of file shellclasses.h.

References SShellPtr< ITEMIDLIST >::_p, CHECKERROR, and CONTEXT.

    {
        CONTEXT("ShellPath::ShellPath(IShellFolder*, LPCWSTR)");

        if (path)
            CHECKERROR(folder->ParseDisplayName(0, NULL, (LPOLESTR)path, NULL, &_p, NULL));
        else
            _p = NULL;
    }
ShellPath::ShellPath ( LPCWSTR  path ) [inline]

Definition at line 669 of file shellclasses.h.

References SShellPtr< ITEMIDLIST >::_p, CHECKERROR, GetDesktopFolder(), and OBJ_CONTEXT.

    {
        OBJ_CONTEXT("ShellPath::ShellPath(LPCWSTR)", path);

        if (path)
            CHECKERROR(GetDesktopFolder()->ParseDisplayName(0, NULL, (LPOLESTR)path, NULL, &_p, NULL));
        else
            _p = NULL;
    }

Here is the call graph for this function:

ShellPath::ShellPath ( IShellFolder *  folder,
LPCSTR  path 
) [inline]

Definition at line 679 of file shellclasses.h.

References SShellPtr< ITEMIDLIST >::_p, CHECKERROR, CONTEXT, and COUNTOF.

    {
        CONTEXT("ShellPath::ShellPath(IShellFolder*, LPCSTR)");

        WCHAR b[MAX_PATH];

        if (path) {
            MultiByteToWideChar(CP_ACP, 0, path, -1, b, COUNTOF(b));
            CHECKERROR(folder->ParseDisplayName(0, NULL, b, NULL, &_p, NULL));
        } else
            _p = NULL;
    }
ShellPath::ShellPath ( LPCSTR  path ) [inline]

Definition at line 692 of file shellclasses.h.

References SShellPtr< ITEMIDLIST >::_p, CHECKERROR, CONTEXT, COUNTOF, and GetDesktopFolder().

    {
        CONTEXT("ShellPath::ShellPath(LPCSTR)");

        WCHAR b[MAX_PATH];

        if (path) {
            MultiByteToWideChar(CP_ACP, 0, path, -1, b, COUNTOF(b));
            CHECKERROR(GetDesktopFolder()->ParseDisplayName(0, NULL, b, NULL, &_p, NULL));
        } else
            _p = NULL;
    }

Here is the call graph for this function:

ShellPath::ShellPath ( const ShellPath o ) [inline]

Definition at line 705 of file shellclasses.h.

References SShellPtr< ITEMIDLIST >::_malloc, SShellPtr< ITEMIDLIST >::_p, SShellPtr< T >::_p, and ILGetSize.

     :  super(NULL)
    {
        //CONTEXT("ShellPath::ShellPath(const ShellPath&)");

        if (o._p) {
            int l = ILGetSize(o._p);
            _p = (ITEMIDLIST*) _malloc->Alloc(l);
            if (_p) memcpy(_p, o._p, l);
        }
    }
ShellPath::ShellPath ( LPITEMIDLIST  p ) [inline, explicit]

Definition at line 717 of file shellclasses.h.

     :  super(p)
    {
    }
ShellPath::ShellPath ( LPCITEMIDLIST  p ) [inline]

Definition at line 722 of file shellclasses.h.

References SShellPtr< ITEMIDLIST >::_malloc, SShellPtr< ITEMIDLIST >::_p, and ILGetSize.

    {
        //CONTEXT("ShellPath::ShellPath(LPCITEMIDLIST)");

        if (p) {
            int l = ILGetSize(p);
            _p = (ITEMIDLIST*) _malloc->Alloc(l);
            if (_p) memcpy(_p, p, l);
        }
    }

Member Function Documentation

void ShellPath::assign ( LPCITEMIDLIST  pidl,
size_t  size 
) [inline]

Definition at line 806 of file shellclasses.h.

References SShellPtr< ITEMIDLIST >::_malloc, and SShellPtr< ITEMIDLIST >::_p.

Referenced by split(), SDIMainFrame::WndProc(), and MDIMainFrame::WndProc().

    {
        //CONTEXT("ShellPath::assign(LPCITEMIDLIST, size_t)");

        ITEMIDLIST* h = _p;

        _p = (ITEMIDLIST*) _malloc->Alloc(size+sizeof(USHORT/*SHITEMID::cb*/));

        if (_p) {
            memcpy(_p, pidl, size);
            ((ITEMIDLIST*)((LPBYTE)_p+size))->mkid.cb = 0; // terminator
        }

        _malloc->Free(h);
    }

Here is the caller graph for this function:

void ShellPath::assign ( LPCITEMIDLIST  pidl ) [inline]

Definition at line 822 of file shellclasses.h.

References SShellPtr< ITEMIDLIST >::_malloc, SShellPtr< ITEMIDLIST >::_p, and ILGetSize.

    {
        //CONTEXT("ShellPath::assign(LPCITEMIDLIST)");

        ITEMIDLIST* h = _p;

        if (pidl) {
            int l = ILGetSize(pidl);
            _p = (ITEMIDLIST*) _malloc->Alloc(l);
            if (_p) memcpy(_p, pidl, l);
        } else
            _p = NULL;

        _malloc->Free(h);
    }
ShellPath ShellPath::create_absolute_pidl ( LPCITEMIDLIST  parent_pidl ) const

Definition at line 404 of file shellclasses.cpp.

References SShellPtr< ITEMIDLIST >::_malloc, SShellPtr< ITEMIDLIST >::_p, CONTEXT, ILGetSize, and TEXT.

Referenced by ShellEntry::create_absolute_pidl(), ShellDirectory::find_entry(), and MainFrameBase::OpenShellFolders().

{
    CONTEXT("ShellPath::create_absolute_pidl()");

    static DynamicFct<LPITEMIDLIST(WINAPI*)(LPCITEMIDLIST, LPCITEMIDLIST)> ILCombine(TEXT("SHELL32"), 25);

    if (ILCombine)
        return (*ILCombine)(parent_pidl, _p);

     // create a new item id list with _p append behind parent_pidl
    int l1 = ILGetSize(parent_pidl) - sizeof(USHORT/*SHITEMID::cb*/);
    int l2 = ILGetSize(_p);

    LPITEMIDLIST p = (LPITEMIDLIST) _malloc->Alloc(l1+l2);

    memcpy(p, parent_pidl, l1);
    memcpy((LPBYTE)p+l1, _p, l2);

    return p;
}

Here is the caller graph for this function:

ShellFolder ShellPath::get_folder (  ) [inline]

Definition at line 842 of file shellclasses.h.

References SShellPtr< ITEMIDLIST >::_p.

    {
        return ShellFolder(_p);
    }
ShellFolder ShellPath::get_folder ( IShellFolder *  parent ) [inline]

Definition at line 847 of file shellclasses.h.

References SShellPtr< ITEMIDLIST >::_p, and CONTEXT.

    {
        CONTEXT("ShellPath::get_folder()");
        return ShellFolder(parent, _p);
    }
void ShellPath::GetUIObjectOf ( REFIID  riid,
LPVOID *  ppvOut,
HWND  hWnd = 0,
ShellFolder sf = GetDesktopFolder() 
)

Definition at line 362 of file shellclasses.cpp.

References CHECKERROR, CONTEXT, and split().

{
    CONTEXT("ShellPath::GetUIObjectOf()");

    ShellPath parent, obj;

    split(parent, obj);

    LPCITEMIDLIST idl = obj;

    if (parent && parent->mkid.cb)
         // use the IShellFolder of the parent
        CHECKERROR(ShellFolder((IShellFolder*)sf,parent)->GetUIObjectOf(hWnd, 1, &idl, riid, 0, ppvOut));
    else // else use desktop folder
        CHECKERROR(sf->GetUIObjectOf(hWnd, 1, &idl, riid, 0, ppvOut));
}

Here is the call graph for this function:

void ShellPath::operator+= ( const SHITEMID &  o ) [inline]

Definition at line 779 of file shellclasses.h.

References SShellPtr< ITEMIDLIST >::_malloc, SShellPtr< ITEMIDLIST >::_p, and ILGetSize.

    {
        int l0 = ILGetSize(_p);
        LPBYTE p = (LPBYTE)_malloc->Alloc(l0+o.cb);
        int l = l0 - 2;

        if (p) {
            memcpy(p, _p, l);
            *(PWORD)((LPBYTE)memcpy(p+l, &o, o.cb)+o.cb) = 0;
        }

        _malloc->Free(_p);
        _p = (ITEMIDLIST*)p;
    }
void ShellPath::operator= ( const ShellPath o ) [inline]

Definition at line 733 of file shellclasses.h.

References SShellPtr< ITEMIDLIST >::_malloc, SShellPtr< T >::_p, SShellPtr< ITEMIDLIST >::_p, and ILGetSize.

    {
        //CONTEXT("ShellPath::operator=(const ShellPath&)");

        ITEMIDLIST* h = _p;

        if (o._p) {
            int l = ILGetSize(o._p);

            _p = (ITEMIDLIST*) _malloc->Alloc(l);
            if (_p) memcpy(_p, o._p, l);
        }
        else
            _p = NULL;

        _malloc->Free(h);
    }
void ShellPath::operator= ( const SHITEMID &  o ) [inline]

Definition at line 768 of file shellclasses.h.

References SShellPtr< ITEMIDLIST >::_malloc, and SShellPtr< ITEMIDLIST >::_p.

    {
        ITEMIDLIST* h = _p;

        LPBYTE p = (LPBYTE)_malloc->Alloc(o.cb+2);
        if (p) *(PWORD)((LPBYTE)memcpy(p, &o, o.cb)+o.cb) = 0;
        _p = (ITEMIDLIST*)p;

        _malloc->Free(h);
    }
void ShellPath::operator= ( ITEMIDLIST *  p ) [inline]

Definition at line 751 of file shellclasses.h.

References SShellPtr< ITEMIDLIST >::_malloc, SShellPtr< ITEMIDLIST >::_p, and ILGetSize.

    {
        //CONTEXT("ShellPath::operator=(ITEMIDLIST*)");

        ITEMIDLIST* h = _p;

        if (p) {
            int l = ILGetSize(p);
            _p = (ITEMIDLIST*) _malloc->Alloc(l);
            if (_p) memcpy(_p, p, l);
        }
        else
            _p = NULL;

        _malloc->Free(h);
    }
void ShellPath::split ( ShellPath parent,
ShellPath obj 
) const

Definition at line 340 of file shellclasses.cpp.

References assign().

Referenced by GetUIObjectOf().

{
    SHITEMID *piid, *piidLast;
    int size = 0;

     // find last item-id and calculate total size of pidl
    for(piid=piidLast=&_p->mkid; piid->cb; ) {
        piidLast = piid;
        size += (piid->cb);
        piid = (SHITEMID*)((LPBYTE)piid + (piid->cb));
    }

     // copy parent folder portion
    size -= piidLast->cb;  // don't count "object" item-id

    if (size > 0)
        parent.assign(_p, size);

     // copy "object" portion
    obj.assign((ITEMIDLIST*)piidLast, piidLast->cb);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

bool operator< ( const ShellPath a,
const ShellPath b 
) [friend]

Definition at line 794 of file shellclasses.h.

    {
        int la = ILGetSize(a._p);
        int lb = ILGetSize(b._p);

        int r = memcmp(a._p, b._p, min(la, lb));
        if (r)
            return r < 0;
        else
            return la < lb;
    }

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

ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage