libjxl

FORK: libjxl patches used on blog
git clone https://git.neptards.moe/blog/libjxl.git
Log | Files | Refs | Submodules | README | LICENSE

benchmark_file_io.h (1791B)


      1 // Copyright (c) the JPEG XL Project Authors. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file.
      5 
      6 // File utilities for benchmarking and testing, but which are not needed for
      7 // main jxl itself.
      8 
      9 #ifndef TOOLS_BENCHMARK_BENCHMARK_FILE_IO_H_
     10 #define TOOLS_BENCHMARK_BENCHMARK_FILE_IO_H_
     11 
     12 #include <string>
     13 #include <vector>
     14 
     15 #include "lib/jxl/base/status.h"
     16 #include "tools/file_io.h"
     17 
     18 namespace jpegxl {
     19 namespace tools {
     20 
     21 using ::jxl::Status;
     22 
     23 // Checks if the file exists, either as file or as directory
     24 bool PathExists(const std::string& fname);
     25 
     26 // Checks if the file exists and is a regular file.
     27 bool IsRegularFile(const std::string& fname);
     28 
     29 // Checks if the file exists and is a directory.
     30 bool IsDirectory(const std::string& fname);
     31 
     32 // Recursively makes dir, or successfully does nothing if it already exists.
     33 Status MakeDir(const std::string& dirname);
     34 
     35 // Deletes a single regular file.
     36 Status DeleteFile(const std::string& fname);
     37 
     38 // Returns value similar to unix basename, except it returns empty string if
     39 // fname ends in '/'.
     40 std::string FileBaseName(const std::string& fname);
     41 // Returns value similar to unix dirname, except returns up to before the last
     42 // slash if fname ends in '/'.
     43 std::string FileDirName(const std::string& fname);
     44 
     45 // Returns the part of the filename starting from the last dot, or empty
     46 // string if there is no dot.
     47 std::string FileExtension(const std::string& fname);
     48 
     49 // Matches one or more files given glob pattern.
     50 Status MatchFiles(const std::string& pattern, std::vector<std::string>* list);
     51 
     52 std::string JoinPath(const std::string& first, const std::string& second);
     53 
     54 }  // namespace tools
     55 }  // namespace jpegxl
     56 
     57 #endif  // TOOLS_BENCHMARK_BENCHMARK_FILE_IO_H_