tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsDirectoryIndexStream.h (1161B)


      1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 #ifndef nsDirectoryIndexStream_h__
      7 #define nsDirectoryIndexStream_h__
      8 
      9 #include "nsString.h"
     10 #include "nsIInputStream.h"
     11 #include "nsCOMArray.h"
     12 
     13 class nsIFile;
     14 
     15 class nsDirectoryIndexStream final : public nsIInputStream {
     16 private:
     17  nsCString mBuf;
     18  int32_t mOffset{0};
     19  nsresult mStatus{NS_OK};
     20 
     21  int32_t mPos{0};             // position within mArray
     22  nsCOMArray<nsIFile> mArray;  // file objects within the directory
     23 
     24  nsDirectoryIndexStream();
     25  /**
     26   * aDir will only be used on the calling thread.
     27   */
     28  nsresult Init(nsIFile* aDir);
     29  ~nsDirectoryIndexStream();
     30 
     31 public:
     32  /**
     33   * aDir will only be used on the calling thread.
     34   */
     35  static nsresult Create(nsIFile* aDir, nsIInputStream** aResult);
     36 
     37  // nsISupportsInterface
     38  NS_DECL_THREADSAFE_ISUPPORTS
     39 
     40  // nsIInputStream interface
     41  NS_DECL_NSIINPUTSTREAM
     42 };
     43 
     44 #endif  // nsDirectoryIndexStream_h__