HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/vhost/disk-apps/alq-cali.bikenow.co/node_modules/@parcel/watcher/src/DirTree.hh
#ifndef DIR_TREE_H
#define DIR_TREE_H

#include <string>
#include <unordered_map>
#include <memory>
#include "Event.hh"

#ifdef _WIN32
#define DIR_SEP "\\"
#else
#define DIR_SEP "/"
#endif

struct DirEntry {
  std::string path;
  uint64_t mtime;
  bool isDir;
  mutable void *state;

  DirEntry(std::string p, uint64_t t, bool d);
  DirEntry(FILE *f);
  void write(FILE *f) const;
  bool operator==(const DirEntry &other) const {
    return path == other.path;
  }
};

class DirTree {
public:
  static std::shared_ptr<DirTree> getCached(std::string root);
  DirTree(std::string root) : root(root), isComplete(false) {}
  DirTree(std::string root, FILE *f);
  DirEntry *add(std::string path, uint64_t mtime, bool isDir);
  DirEntry *find(std::string path);
  DirEntry *update(std::string path, uint64_t mtime);
  void remove(std::string path);
  void write(FILE *f);
  void getChanges(DirTree *snapshot, EventList &events);

  std::mutex mMutex;
  std::string root;
  bool isComplete;
  std::unordered_map<std::string, DirEntry> entries;

private:
  DirEntry *_find(std::string path);
};

#endif