Add License file and comments to sources
[platform/core/dotnet/launcher.git] / NativeLauncher / inc / utils.h
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __UTILS_H__
18 #define __UTILS_H__
19
20 #include <string>
21 #include <vector>
22 #include <functional>
23
24 #ifndef PATH_SEPARATOR
25 #define PATH_SEPARATOR '/'
26 #endif
27
28 bool ICompare(const std::string& a, const std::string& b);
29 bool ICompare(const std::string& a, int a_offset, const std::string& b, int b_offset, int length);
30 bool IsManagedAssembly(const std::string& filename);
31 bool IsNativeImage(const std::string& filename);
32 std::string ReadSelfPath ();
33 std::string ConcatPath (const std::string& path1, const std::string& path2);
34 void AppendPath (std::string& path1, const std::string& path2);
35 std::string AbsolutePath (const std::string& path);
36 std::string Basename (const std::string& path);
37 bool EndWithIgnoreCase (const std::string& str1, const std::string& str2, std::string& filename);
38 void AssembliesInDirectory(const std::vector<std::string>& directories, std::string& tpaList);
39 bool FileNotExist(const std::string& path);
40 std::string JoinStrings(const std::vector<std::string>& strings, const char* const delimeter);
41
42 typedef std::function<void (const char*)> FileReader;
43 void ScanFilesInDir(const char* directory, FileReader reader, unsigned int depth);
44
45 #endif  // __UTILS_H__