Back to index

im-sdk  12.3.91
Public Member Functions | Private Member Functions | Private Attributes
LEDirectoryInfo Class Reference

#include <IMUtil.hh>

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

List of all members.

Public Member Functions

DirectoryInfoVecget_directory_info ()
bool refresh (const char *path=NULL)
 LEDirectoryInfo ()

Private Member Functions

bool addfile (const char *filename)

Private Attributes

string path
DirectoryInfoVec dirvec

Detailed Description

Definition at line 38 of file IMUtil.hh.


Constructor & Destructor Documentation

Definition at line 49 of file IMUtil.hh.

                      : DirectoryInfo(true, false) {
    };

Member Function Documentation

bool LEDirectoryInfo::addfile ( const char *  filename) [private]

Reimplemented from DirectoryInfo.

Definition at line 167 of file IMUtil.cpp.

{
    struct stat s;
    DirectoryEntry d;

    string full = filename;
    if (full.empty()) return false;

    if (stat(full.c_str(), &s) != 0) return false;

    d.fullname = full;

    {
       string::size_type fpos;
#ifdef WIN32
       fpos = d.fullname.find_last_of("\\/");
#else
       fpos = d.fullname.rfind('/');
#endif
       if (fpos == string::npos) {
           d.filename = d.fullname;
           d.dirname = "";
       } else {
           d.filename = d.fullname.substr(fpos + 1);
           d.dirname = d.fullname.substr(0, fpos + 1);
       }
    }

    d.readable_p = (s.st_mode & S_IRUSR);
    d.writable_p = (s.st_mode & S_IWUSR);
    d.directory_p = S_ISDIR(s.st_mode); 
    dirvec.push_back(d);

    return true;
}

Here is the caller graph for this function:

Reimplemented from DirectoryInfo.

Definition at line 45 of file IMUtil.hh.

{ return &dirvec; }

Here is the caller graph for this function:

bool LEDirectoryInfo::refresh ( const char *  path = NULL)

Reimplemented from DirectoryInfo.

Definition at line 206 of file IMUtil.cpp.

{
    DirectoryInfo di;
    DirectoryInfoVec *pdv;

    if (x_path) path = x_path;
    if (path.empty()) return false;

    if (!dirvec.empty()) dirvec.erase(dirvec.begin(), dirvec.end());

    DirectoryInfo::refresh(path.c_str());

    pdv = DirectoryInfo::get_directory_info();
    DirectoryInfoVec::const_iterator i = pdv->begin();
    for (; i != pdv->end();++i) {
       string full = i->dirname;

       if (0 == strcmp("locale", i->filename.c_str())) continue;

       char tail = full.at(full.size() - 1);
       if (!IS_DIRECTORY_SEP(tail)) {
           full = full.append(DIRECTORY_SEP);
       }

#ifdef WIN32
#define MODEXT ".dll"
#else
#define MODEXT ".so"
#endif
       full = full.append(i->filename);
       if (i->filename.rfind(MODEXT, i->filename.size()) >= i->filename.size()) {
           full = full.append(DIRECTORY_SEP);
           full = full.append(i->filename);
           full = full.append(MODEXT);
       }
       addfile(full.c_str());
    }

    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Reimplemented from DirectoryInfo.

Definition at line 40 of file IMUtil.hh.

string LEDirectoryInfo::path [private]

Reimplemented from DirectoryInfo.

Definition at line 39 of file IMUtil.hh.


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