📄 wardirlistnode.cpp
字号:
#include "StdAfx.h"#include "WarDirListNode.h" // class implemented#ifndef WAR_FSYS_H# include "WarFsys.h"#endif#ifndef WAR_LOG_H# include "WarLog.h"#endif/////////////////////////////// PUBLIC /////////////////////////////////////////============================= LIFECYCLE ====================================//============================= OPERATORS ====================================void WarDirListNode::operator = (const WarSvrPath& from){ war_stat_t st; WarLog err_log(WARLOG_ERROR, "WarDirListNode::operator = (const WarSvrPath& from)"); try { ::WarFsysStat(from.GetUrl(), st); // Throws if file don't exist } catch(WarException& e) { err_log << "The Alias '" << from.GetAlias() << "' refers to the directory '" << from.GetPath() << "'. I cannot find this directory." << e << war_endl; WarThrow(e, NULL); } if ((st.st_mode & S_IFDIR) != S_IFDIR) { err_log << "The Alias '" << from.GetAlias() << "' refers to the directory '" << from.GetPath() << "'. The path exist, but is not a directory." << war_endl; WarThrow(WarError(WAR_FERR_NOT_A_DIRECTORY), NULL); } operator = (st); // Get date and basic stuff if (!(from.GetPerms() & ALLOW_LIST)) mMode &= ~0444; if (!(from.GetPerms() & ALLOW_WRITE)) mMode &= ~0222; if (!(from.GetPerms() & ALLOW_CWD)) mMode &= ~0111;}void WarDirListNode::operator = (const war_stat_t& st){ mCreationTime = st.st_ctime; mModifyTime = st.st_mtime; mAccessTime = st.st_atime; mSize = st.st_size; mMode = st.st_mode; mInode = st.st_ino; mLinks = st.st_nlink; mUid = st.st_uid; mGid = st.st_gid; if ((st.st_mode & S_IFDIR) == S_IFDIR) mType = FT_DIR;#ifndef WIN32 else if ((st.st_mode & S_IFLNK) == S_IFLNK) mType = FT_LINK;#endif else if ((st.st_mode & S_IFREG) != S_IFREG) mType = FT_SPECIAL;}void WarDirListNode::operator = (const WarDirListNodeData& from){ WarDirListNodeData::operator = (from); }#ifdef WIN32void WarDirListNode::operator = (const WIN32_FIND_DATA& D){ mCreationTime = D.ftCreationTime; mModifyTime = D.ftLastWriteTime; mAccessTime = D.ftLastAccessTime; mSize = D.nFileSizeLow | (D.nFileSizeHigh << 32); if ((mType == FT_NORMAL) && (D.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) mType = FT_DIR; mMode = (mType == FT_DIR) ? 0775 : 0664; if (D.dwFileAttributes & FILE_ATTRIBUTE_READONLY) mMode &= ~0222; mLinks = 1; mUid = mGid = 0;}#endifvoid WarDirListNode::operator = (const WarDirListNode& from){ // NB: name is not copied as it must be allocated! mCreationTime = from.mCreationTime; mModifyTime = from.mModifyTime; mAccessTime = from.mAccessTime; mSize = from.mSize; mType = from.mType; mMode = from.mMode; mInode = from.mInode; mLinks = from.mLinks; mUid = from.mUid; mGid = from.mGid;}//============================= OPERATIONS ===================================//============================= ACCESS ===================================//============================= INQUIRY ===================================/////////////////////////////// PROTECTED ////////////////////////////////////////////////////////////////// PRIVATE ///////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -