mirror of
https://github.com/openharmony/drivers_framework.git
synced 2026-08-27 20:49:55 -04:00
add hdi-gen function
Signed-off-by: wangyipeng <wangyipeng11@huawei.com>
This commit is contained in:
@@ -13,58 +13,6 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace HDI {
|
||||
bool JavaCodeEmitter::OutPut(const AutoPtr<AST>& ast, const String& targetDirectory)
|
||||
{
|
||||
if (!Reset(ast, targetDirectory)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
EmitCode();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool JavaCodeEmitter::Reset(const AutoPtr<AST>& ast, const String& targetDirectory)
|
||||
{
|
||||
if (ast == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (targetDirectory.Equals("")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CleanData();
|
||||
ast_ = ast;
|
||||
if (ast_->GetASTFileType() == ASTFileType::AST_IFACE || ast_->GetASTFileType() == ASTFileType::AST_ICALLBACK) {
|
||||
interface_ = ast_->GetInterfaceDef();
|
||||
interfaceName_ = interface_->GetName();
|
||||
interfaceFullName_ = interface_->GetNamespace()->ToString() + interfaceName_;
|
||||
infName_ = interfaceName_.StartsWith("I") ? interfaceName_.Substring(1) : interfaceName_;
|
||||
proxyName_ = infName_ + "Proxy";
|
||||
proxyFullName_ = interface_->GetNamespace()->ToString() + proxyName_;
|
||||
} else if (ast_->GetASTFileType() == ASTFileType::AST_TYPES) {
|
||||
infName_ = ast_->GetName();
|
||||
}
|
||||
|
||||
if (!ResolveDirectory(targetDirectory)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void JavaCodeEmitter::CleanData()
|
||||
{
|
||||
ast_ = nullptr;
|
||||
interface_ = nullptr;
|
||||
directory_ = "";
|
||||
interfaceName_ = "";
|
||||
interfaceFullName_ = "";
|
||||
infName_ = "";
|
||||
proxyName_ = "";
|
||||
proxyFullName_ = "";
|
||||
}
|
||||
|
||||
String JavaCodeEmitter::FileName(const String& name)
|
||||
{
|
||||
if (name.IsEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user