OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef PPAPI_CPP_DIRECTORY_ENTRY_H_ |
| 6 #define PPAPI_CPP_DIRECTORY_ENTRY_H_ |
| 7 |
| 8 #include "ppapi/c/ppb_directory_reader.h" |
| 9 #include "ppapi/cpp/file_ref.h" |
| 10 |
| 11 /// @file |
| 12 /// This file defines the API used to handle a directory entry. |
| 13 |
| 14 namespace pp { |
| 15 |
| 16 /// The <code>DirectoryEntry</code> class represents information about a |
| 17 /// directory entry. |
| 18 class DirectoryEntry { |
| 19 public: |
| 20 /// Default constructor for creating an is_null() <code>DirectoryEntry</code> |
| 21 /// object. |
| 22 DirectoryEntry(); |
| 23 |
| 24 /// A constructor used when you have a <code>PP_DirectoryEntry</code> which |
| 25 /// contains a <code>FileRef</code> that has already been reference counted |
| 26 /// as a return value. |
| 27 /// |
| 28 /// @param[in] data A <code>PP_DirectoryEntry</code> to be copied. |
| 29 DirectoryEntry(PassRef, const PP_DirectoryEntry& data); |
| 30 |
| 31 /// A copy constructor for <code>DirectoryEntry</code>. This constructor |
| 32 /// increments a reference count of the <code>FileRef</code> held by this |
| 33 /// DirectoryEntry. |
| 34 /// |
| 35 /// @param[in] other A pointer to a <code>DirectoryEntry</code>. |
| 36 DirectoryEntry(const DirectoryEntry& other); |
| 37 |
| 38 /// A destructor that decrements a reference count of the <code>FileRef</code> |
| 39 /// held by this <code>DirectoryEntry</code>. |
| 40 ~DirectoryEntry(); |
| 41 |
| 42 /// This function assigns one <code>DirectoryEntry</code> object to this |
| 43 /// <code>DirectoryEntry</code> object. This function increases the reference |
| 44 /// count of the <code>FileRef</code> of the other DirectoryEntry while |
| 45 /// decrementing the reference count of the FileRef of this DirectoryEntry. |
| 46 /// |
| 47 /// @param[in] other A pointer to a <code>DirectoryEntry</code>. |
| 48 /// |
| 49 /// @return A new <code>DirectoryEntry</code> object. |
| 50 DirectoryEntry& operator=(const DirectoryEntry& other); |
| 51 |
| 52 /// This function determines if this <code>DirectoryEntry</code> is a null |
| 53 /// value. |
| 54 /// |
| 55 /// @return true if this <code>DirectoryEntry</code> is null, otherwise false. |
| 56 bool is_null() const { return !data_.file_ref; } |
| 57 |
| 58 /// This function returns the <code>FileRef</code> held by this |
| 59 /// <code>DirectoryEntry</code>. |
| 60 /// |
| 61 /// @return A <code>FileRef</code> of the file. |
| 62 FileRef file_ref() const { return FileRef(data_.file_ref); } |
| 63 |
| 64 /// This function returns the <code>PP_FileType</code> of the file referenced |
| 65 /// by this <code>DirectoryEntry</code>. |
| 66 /// |
| 67 /// @return A <code>PP_FileType</code> of the file. |
| 68 PP_FileType file_type() const { return data_.file_type; } |
| 69 |
| 70 private: |
| 71 PP_DirectoryEntry data_; |
| 72 }; |
| 73 |
| 74 } // namespace pp |
| 75 |
| 76 #endif // PPAPI_CPP_DIRECTORY_ENTRY_H_ |
OLD | NEW |