• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 AUDIO_PARAM_PARSER_H
17 #define AUDIO_PARAM_PARSER_H
18 
19 #include <list>
20 #include <unordered_map>
21 #include <string>
22 #include <regex>
23 #include <set>
24 #include <audio_xml_parser.h>
25 
26 namespace OHOS {
27 namespace AudioStandard {
28 #ifdef USE_CONFIG_POLICY
29 static constexpr char CONFIG_FILE[] = "etc/audio/audio_param_config.xml";
30 #endif
31 
32 class AudioParamParser {
33 public:
34     AudioParamParser();
35     ~AudioParamParser();
36 
37     bool LoadConfiguration(
38         std::unordered_map<std::string, std::unordered_map<std::string, std::set<std::string>>> &audioParameterKeys);
39 
40 private:
41     bool ParseInternal(std::shared_ptr<AudioXmlNode> curNode,
42         std::unordered_map<std::string, std::unordered_map<std::string, std::set<std::string>>> &audioParameterKeys);
43     void ParseMainKeys(std::shared_ptr<AudioXmlNode> curNode,
44         std::unordered_map<std::string, std::unordered_map<std::string, std::set<std::string>>> &audioParameterKeys);
45     void ParseMainKey(std::shared_ptr<AudioXmlNode> curNode,
46         std::unordered_map<std::string, std::unordered_map<std::string, std::set<std::string>>> &audioParameterKeys);
47     void ParseSubKeys(std::shared_ptr<AudioXmlNode> curNode, std::string &className,
48         std::unordered_map<std::string, std::unordered_map<std::string, std::set<std::string>>> &audioParameterKeys);
49 };
50 }  // namespace AudioStandard
51 }  // namespace OHOS
52 
53 #endif // AUDIO_PARAM_PARSER_H
54