2 * @file ns_util_directory.h
3 * @brief \~english This file contains declaration of ns_util_directory.
7 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
22 //////////////////////////////////////////////////////////////////////////////////////////////////
23 /// \brief This file contains utility functions to handle file and folder operations.
27 //////////////////////////////////////////////////////////////////////////////////////////////////
31 #ifndef NS_NS_UTILITYCENTER_INC_NS_UTIL_DIRECTORY_H_ // NOLINT (build/header_guard)
32 #define NS_NS_UTILITYCENTER_INC_NS_UTIL_DIRECTORY_H_
34 #include <native_service/frameworkunified_types.h>
38 /** @addtogroup BaseSystem
41 /** @addtogroup native_service
45 /** @addtogroup framework_unified
46 * @ingroup native_service
49 /** @addtogroup utility
50 * @ingroup framework_unified
55 * \~english an abbreviation for std::vector<std::string>
57 typedef std::vector< std::string > TFileList;
60 * \~english a abbreviation for std::vector<std::string>::iterator
62 typedef TFileList::iterator TFileListIterator;
68 ////////////////////////////////////////////////////////////////////////////////////////////////
69 /// \ingroup NS_UtilityCenter
70 /// \~english @par Brief
71 /// Get the name of files existing in a specific directory
72 /// \~english @param [in] f_pc_path
73 /// PCSTR - the directory path
74 /// \~english @param [out] f_pv_tfile_list
75 /// TFileList - store the name of the files in the specific directory
76 /// \~english @retval eFrameworkunifiedStatusOK : Success
77 /// \~english @retval eFrameworkunifiedStatusInvldParam : Invalid Param
78 /// \~english @retval eFrameworkunifiedStatusNullPointer : NULL Pointer
79 /// \~english @retval eFrameworkunifiedStatusFail : Abnormal Error
81 /// \~english @par Prerequisite
83 /// \~english @par Change of internal state
85 /// \~english @par Conditions of processing failure
86 /// - The pointer f_pv_tfile_list or f_pc_path is NULL. [eFrameworkunifiedStatusInvldParam]
87 /// - Failed to open the directory f_pc_path. [eFrameworkunifiedStatusFail]
88 /// - Failed to new a buffer for inner using. [eFrameworkunifiedStatusNullPointer]
89 /// \~english @par Classification
91 /// \~english @par Type
93 /// \~english @par Detail
94 /// The function gets all the name of the file locating at the directory f_pc_path and stores \n
95 /// them in f_pv_tfile_list.
97 ////////////////////////////////////////////////////////////////////////////////////////////////
98 EFrameworkunifiedStatus GetFileList(TFileList * f_pv_tfile_list, PCSTR f_pc_path);
100 ////////////////////////////////////////////////////////////////////////////////////////////////
101 /// \ingroup NS_UtilityCenter
102 /// \~english @par Brief
103 /// Check whether the directory is existing or not.
104 /// \~english @param [in] f_c_dir_path
105 /// std::string - the directory to be checked
106 /// \~english @retval TRUE: the directory is existing.
107 /// FALSE: the directory is not existing.
108 /// \~english @par Prerequisite
110 /// \~english @par Change of internal state
112 /// \~english @par Conditions of processing failure
114 /// \~english @par Classification
116 /// \~english @par Type
118 /// \~english @par Detail
119 /// The function checks whether the directory is existing or not.
121 ////////////////////////////////////////////////////////////////////////////////////////////////
122 BOOL DoesDirecotryExist(std::string f_c_dir_path);
124 ////////////////////////////////////////////////////////////////////////////////////////////////
125 /// \ingroup NS_UtilityCenter
126 /// \~english @par Brief
127 /// Create the directory f_c_dir_path.
128 /// \~english @param [in] f_c_dir_path
129 /// std::string - the directory to be created
130 /// \~english @retval eFrameworkunifiedStatusOK : Success
131 /// \~english @retval eFrameworkunifiedStatusFail : Abnormal Error
133 /// \~english @par Prerequisite
135 /// \~english @par Change of internal state
137 /// \~english @par Conditions of processing failure
138 /// - The input param f_c_dir_path is empty. [eFrameworkunifiedStatusFail]
139 /// - Faild to create(mkdir) the direcory. [eFrameworkunifiedStatusFail]
140 /// \~english @par Classification
142 /// \~english @par Type
144 /// \~english @par Detail
145 /// The function creates the directory f_c_dir_path.
147 ////////////////////////////////////////////////////////////////////////////////////////////////
148 EFrameworkunifiedStatus CreateDirectory(std::string f_c_dir_path);
155 #endif // NS_NS_UTILITYCENTER_INC_NS_UTIL_DIRECTORY_H_ NOLINT (build/header_guard)
157 /** @}*/ // end of utility
158 /** @}*/ // end of framework_unified
159 /** @}*/ // end of native_service
160 /** @}*/ // end of BaseSystem