| 1 | /* |
| 2 | * Copyright (c) 2021-2022, Intel Corporation |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice shall be included |
| 12 | * in all copies or substantial portions of the Software. |
| 13 | * |
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 20 | * OTHER DEALINGS IN THE SOFTWARE. |
| 21 | */ |
| 22 | //! |
| 23 | //! \file media_user_setting_definition.cpp |
| 24 | //! \brief User setting definition |
| 25 | //! |
| 26 | |
| 27 | #include "media_user_setting_definition.h" |
| 28 | |
| 29 | namespace MediaUserSetting { |
| 30 | namespace Internal { |
| 31 | |
| 32 | Definition::Definition(const std::string &itemName, |
| 33 | const Value &defaultValue, |
| 34 | bool isReportKey, |
| 35 | bool debugOnly, |
| 36 | bool useCustomPath, |
| 37 | const std::string &subPath, |
| 38 | UFKEY_NEXT rootKey, |
| 39 | bool statePath): |
| 40 | m_itemName(itemName), |
| 41 | m_itemEnvName(itemName), |
| 42 | m_defaultValue(defaultValue), |
| 43 | m_isReportKey(isReportKey), |
| 44 | m_debugOnly(debugOnly), |
| 45 | m_useCustomePath(useCustomPath), |
| 46 | m_subPath(subPath), |
| 47 | m_rootKey(rootKey), |
| 48 | m_statePath(statePath) |
| 49 | { |
| 50 | std::replace(m_itemEnvName.begin(), m_itemEnvName.end(), ' ', '_'); |
| 51 | } |
| 52 | |
| 53 | Definition::Definition(const Definition& def) |
| 54 | { |
| 55 | SetData(def); |
| 56 | } |
| 57 | |
| 58 | Definition::~Definition() |
| 59 | { |
| 60 | } |
| 61 | |
| 62 | inline Definition& Definition::operator=(const Definition& def) |
| 63 | { |
| 64 | if (this != &def) |
| 65 | { |
| 66 | SetData(def); |
| 67 | } |
| 68 | |
| 69 | return *this; |
| 70 | } |
| 71 | |
| 72 | inline void Definition::SetData(const Definition& def) |
| 73 | { |
| 74 | m_itemName = def.m_itemName; |
| 75 | m_debugOnly = def.m_debugOnly; |
| 76 | m_defaultValue = def.m_defaultValue; |
| 77 | m_isReportKey = def.m_isReportKey; |
| 78 | m_subPath = def.m_subPath; |
| 79 | m_useCustomePath = def.m_useCustomePath; |
| 80 | m_rootKey = def.m_rootKey; |
| 81 | m_statePath = def.m_statePath; |
| 82 | } |
| 83 | |
| 84 | }} |