add log manager to redirect stderr to dlog
[platform/core/dotnet/launcher.git] / NativeLauncher / inc / utils.h
index ed993fa..d353f92 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 #ifndef __UTILS_H__
 #define __UTILS_H__
 
 #define PATH_SEPARATOR '/'
 #endif
 
-bool ICompare(const std::string& a, const std::string& b);
-bool ICompare(const std::string& a, int a_offset, const std::string& b, int b_offset, int length);
-bool IsManagedAssembly(const std::string& filename);
-bool IsNativeImage(const std::string& filename);
-std::string ReadSelfPath ();
-std::string ConcatPath (const std::string& path1, const std::string& path2);
-void AppendPath (std::string& path1, const std::string& path2);
-std::string AbsolutePath (const std::string& path);
-std::string Basename (const std::string& path);
-bool EndWithIgnoreCase (const std::string& str1, const std::string& str2, std::string& filename);
-void AssembliesInDirectory(const std::vector<std::string>& directories, std::string& tpaList);
-bool FileNotExist(const std::string& path);
-std::string JoinStrings(const std::vector<std::string>& strings, const char* const delimeter);
-
-typedef std::function<void (const char*)> FileReader;
-void ScanFilesInDir(const char* directory, FileReader reader, unsigned int depth);
-
-#endif  // __UTILS_H__
+/**
+ * @brief get current executable path
+ * return std::string path
+ */
+std::string readSelfPath();
+
+/**
+ * @brief concat path with PATH_SEPARATOR
+ * @param[in] destination path
+ * @param[in] source path
+ * return std::string result path
+ */
+std::string concatPath(const std::string& path1, const std::string& path2);
+
+/**
+ * @brief get absolute Path
+ * @param[in] source path
+ * return std::string result path
+ */
+std::string absolutePath(const std::string& path);
+
+/**
+ * @brief get the directory of file
+ * @param[in] source path
+ * return std::string result path
+ */
+std::string baseName(const std::string& path);
+
+/**
+ * @brief split path with ":" delimiter and put that in the vector
+ * @param[in] source path
+ * @param[out] string vector
+ */
+void splitPath(const std::string& path, std::vector<std::string>& out);
+
+/**
+ * @brief check file is exist
+ * @param[in] source path
+ * @return bool
+ */
+bool isFileExist(const std::string& path);
+
+/**
+ * @brief check the file is managed assembly or not.
+ * @param[in] file path
+ * @return return true when the file is managed assembly.
+ *         otherwise return false including native image case.
+ */
+bool isManagedAssembly(const std::string& filePath);
+
+/**
+ * @brief check the file is native image or not.
+ * @param[in] file path
+ * @return return true when the file is native image.
+ */
+bool isNativeImage(const std::string& filePath);
+
+/**
+ * @brief find assembly files in the directories
+ * @param[in] directories
+ * @param[out] ":" seperated assembly path list
+ */
+void assembliesInDirectory(const std::vector<std::string>& directories, std::string& tpaList);
+
+/**
+ * @brief function pointer for file reader
+ */
+typedef std::function<void (const std::string&, const char*)> FileReader;
+
+/**
+ * @brief scan files in the given directory and run file reader function for that
+ * @param[in] directory
+ * @param[in] file reader function
+ * @param[in] scan depth
+ */
+void scanFilesInDir(const std::string& directory, FileReader reader, unsigned int depth);
+
+#endif /* __UTILS_H__ */