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 31 private: HiAppEventConfig()32 HiAppEventConfig() {} ~HiAppEventConfig()33 ~HiAppEventConfig() {} 34 HiAppEventConfig(const HiAppEventConfig&); 35 HiAppEventConfig& operator=(const HiAppEventConfig&); 36 bool SetDisableItem(const std::string& value); 37 bool SetMaxStorageSizeItem(const std::string& value); 38 void SetDisable(bool disable); 39 void SetMaxStorageSize(uint64_t size); 40 41 private: 42 bool disable = false; 43 uint64_t maxStorageSize = 10 * 1024 * 1024; // max storage size is 10M, 10 * 1024 * 1024 Byte 44 std::string storageDir = ""; 45 }; 46 } // namespace HiviewDFX 47 } // namespace OHOS 48 #endif // HI_APP_EVENT_CONFIG_H 49