• 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     /**
30      * @brief Defines the type of mms address.
31      */
32     using MmsAddressType = enum {
33         /**
34          * Indicates the type of mms address is unknown.
35          */
36         ADDRESS_TYPE_UNKNOWN = 0,
37         /**
38          * Indicates the type of mms address is PLMN.
39          */
40         ADDRESS_TYPE_PLMN = 1,
41         /**
42          * Indicates the type of mms address is IPV4.
43          */
44         ADDRESS_TYPE_IPV4 = 2,
45         /**
46          * Indicates the type of mms address is IPV6.
47          */
48         ADDRESS_TYPE_IPV6 = 3,
49         /**
50          * Indicates the type of mms address is EMAIL.
51          */
52         ADDRESS_TYPE_EMAIL = 4,
53     };
54 
55     /**
56      * @brief Get the Address String
57      * for example: +8610086/TYPE=PLMN
58      *
59      * @return returns the Mms Address String
60      */
61     std::string GetAddressString();
62 
63     /**
64      * @brief Get the Address Charset
65      * for example: MmsCharSets::UTF_8
66      *
67      * @return returns the Address Character {@link MmsCharSets}.
68      */
69     MmsCharSets GetAddressCharset();
70 
71     /**
72      * @brief Get the Address Type
73      * for example: MmsAddressType::ADDRESS_TYPE_PLMN
74      *
75      * @return returns the type of mms address {@link MmsAddressType}.
76      */
77     MmsAddressType GetAddressType();
78 
79     /**
80      * @brief Set the Mms Address String
81      * for example: +8610086/TYPE=PLMN
82      *
83      * @param addressString the Mms Address String, for example: +8610086/TYPE=PLMN
84      * @param charset the Address Character {@link MmsCharSets}.
85      */
86     void SetMmsAddressString(const std::string addressString, MmsCharSets charset = MmsCharSets::UTF_8);
87 
88     /**
89      * @brief Construct a new Mms Address
90      *
91      * @param addressString the Mms Address String, for example: +8610086/TYPE=PLMN
92      * @param charset the Address Character {@link MmsCharSets}.
93      */
94     MmsAddress(const std::string addressString, MmsCharSets charset = MmsCharSets::UTF_8);
95 
96     /**
97      * @brief Construct a new Mms Address
98      */
99     MmsAddress();
100 
101     /**
102      * @brief Destroy the Mms Address
103      */
104     ~MmsAddress();
105 private:
106     void CheckAddressType();
107 
108     std::string addressString_;
109     MmsCharSets charset_ = MmsCharSets::UTF_8;
110     MmsAddressType addressType_ = ADDRESS_TYPE_UNKNOWN;
111 };
112 } // namespace Telephony
113 } // namespace OHOS
114 #endif
115