#include <cstring>
#include <map>
#include <algorithm>
+
using std::map;
using std::sort;
#ifdef BROKEN_HEADERS
extern "C" int gettimeofday(struct timeval *, struct timezone *);
-#define remove(a) unlink(a)
#endif
#ifdef __GNUG__
}
private:
///
- void add(uid_t ID) const {
- string pszNewName;
- struct passwd * pEntry;
-
- // gets user name
- if ((pEntry = getpwuid(ID)))
- pszNewName = pEntry->pw_name;
- else {
- pszNewName = tostr(ID);
- }
-
- // adds new node
- users[ID] = pszNewName;
- }
+ void add(uid_t ID) const;
///
typedef map<uid_t, string> Users;
///
mutable Users users;
};
+void UserCache::add(uid_t ID) const
+{
+ string pszNewName;
+ struct passwd * pEntry;
+
+ // gets user name
+ if ((pEntry = getpwuid(ID)))
+ pszNewName = pEntry->pw_name;
+ else {
+ pszNewName = tostr(ID);
+ }
+
+ // adds new node
+ users[ID] = pszNewName;
+}
+
/// Group cache class definition
class GroupCache {
}
private:
///
- void add(gid_t ID) const {
- string pszNewName;
- struct group * pEntry;
-
- // gets user name
- if ((pEntry = getgrgid(ID))) pszNewName = pEntry->gr_name;
- else {
- pszNewName = tostr(ID);
- }
- // adds new node
- groups[ID] = pszNewName;
- }
+ void add(gid_t ID) const;
///
typedef map<gid_t, string> Groups;
///
mutable Groups groups;
};
+void GroupCache::add(gid_t ID) const
+{
+ string pszNewName;
+ struct group * pEntry;
+
+ // gets user name
+ if ((pEntry = getgrgid(ID))) pszNewName = pEntry->gr_name;
+ else {
+ pszNewName = tostr(ID);
+ }
+ // adds new node
+ groups[ID] = pszNewName;
+}
+
// static instances
static UserCache lyxUserCache;
static GroupCache lyxGroupCache;
void LyXFileDlg::Reread()
{
// Opens directory
- DIR * pDirectory = opendir(pszDirectory.c_str());
+ DIR * pDirectory = ::opendir(pszDirectory.c_str());
if (!pDirectory) {
WriteFSAlert(_("Warning! Couldn't open directory."),
pszDirectory);
pszDirectory = GetCWD();
- pDirectory = opendir(pszDirectory.c_str());
+ pDirectory = ::opendir(pszDirectory.c_str());
}
// Clear the present namelist
*pTemp = pszPath;
} else {
fl_hide_object(pObject);
- (*pTemp).clear();
+ (*pTemp).erase();
}
}
// GetDirectory: gets last dialog directory
-string LyXFileDlg::GetDirectory() const
+string const LyXFileDlg::GetDirectory() const
{
if (!pszDirectory.empty())
return pszDirectory;
}
}
+
extern "C" void C_LyXFileDlg_FileDlgCB(FL_OBJECT * ob, long data)
{
LyXFileDlg::FileDlgCB(ob, data);
Temp += pszTemp;
} else {
// Directory higher up
- Temp.clear();
+ Temp.erase();
for (int i = 0; i < iSelect; ++i) {
string piece = fl_get_browser_line(pFileDlgForm->List, i+1);
// The '+2' is here to count the '@b' (JMarc)
// Select: launches dialog and returns selected file
-string LyXFileDlg::Select(string const & title, string const & path,
+string const LyXFileDlg::Select(string const & title, string const & path,
string const & mask, string const & suggested)
{
// handles new mask and path