• 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_BODY_H
17 #define MMS_BODY_H
18 
19 #include "mms_body_part.h"
20 #include "mms_decode_buffer.h"
21 #include "mms_encode_buffer.h"
22 #include "mms_header.h"
23 
24 namespace OHOS {
25 namespace Telephony {
26 class MmsBody {
27 public:
28     MmsBody();
29     ~MmsBody() = default;
30     void DumpMmsBody();
31     bool DecodeMmsBody(MmsDecodeBuffer &decodeBuffer, MmsHeader &header);
32     bool DecodeMultipart(MmsDecodeBuffer &decodeBuffer);
33     bool EncodeMmsBody(MmsEncodeBuffer &encodeBuffer);
34     bool EncodeMmsHeaderContentType(MmsHeader &mmsHeader, MmsEncodeBuffer &encodeBuffer);
35 
36     uint32_t GetBodyPartCount();
37     bool IsBodyPartExist(MmsBodyPart &bodyPart);
38     bool AddMmsBodyPart(MmsBodyPart &bodyPart);
39     void GetMmsBodyPart(std::vector<MmsBodyPart> &parts);
40 
41 private:
42     bool IsContentLocationPartExist(std::string contentLocation);
43     bool IsContentIdPartExist(std::string contentId);
44 
45     bool bHaveSmilPart_ = false; // presentation body is exist
46     uint32_t bodyEntrys_;
47     std::string scPresentationBody_;
48     std::vector<MmsBodyPart> mmsBodyParts_;
49 };
50 } // namespace Telephony
51 } // namespace OHOS
52 #endif
53