1 /* Copyright 2012-present Facebook, Inc.
2  * Licensed under the Apache License, Version 2.0 */
3 
4 #include "watchman.h"
5 
operator ()(watchman_file * file) const6 void watchman_dir::Deleter::operator()(watchman_file* file) const {
7   free_file_node(file);
8 }
9 
watchman_dir(w_string name,watchman_dir * parent)10 watchman_dir::watchman_dir(w_string name, watchman_dir* parent)
11     : name(name), parent(parent) {}
12 
getFullPath() const13 w_string watchman_dir::getFullPath() const {
14   return w_dir_path_cat_str(this, w_string_piece());
15 }
16 
getChildFile(w_string name) const17 watchman_file* watchman_dir::getChildFile(w_string name) const {
18   auto it = files.find(name.piece());
19   if (it == files.end()) {
20     return nullptr;
21   }
22   return it->second.get();
23 }
24 
getChildDir(w_string name) const25 watchman_dir* watchman_dir::getChildDir(w_string name) const {
26   auto it = dirs.find(name);
27   if (it == dirs.end()) {
28     return nullptr;
29   }
30   return it->second.get();
31 }
32 
33 /* vim:ts=2:sw=2:et:
34  */
35