• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef PRINT_UTILS_H
17 #define PRINT_UTILS_H
18 
19 #include <string>
20 
21 namespace OHOS::Print {
22 class PrintUtils {
23 public:
24     static std::string ToLower(const std::string &s);
25     static std::string GetExtensionId(const std::string &globalId);
26     static std::string GetGlobalId(const std::string& extensionId, const std::string& localId);
27     static std::string GetLocalId(const std::string& globalId, const std::string& extensionId);
28     static std::string EncodeExtensionCid(const std::string &extensionId, uint32_t callbackId);
29     static bool DecodeExtensionCid(const std::string &cid, std::string &extensionId, uint32_t &callbackId);
30     static std::string GetTaskEventId(const std::string &taskId, const std::string &type);
31     static int32_t OpenFile(const std::string &filePath);
32     static bool IsPathValid(const std::string &filePath);
33     static uint32_t GetIdFromFdPath(const std::string &fdPath);
34     static std::string GetJobStateChar(const uint32_t state);
35 };
36 }  // namespace OHOS::Print
37 #endif  // PRINT_UTILS_H
38