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 * 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 #ifndef _ABILITY_MANAGER_SERVICE_ST_OPERATOR_H_ 16 #define _ABILITY_MANAGER_SERVICE_ST_OPERATOR_H_ 17 18 #include <string> 19 #include <memory> 20 #include <vector> 21 22 namespace STtools { 23 using std::string; 24 class StOperator; 25 std::vector<string> SerializationStOperatorToVector(StOperator &ParentOperator); 26 void DeserializationStOperatorFromVector(StOperator &ParentOperator, std::vector<string> &vectorOperator); 27 class StOperator { 28 private: 29 std::vector<std::shared_ptr<StOperator>> g_childOperator; 30 std::shared_ptr<StOperator> g_parentOperator; 31 string g_abilityType; 32 string g_bundleName; 33 string g_abilityName; 34 string g_operatorName; // data ability 35 string g_message; 36 /* data */ 37 static int countChild; 38 39 public: 40 StOperator(); 41 StOperator(const string &type, const string &bundle, const string &ability, const string &operatorName = "", 42 const string &message = ""); 43 ~StOperator(); 44 static int GetCountChild(); 45 string GetAbilityType(); 46 StOperator &SetAbilityType(const string &type); 47 string GetBundleName(); 48 StOperator &SetBundleName(const string &bundleName); 49 string GetAbilityName(); 50 StOperator &SetAbilityName(const string &abilityName); 51 string GetOperatorName(); 52 StOperator &SetOperatorName(const string &operatorName); 53 string GetMessage(); 54 StOperator &SetMessage(const string &message); 55 StOperator &AddChildOperator(std::shared_ptr<StOperator> childOperator); 56 std::vector<std::shared_ptr<StOperator>> GetChildOperator(); 57 std::vector<std::shared_ptr<StOperator>> PopChildOperator(); 58 }; 59 } // namespace STtools 60 #endif // _ABILITY_MANAGER_SERVICE_ST_OPERATOR_H_ 61 62