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_ENCODE_BUFFER_H 17 #define MMS_ENCODE_BUFFER_H 18 19 #include <string> 20 21 #include "mms_buffer.h" 22 23 namespace OHOS { 24 namespace Telephony { 25 class MmsEncodeBuffer : public MmsBuffer { 26 public: 27 bool WriteByte(uint8_t byte); 28 bool WriteBuffer(MmsEncodeBuffer &buff); 29 bool WriteBuffer(std::unique_ptr<char[]> input, uint32_t length); 30 31 bool EncodeUintvar(uint32_t value); 32 bool EncodeShortLength(uint8_t value); 33 bool EncodeValueLength(uint32_t value); 34 35 bool EncodeOctet(uint8_t value); 36 bool EncodeShortInteger(uint8_t value); 37 bool EncodeInteger(uint32_t value); 38 bool EncodeLongInteger(uint64_t value); 39 bool EncodeText(std::string value); 40 bool EncodeQuotedText(std::string value); 41 bool EncodeTokenText(std::string value); 42 }; 43 } // namespace Telephony 44 } // namespace OHOS 45 #endif 46