diff src/win32/7zip/7z/CPP/7zip/Archive/Rar/RarItem.cpp @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/win32/7zip/7z/CPP/7zip/Archive/Rar/RarItem.cpp	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,55 @@
     1.4 +// RarItem.cpp
     1.5 +
     1.6 +#include "StdAfx.h"
     1.7 +
     1.8 +#include "RarItem.h"
     1.9 +
    1.10 +namespace NArchive{
    1.11 +namespace NRar{
    1.12 +
    1.13 +bool CItem::IgnoreItem() const
    1.14 +{
    1.15 +  switch(HostOS)
    1.16 +  {
    1.17 +    case NHeader::NFile::kHostMSDOS:
    1.18 +    case NHeader::NFile::kHostOS2:
    1.19 +    case NHeader::NFile::kHostWin32:
    1.20 +      return ((Attrib & NHeader::NFile::kLabelFileAttribute) != 0);
    1.21 +  }
    1.22 +  return false;
    1.23 +}
    1.24 +
    1.25 +bool CItem::IsDir() const
    1.26 +{
    1.27 +  if (GetDictSize() == NHeader::NFile::kDictDirectoryValue)
    1.28 +    return true;
    1.29 +  switch(HostOS)
    1.30 +  {
    1.31 +    case NHeader::NFile::kHostMSDOS:
    1.32 +    case NHeader::NFile::kHostOS2:
    1.33 +    case NHeader::NFile::kHostWin32:
    1.34 +      if ((Attrib & FILE_ATTRIBUTE_DIRECTORY) != 0)
    1.35 +        return true;
    1.36 +  }
    1.37 +  return false;
    1.38 +}
    1.39 +
    1.40 +UInt32 CItem::GetWinAttributes() const
    1.41 +{
    1.42 +  UInt32 winAttributes;
    1.43 +  switch(HostOS)
    1.44 +  {
    1.45 +    case NHeader::NFile::kHostMSDOS:
    1.46 +    case NHeader::NFile::kHostOS2:
    1.47 +    case NHeader::NFile::kHostWin32:
    1.48 +      winAttributes = Attrib;
    1.49 +      break;
    1.50 +    default:
    1.51 +      winAttributes = 0; // must be converted from unix value;
    1.52 +  }
    1.53 +  if (IsDir())
    1.54 +    winAttributes |= NHeader::NFile::kWinFileDirectoryAttributeMask;
    1.55 +  return winAttributes;
    1.56 +}
    1.57 +
    1.58 +}}