Modify tizen coding style
[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 #include <map>
24
25 #ifndef PATH_SEPARATOR
26 #define PATH_SEPARATOR '/'
27 #endif
28
29 bool iCompare(const std::string& a, const std::string& b);
30 bool iCompare(const std::string& a, int aOffset, const std::string& b, int bOffset, int length);
31 bool isManagedAssembly(const std::string& fileName);
32 bool isNativeImage(const std::string& fileName);
33 std::string readSelfPath();
34 std::string concatPath(const std::string& path1, const std::string& path2);
35 void appendPath(std::string& path1, const std::string& path2);
36 std::string absolutePath(const std::string& path);
37 std::string baseName(const std::string& path);
38 bool endWithIgnoreCase(const std::string& str1, const std::string& str2, std::string& fileName);
39 void assembliesInDirectory(const std::vector<std::string>& directories, std::string& tpaList);
40
41 bool fileNotExist(const std::string& path);
42 std::string joinStrings(const std::vector<std::string>& strings, const char* const delimeter);
43
44 typedef std::function<void (const char*, const char*)> FileReader;
45 void scanFilesInDir(const char* directory, FileReader reader, unsigned int depth);
46 #endif /* __UTILS_H__ */