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