1 /* 2 * Copyright (c) 2021-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 #ifndef HI_APP_EVENT_CONFIG_H 16 #define HI_APP_EVENT_CONFIG_H 17 18 #include <string> 19 20 namespace OHOS { 21 namespace HiviewDFX { 22 class HiAppEventConfig { 23 public: 24 static HiAppEventConfig& GetInstance(); 25 void SetStorageDir(const std::string& dir); 26 bool SetConfigurationItem(std::string name, std::string value); 27 bool GetDisable(); 28 uint64_t GetMaxStorageSize(); 29 std::string GetStorageDir(); 30 std::string GetRunningId(); 31 32 private: HiAppEventConfig()33 HiAppEventConfig() {} ~HiAppEventConfig()34 ~HiAppEventConfig() {} 35 HiAppEventConfig(const HiAppEventConfig&); 36 HiAppEventConfig& operator=(const HiAppEventConfig&); 37 bool SetDisableItem(const std::string& value); 38 bool SetMaxStorageSizeItem(const std::string& value); 39 void SetDisable(bool disable); 40 void SetMaxStorageSize(uint64_t size); 41 42 private: 43 bool disable = false; 44 uint64_t maxStorageSize = 10 * 1024 * 1024; // max storage size is 10M, 10 * 1024 * 1024 Byte 45 std::string storageDir = ""; 46 std::string runningId = ""; 47 }; 48 } // namespace HiviewDFX 49 } // namespace OHOS 50 #endif // HI_APP_EVENT_CONFIG_H 51