1// Copyright 2009-2021 Intel Corporation
2// SPDX-License-Identifier: Apache-2.0
3
4#pragma once
5
6#include "platform.h"
7
8namespace embree
9{
10 /*! Convenience class for handling file names and paths. */
11 class FileName
12 {
13 public:
14
15 /*! create an empty filename */
16 FileName ();
17
18 /*! create a valid filename from a string */
19 FileName (const char* filename);
20
21 /*! create a valid filename from a string */
22 FileName (const std::string& filename);
23
24 /*! returns path to home folder */
25 static FileName homeFolder();
26
27 /*! returns path to executable */
28 static FileName executableFolder();
29
30 /*! auto convert into a string */
31 operator std::string() const { return filename; }
32
33 /*! returns a string of the filename */
34 const std::string str() const { return filename; }
35
36 /*! returns a c-string of the filename */
37 const char* c_str() const { return filename.c_str(); }
38
39 /*! returns the path of a filename */
40 FileName path() const;
41
42 /*! returns the file of a filename */
43 std::string base() const;
44
45 /*! returns the base of a filename without extension */
46 std::string name() const;
47
48 /*! returns the file extension */
49 std::string ext() const;
50
51 /*! drops the file extension */
52 FileName dropExt() const;
53
54 /*! replaces the file extension */
55 FileName setExt(const std::string& ext = "") const;
56
57 /*! adds file extension */
58 FileName addExt(const std::string& ext = "") const;
59
60 /*! concatenates two filenames to this/other */
61 FileName operator +( const FileName& other ) const;
62
63 /*! concatenates two filenames to this/other */
64 FileName operator +( const std::string& other ) const;
65
66 /*! removes the base from a filename (if possible) */
67 FileName operator -( const FileName& base ) const;
68
69 /*! == operator */
70 friend bool operator==(const FileName& a, const FileName& b);
71
72 /*! != operator */
73 friend bool operator!=(const FileName& a, const FileName& b);
74
75 /*! output operator */
76 friend std::ostream& operator<<(std::ostream& cout, const FileName& filename);
77
78 private:
79 std::string filename;
80 };
81}
82

source code of qtquick3d/src/3rdparty/embree/common/sys/filename.h