Line data Source code
1 : /**
2 : * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 : #ifndef ADUMP_COMMON_PATH_H
11 : #define ADUMP_COMMON_PATH_H
12 :
13 : #include <string>
14 : #include "mmpa_api.h"
15 :
16 : namespace Adx {
17 : class Path {
18 : public:
19 232 : Path() noexcept : path_() {}
20 140928 : explicit Path(const std::string &path) : path_(path) {}
21 141588 : ~Path() = default;
22 :
23 : Path &operator = (const std::string &path);
24 : bool operator == (const Path &other) const;
25 : Path &operator += (const std::string &path);
26 : Path &Assign(const std::string &path);
27 : Path &Append(const std::string &path);
28 : Path &Concat(const std::string &path);
29 : Path &AddExtension(const std::string &extension);
30 : std::string GetExtension() const;
31 : std::string GetFileName() const;
32 : bool Empty() const;
33 : bool Exist() const;
34 : bool Asccess(mmMode_t mode) const;
35 : bool IsDirectory() const;
36 : bool RealPath();
37 : Path ParentPath() const;
38 : bool CreateDirectory(bool recursion = false) const;
39 : std::string GetString() const;
40 : const char *GetCString() const;
41 :
42 : private:
43 : void AppendPath(const std::string &path);
44 : void AddSeperator();
45 : std::string path_;
46 : };
47 : } // namespace Adx
48 :
49 : #endif // ADUMP_COMMON_PATH_H
|