]> git.lyx.org Git - lyx.git/blobdiff - src/support/FileInfo.C
* lyxfunctional.h: delete compare_memfun and helper classes
[lyx.git] / src / support / FileInfo.C
index 795e1a57ce0e065bd9efe02af9f042d6bd01d1cc..204e85541efa5d3c6ea510acd9f139c60e67b2db 100644 (file)
@@ -1,25 +1,24 @@
-/* This file is part of
- * ======================================================
+/**
+ * \file FileInfo.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
+ * \author Lars Gullik Bjønnes
  *
- *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2001 The LyX Team.
- *
- * ====================================================== */
+ * Full author contact details are available in file CREDITS.
+ */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
+#include "FileInfo.h"
 
-//#include <sys/types.h>
-//#include <sys/stat.h>
+#include <boost/assert.hpp>
 
 #include <cerrno>
-#include "FileInfo.h"
-#include "LAssert.h"
+
+
+using std::string;
+
 
 #if !S_IRUSR
 # if S_IREAD
@@ -102,7 +101,7 @@ void flagRWX(mode_t i, char * str)
 void setSticky(mode_t i, char * str)
 {
 #ifdef S_ISUID
-       if (i & S_ISUID) 
+       if (i & S_ISUID)
                str[3] = (str[3] == 'x') ? 's' : 'S';
 #endif
 #ifdef S_ISGID
@@ -110,7 +109,7 @@ void setSticky(mode_t i, char * str)
                str[6] = (str[6] == 'x') ? 's' : 'S';
 #endif
 #ifdef S_ISVTX
-       if (i & S_ISVTX) 
+       if (i & S_ISVTX)
                str[9] = (str[9] == 'x') ? 's' : 'S';
 #endif
 }
@@ -146,6 +145,9 @@ char typeLetter(mode_t i)
 } // namespace anon
 
 
+namespace lyx {
+namespace support {
+
 FileInfo::FileInfo()
 {
        init();
@@ -211,7 +213,7 @@ FileInfo & FileInfo::newFile(int fildes)
 // should not be in FileInfo
 char FileInfo::typeIndicator() const
 {
-       lyx::Assert(isOK());
+       BOOST_ASSERT(isOK());
        if (S_ISDIR(buf_.st_mode))
                return '/';
 #ifdef S_ISLNK
@@ -234,7 +236,7 @@ char FileInfo::typeIndicator() const
 
 mode_t FileInfo::getMode() const
 {
-       lyx::Assert(isOK());
+       BOOST_ASSERT(isOK());
        return buf_.st_mode;
 }
 
@@ -242,7 +244,7 @@ mode_t FileInfo::getMode() const
 // should not be in FileInfo
 string FileInfo::modeString() const
 {
-       lyx::Assert(isOK());
+       BOOST_ASSERT(isOK());
        char str[11];
        str[0] = typeLetter(buf_.st_mode);
        flagRWX((buf_.st_mode & 0700) << 0, &str[1]);
@@ -257,49 +259,49 @@ string FileInfo::modeString() const
 
 time_t FileInfo::getModificationTime() const
 {
-       lyx::Assert(isOK());
+       BOOST_ASSERT(isOK());
        return buf_.st_mtime;
 }
 
 
 time_t FileInfo::getAccessTime() const
 {
-       lyx::Assert(isOK());
+       BOOST_ASSERT(isOK());
        return buf_.st_atime;
 }
 
 
 time_t FileInfo::getStatusChangeTime() const
 {
-       lyx::Assert(isOK());
+       BOOST_ASSERT(isOK());
        return buf_.st_ctime;
 }
 
 
 nlink_t FileInfo::getNumberOfLinks() const
 {
-       lyx::Assert(isOK());
+       BOOST_ASSERT(isOK());
        return buf_.st_nlink;
 }
 
 
 uid_t FileInfo::getUid() const
 {
-       lyx::Assert(isOK());
+       BOOST_ASSERT(isOK());
        return buf_.st_uid;
 }
 
 
 gid_t FileInfo::getGid() const
 {
-       lyx::Assert(isOK());
+       BOOST_ASSERT(isOK());
        return buf_.st_gid;
 }
 
 
 off_t FileInfo::getSize() const
 {
-       lyx::Assert(isOK());
+       BOOST_ASSERT(isOK());
        return buf_.st_size;
 }
 
@@ -318,49 +320,49 @@ bool FileInfo::isOK() const
 
 bool FileInfo::isLink() const
 {
-       lyx::Assert(isOK());
+       BOOST_ASSERT(isOK());
        return S_ISLNK(buf_.st_mode);
 }
 
 
 bool FileInfo::isRegular() const
 {
-       lyx::Assert(isOK());
+       BOOST_ASSERT(isOK());
        return S_ISREG(buf_.st_mode);
 }
 
 
 bool FileInfo::isDir() const
 {
-       lyx::Assert(isOK());
+       BOOST_ASSERT(isOK());
        return S_ISDIR(buf_.st_mode);
 }
 
 
 bool FileInfo::isChar() const
 {
-       lyx::Assert(isOK());
+       BOOST_ASSERT(isOK());
        return S_ISCHR(buf_.st_mode);
 }
 
 
 bool FileInfo::isBlock() const
 {
-       lyx::Assert(isOK());
+       BOOST_ASSERT(isOK());
        return S_ISBLK(buf_.st_mode);
 }
 
 
 bool FileInfo::isFifo() const
 {
-       lyx::Assert(isOK());
+       BOOST_ASSERT(isOK());
        return S_ISFIFO(buf_.st_mode);
 }
 
 
 bool FileInfo::isSocket() const
 {
-       lyx::Assert(isOK());
+       BOOST_ASSERT(isOK());
 #ifdef S_ISSOCK
        return S_ISSOCK(buf_.st_mode);
 #else
@@ -380,3 +382,6 @@ bool FileInfo::access(int p) const
        // the file access failed.
        return ::access(fname_.c_str(), p) == 0;
 }
+
+} // namespace support
+} // namespace lyx