1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4// ============================================================
5//
6// Utils.hpp
7//
8
9
10//
11// Declares a bunch of binder auxilary functions
12//
13// ============================================================
14
15#ifndef __BINDER_UTILS_HPP__
16#define __BINDER_UTILS_HPP__
17
18#include "bindertypes.hpp"
19
20extern LocaleID g_lcid;
21
22namespace BINDER_SPACE
23{
24 inline BOOL EqualsCaseInsensitive(SString &a, SString &b)
25 {
26 return a.EqualsCaseInsensitive(b, g_lcid);
27 }
28
29 inline ULONG HashCaseInsensitive(SString &string)
30 {
31 return string.HashCaseInsensitive(g_lcid);
32 }
33
34 HRESULT FileOrDirectoryExists(PathString &path);
35 HRESULT FileOrDirectoryExistsLog(PathString &path);
36
37 void MutateUrlToPath(SString &urlOrPath);
38 void MutatePathToUrl(SString &pathOrUrl);
39
40 // Mutates path
41 void PlatformPath(SString &path);
42 void CanonicalizePath(SString &path, BOOL fAppendPathSeparator = FALSE);
43
44 // It is safe to use either A or B as CombinedPath.
45 void CombinePath(SString &pathA,
46 SString &pathB,
47 SString &combinedPath);
48
49 HRESULT GetTokenFromPublicKey(SBuffer &publicKeyBLOB,
50 SBuffer &publicKeyTokenBLOB);
51
52 BOOL IsFileNotFound(HRESULT hr);
53};
54
55#endif
56