1/*
2 * Copyright (c) 2022-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_IDL_CODEEMITTER_H
17#define OHOS_IDL_CODEEMITTER_H
18
19#include "metadata/meta_component.h"
20#include "metadata/meta_interface.h"
21#include "util/light_refcount_base.h"
22#include "util/string.h"
23
24namespace OHOS {
25namespace Idl {
26class CodeEmitter : public LightRefCountBase {
27public:
28    CodeEmitter(MetaComponent* mc);
29
30    void SetDirectory(const String& directory)
31    {
32        directory_ = directory;
33    }
34
35    virtual void EmitInterface() = 0;
36
37    virtual void EmitInterfaceProxy() = 0;
38
39    virtual void EmitInterfaceStub() = 0;
40
41    void SetHitraceOn(const bool& hitraceOn)
42    {
43        hitraceOn_ = hitraceOn;
44    }
45
46    void SetLogOn(const bool& logOn)
47    {
48        logOn_ = logOn;
49    }
50
51    void SetHitraceTag(const String& setHitraceTag)
52    {
53        hitraceTag_ = setHitraceTag;
54    }
55
56    void SetLogTag(const String& logTag)
57    {
58        logTag_ = logTag;
59    }
60
61    void SetDomainId(const String& domainId)
62    {
63        domainId_ = domainId;
64    }
65
66protected:
67    static const char* TAB;
68
69    MetaComponent* metaComponent_;
70    MetaInterface* metaInterface_;
71    String directory_;
72    String interfaceName_;
73    String interfaceFullName_;
74    String proxyName_;
75    String proxyFullName_;
76    String stubName_;
77    String stubFullName_;
78    String deathRecipientName_;
79    String domainId_;
80    String logTag_;
81    String hitraceTag_;
82    bool hitraceOn_ = false;
83    bool logOn_ = false;
84    bool enteredVector_ = false;
85    bool readSequenceable_ = false;
86    bool createSequenceableForOut_ = false;
87};
88} // namespace Idl
89} // namespace OHOS
90#endif // OHOS_IDL_CODEEMITTER_H
91