Annotation of truecrypt/platform/filesystempath.h, revision 1.1.1.7

1.1       root        1: /*
1.1.1.6   root        2:  Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved.
1.1       root        3: 
1.1.1.7 ! root        4:  Governed by the TrueCrypt License 3.0 the full text of which is contained in
1.1.1.6   root        5:  the file License.txt included in TrueCrypt binary and source code distribution
                      6:  packages.
1.1       root        7: */
                      8: 
                      9: #ifndef TC_HEADER_Platform_FilesystemPath
                     10: #define TC_HEADER_Platform_FilesystemPath
                     11: 
                     12: #include "PlatformBase.h"
1.1.1.3   root       13: #include "Platform/User.h"
1.1       root       14: #include "SharedPtr.h"
                     15: #include "StringConverter.h"
                     16: 
                     17: namespace TrueCrypt
                     18: {
                     19:        struct FilesystemPathType
                     20:        {
                     21:                enum Enum
                     22:                {
                     23:                        Unknown,
                     24:                        File,
                     25:                        Directory,
                     26:                        SymbolickLink,
                     27:                        BlockDevice,
                     28:                        CharacterDevice
                     29:                };
                     30:        };
                     31: 
                     32:        class FilesystemPath 
                     33:        {
                     34:        public:
                     35:                FilesystemPath () { }
                     36:                FilesystemPath (const char *path) : Path (StringConverter::ToWide (path)) { }
                     37:                FilesystemPath (string path) : Path (StringConverter::ToWide (path)) { }
                     38:                FilesystemPath (const wchar_t *path) : Path (path) { }
                     39:                FilesystemPath (wstring path) : Path (path) { }
                     40:                virtual ~FilesystemPath () { }
                     41: 
                     42:                bool operator== (const FilesystemPath &other) const { return Path == other.Path; }
                     43:                bool operator!= (const FilesystemPath &other) const { return Path != other.Path; }
                     44:                operator string () const { return StringConverter::ToSingle (Path); }
                     45:                operator wstring () const { return Path; }
                     46: 
                     47:                void Delete () const;
1.1.1.3   root       48:                UserId GetOwner () const;
1.1       root       49:                FilesystemPathType::Enum GetType () const;
                     50:                bool IsBlockDevice () const throw () { try { return GetType() == FilesystemPathType::BlockDevice; } catch (...) { return false; }; }
                     51:                bool IsCharacterDevice () const throw () { try { return GetType() == FilesystemPathType::CharacterDevice; } catch (...) { return false; }; }
                     52:                bool IsDevice () const throw () { return IsBlockDevice() || IsCharacterDevice(); }
                     53:                bool IsDirectory () const throw () { try { return GetType() == FilesystemPathType::Directory; } catch (...) { return false; } }
                     54:                bool IsEmpty () const throw () { try { return Path.empty(); } catch (...) { return false; } }
                     55:                bool IsFile () const throw () { try { return GetType() == FilesystemPathType::File; } catch (...) { return false; } }
1.1.1.3   root       56:                FilesystemPath ToBaseName () const;
                     57:                FilesystemPath ToHostDriveOfPartition () const;
                     58:                
1.1       root       59:                static const int MaxSize = 260;
                     60: 
                     61:        protected:
                     62:                wstring Path;
                     63:        };
                     64: 
                     65:        typedef FilesystemPath DevicePath;
                     66:        typedef FilesystemPath DirectoryPath;
                     67:        typedef FilesystemPath FilePath;
                     68: 
                     69:        typedef list < shared_ptr <DirectoryPath> > DirectoryPathList;
                     70:        typedef list < shared_ptr <FilePath> > FilePathList;
                     71: }
                     72: 
                     73: #endif // TC_HEADER_Platform_FilesystemPath

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.