• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef MMS_ADDRESS_H
17 #define MMS_ADDRESS_H
18 
19 #include <string>
20 
21 #include "mms_decode_buffer.h"
22 #include "mms_encode_buffer.h"
23 #include "mms_codec_type.h"
24 
25 namespace OHOS {
26 namespace Telephony {
27 class MmsAddress {
28 public:
29     using MmsAddressType = enum {
30         ADDRESS_TYPE_UNKNOWN = 0,
31         ADDRESS_TYPE_PLMN = 1,
32         ADDRESS_TYPE_IPV4 = 2,
33         ADDRESS_TYPE_IPV6 = 3,
34         ADDRESS_TYPE_EMAIL = 4,
35     };
36 
37     /**
38      * @brief Get the Address String
39      * for example: +8610086/TYPE=PLMN
40      * @brief Get the Address String
41      * @return std::string
42      */
43     std::string GetAddressString();
44 
45     /**
46      * @brief Get the Address Charset
47      * for example: MmsCharSets::UTF_8
48      * @return MmsCharSets
49      */
50     MmsCharSets GetAddressCharset();
51 
52     /**
53      * @brief Get the Address Type
54      * for example: MmsAddressType::ADDRESS_TYPE_PLMN
55      * @return MmsAddressType
56      */
57     MmsAddressType GetAddressType();
58 
59     /**
60      * @brief Set the Mms Address String
61      * for example: +8610086/TYPE=PLMN
62      * @param addressString
63      * @param charset
64      */
65     void SetMmsAddressString(const std::string addressString, MmsCharSets charset = MmsCharSets::UTF_8);
66 
67     /**
68      * @brief Construct a new Mms Address
69      *
70      * @param addressString for example: +8610086/TYPE=PLMN
71      * @param charset defualt UTF_8
72      */
73     MmsAddress(const std::string addressString, MmsCharSets charset = MmsCharSets::UTF_8);
74 
75     /**
76      * @brief Construct a new Mms Address
77      *
78      */
79     MmsAddress();
80 
81     /**
82      * @brief Destroy the Mms Address
83      *
84      */
85     ~MmsAddress();
86 private:
87     void CheckAddressType();
88 
89     std::string addressString_;
90     MmsCharSets charset_ = MmsCharSets::UTF_8;
91     MmsAddressType addressType_ = ADDRESS_TYPE_UNKNOWN;
92 };
93 } // namespace Telephony
94 } // namespace OHOS
95 #endif
96