1 /*
2  * Copyright (C) 2023 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 OHOS_VCARD_DECODER_V30_H
17 #define OHOS_VCARD_DECODER_V30_H
18 
19 #include "vcard_decoder_v21.h"
20 
21 namespace OHOS {
22 namespace Telephony {
23 class VCardDecoderV30 : public VCardDecoderV21 {
24 protected:
25     virtual bool ReadBegin();
26     virtual std::string GetLine();
27     virtual std::string PeekLine();
28     virtual std::string GetNonEmptyLine();
29     virtual void DealParams(const std::string &params, std::shared_ptr<VCardRawData> rawData, int32_t &errorCode);
30     virtual void DealAnyParam(const std::string &param, const std::string &paramValue,
31         std::shared_ptr<VCardRawData> rawData, int32_t &errorCode);
32     virtual void DealNoNameParam(
33         const std::string &paramValue, std::shared_ptr<VCardRawData> rawData, int32_t &errorCode);
34     virtual void DealTypeParam(
35         const std::string &paramValue, std::shared_ptr<VCardRawData> rawData, int32_t &errorCode);
36     virtual void DealAgent(std::shared_ptr<VCardRawData> rawData, int32_t &errorCode);
37     virtual std::string UnescapeText(const std::string &from);
38     virtual std::string UnescapeChar(char ch);
39     virtual std::string GetVersion();
40     virtual std::string GetBase64(const std::string &value, int32_t &errorCode);
41     virtual std::vector<std::string> GetSupportType();
42 
43 private:
44     void DealParamV30(const std::string &param, const std::string &paramValue, std::shared_ptr<VCardRawData> rawData,
45         int32_t &errorCode);
46     std::string EncodeParamValue(const std::string &paramValue);
47 
48 private:
49     std::string preLine_ = "";
50 };
51 } // namespace Telephony
52 } // namespace OHOS
53 #endif // OHOS_VCARD_DECODER_V30_H
54