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 16 #include "mms_address.h" 17 18 #include "iosfwd" 19 #include "mms_codec_type.h" 20 #include "string" 21 22 namespace OHOS { 23 namespace Telephony { MmsAddress(const std::string addressString,MmsCharSets charset)24 MmsAddress::MmsAddress(const std::string addressString, MmsCharSets charset) 25 : addressString_(addressString), charset_(charset) 26 { 27 CheckAddressType(); 28 } 29 MmsAddress()30 MmsAddress::MmsAddress() {} 31 ~MmsAddress()32 MmsAddress::~MmsAddress() {} 33 SetMmsAddressString(const std::string addressString,MmsCharSets charset)34 void MmsAddress::SetMmsAddressString(const std::string addressString, MmsCharSets charset) 35 { 36 addressString_ = addressString; 37 charset_ = charset; 38 CheckAddressType(); 39 } 40 GetAddressString()41 std::string MmsAddress::GetAddressString() 42 { 43 return addressString_; 44 } 45 GetAddressCharset()46 MmsCharSets MmsAddress::GetAddressCharset() 47 { 48 return charset_; 49 } 50 GetAddressType()51 MmsAddress::MmsAddressType MmsAddress::GetAddressType() 52 { 53 return addressType_; 54 } 55 CheckAddressType()56 void MmsAddress::CheckAddressType() 57 { 58 if (addressString_.find("PLMN")) { 59 addressType_ = ADDRESS_TYPE_PLMN; 60 } else if (addressString_.find("IPv4")) { 61 addressType_ = ADDRESS_TYPE_PLMN; 62 } else if (addressString_.find("IPv6")) { 63 addressType_ = ADDRESS_TYPE_PLMN; 64 } else if (addressString_.find("EMAIL")) { 65 addressType_ = ADDRESS_TYPE_PLMN; 66 } else { 67 addressType_ = ADDRESS_TYPE_UNKNOWN; 68 } 69 } 70 } // namespace Telephony 71 } // namespace OHOS 72