1 /* 2 * Copyright (c) 2021 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 * http://www.apache.org/licenses/LICENSE-2.0 7 * Unless required by applicable law or agreed to in writing, software 8 * distributed under the License is distributed on an "AS IS" BASIS, 9 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 * See the License for the specific language governing permissions and 11 * limitations under the License. 12 */ 13 14 #ifndef PARSE_CONFIG_H 15 #define PARSE_CONFIG_H 16 #include <optional> 17 #include "stream_pipeline_data_structure.h" 18 namespace OHOS::Camera { 19 class ConfigParser { 20 public: 21 template<typename T> CheckIdExsit(const int32_t & mode,T && info,const int32_t & size)22 std::string CheckIdExsit(const int32_t& mode, T&& info, const int32_t& size) const 23 { 24 std::string result; 25 for (int i = 0; i < size; i++) { 26 if (info[i].id == mode) { 27 result = std::string(info[i].name); 28 break; 29 } 30 } 31 return result; 32 } 33 std::optional<int32_t> GetTypeId(const std::string& str, G_STREAM_INFO info, const int32_t& size) const; 34 std::string GetTypeStr(const int32_t& type, G_STREAM_INFO info, const int32_t& size) const; 35 }; 36 } 37 #endif 38