diff --git a/framework/tools/hdi-gen/.vscode/launch.json b/framework/tools/hdi-gen/.vscode/launch.json new file mode 100644 index 0000000000000000000000000000000000000000..774b24393e9395d52ff15f946477b8d18d010457 --- /dev/null +++ b/framework/tools/hdi-gen/.vscode/launch.json @@ -0,0 +1,24 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "C/C++ Runner: Debug Session", + "type": "cppdbg", + "request": "launch", + "args": [], + "stopAtEntry": false, + "externalConsole": true, + "cwd": "z:/ohos_master/drivers/hdf_core/framework/tools/hdi-gen", + "program": "z:/ohos_master/drivers/hdf_core/framework/tools/hdi-gen/build/Debug/outDebug", + "MIMode": "gdb", + "miDebuggerPath": "C:/mingw-w64-gdb-12.2-stable-r38/bin/gcc.exe", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/framework/tools/hdi-gen/.vscode/settings.json b/framework/tools/hdi-gen/.vscode/settings.json new file mode 100644 index 0000000000000000000000000000000000000000..e0102458bceac3abefbdb3a5d7c256d1ae6f16fb --- /dev/null +++ b/framework/tools/hdi-gen/.vscode/settings.json @@ -0,0 +1,116 @@ +{ + "C_Cpp_Runner.cCompilerPath": "C:/mingw-w64-gcc-12.2-stable-r38/bin/gcc.exe", + "C_Cpp_Runner.cppCompilerPath": "C:/mingw-w64-g++-12.2-stable-r38/bin/gcc.exe", + "C_Cpp_Runner.debuggerPath": "C:/mingw-w64-gdb-12.2-stable-r38/bin/gcc.exe", + "C_Cpp_Runner.cStandard": "c17", + "C_Cpp_Runner.cppStandard": "gnu++17", + "C_Cpp_Runner.msvcBatchPath": "", + "C_Cpp_Runner.useMsvc": false, + "C_Cpp_Runner.warnings": [ + "-Wall", + "-Wextra", + "-Wpedantic", + "-Wshadow", + "-Wformat=2", + "-Wcast-align", + "-Wconversion", + "-Wsign-conversion", + "-Wnull-dereference" + ], + "C_Cpp_Runner.msvcWarnings": [ + "/W4", + "/permissive-", + "/w14242", + "/w14287", + "/w14296", + "/w14311", + "/w14826", + "/w44062", + "/w44242", + "/w14905", + "/w14906", + "/w14263", + "/w44265", + "/w14928" + ], + "C_Cpp_Runner.enableWarnings": true, + "C_Cpp_Runner.warningsAsError": false, + "C_Cpp_Runner.compilerArgs": [], + "C_Cpp_Runner.linkerArgs": [], + "C_Cpp_Runner.includePaths": [ + "${workspaceFolder}/**" + ], + "C_Cpp_Runner.includeSearch": [ + "*", + "**/*" + ], + "C_Cpp_Runner.excludeSearch": [ + "**/build", + "**/build/**", + "**/.*", + "**/.*/**", + "**/.vscode", + "**/.vscode/**" + ], + "C_Cpp_Runner.useAddressSanitizer": false, + "C_Cpp_Runner.useUndefinedSanitizer": false, + "C_Cpp_Runner.useLeakSanitizer": false, + "C_Cpp_Runner.showCompilationTime": false, + "C_Cpp_Runner.useLinkTimeOptimization": false, + "files.associations": { + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "*.tcc": "cpp", + "bitset": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "compare": "cpp", + "concepts": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "map": "cpp", + "set": "cpp", + "string": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "random": "cpp", + "regex": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "fstream": "cpp", + "initializer_list": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "new": "cpp", + "numbers": "cpp", + "ostream": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "typeinfo": "cpp" + }, + "C_Cpp_Runner.msvcSecureNoWarnings": false +} \ No newline at end of file diff --git a/framework/tools/hdi-gen/ast/ast.cpp b/framework/tools/hdi-gen/ast/ast.cpp index d83a2d6bc4bea61e87a91ef1c67960d2abc557ca..679297ca9656f1a219f15cab68820e67529c1c5e 100644 --- a/framework/tools/hdi-gen/ast/ast.cpp +++ b/framework/tools/hdi-gen/ast/ast.cpp @@ -11,6 +11,7 @@ #include #include "util/string_builder.h" +#include "util/string_helper.h" namespace OHOS { namespace HDI { @@ -174,7 +175,13 @@ AutoPtr AST::FindType(const std::string &typeName, bool lookImports) AutoPtr type = nullptr; for (const auto &importPair : imports_) { - type = importPair.second->FindType(typeName, false); + if (StringHelper::GetVersionName(typeName) != StringHelper::STRING_HELPER_NULL_STRING) { + if (StringHelper::IsCorrectVersion(typeName, importPair.first)) { + type = importPair.second->FindType(StringHelper::GetRealTypeName(typeName), false); + } + } else { + type = importPair.second->FindType(typeName, false); + } if (type != nullptr) { break; } diff --git a/framework/tools/hdi-gen/ast/ast_array_type.cpp b/framework/tools/hdi-gen/ast/ast_array_type.cpp index 9d590e7dd24ded8a6000f2740c59fb217162e96b..063384f66d8a89881734dde19b50b4d868fe98d7 100644 --- a/framework/tools/hdi-gen/ast/ast_array_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_array_type.cpp @@ -58,7 +58,7 @@ std::string ASTArrayType::EmitCType(TypeMode mode) const } } -std::string ASTArrayType::EmitCppType(TypeMode mode) const +std::string ASTArrayType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_array_type.h b/framework/tools/hdi-gen/ast/ast_array_type.h index d6f157a955789e6d006bb0fbfc7f46377f695ab7..1dbfa7619d746457f81ca25d242c122eaba71d34 100644 --- a/framework/tools/hdi-gen/ast/ast_array_type.h +++ b/framework/tools/hdi-gen/ast/ast_array_type.h @@ -38,7 +38,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/ast/ast_attribute.h b/framework/tools/hdi-gen/ast/ast_attribute.h index 7a438580aa95594b991cf5a5b08b81d156f7da37..bc272ab3a8a14caf498030bc8c3f687cb8c55fc8 100644 --- a/framework/tools/hdi-gen/ast/ast_attribute.h +++ b/framework/tools/hdi-gen/ast/ast_attribute.h @@ -34,11 +34,6 @@ public: value_ |= value; } - inline Attribute GetValue() const - { - return value_; - } - bool HasValue(Attribute attr) const { return (value_ & attr) != 0; diff --git a/framework/tools/hdi-gen/ast/ast_boolean_type.cpp b/framework/tools/hdi-gen/ast/ast_boolean_type.cpp index a9787588bbba1a1a6cc3fbf2e809c33cc2ab693f..99c068ac2aeef00c8b59676ccaabda732d8dc984 100644 --- a/framework/tools/hdi-gen/ast/ast_boolean_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_boolean_type.cpp @@ -41,7 +41,7 @@ std::string ASTBooleanType::EmitCType(TypeMode mode) const } } -std::string ASTBooleanType::EmitCppType(TypeMode mode) const +std::string ASTBooleanType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_boolean_type.h b/framework/tools/hdi-gen/ast/ast_boolean_type.h index 4955083ea2e0e64842231691e59e0a35160e1c8e..7d9ccf49c45cfd26bf6b47fa0f203a62f2d23c70 100644 --- a/framework/tools/hdi-gen/ast/ast_boolean_type.h +++ b/framework/tools/hdi-gen/ast/ast_boolean_type.h @@ -25,7 +25,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/ast/ast_byte_type.cpp b/framework/tools/hdi-gen/ast/ast_byte_type.cpp index f5ce347bc7012e3c549d2cfdae61f40400409c02..6ad15da590514eb329a850bab2180ba04d61faab 100644 --- a/framework/tools/hdi-gen/ast/ast_byte_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_byte_type.cpp @@ -41,7 +41,7 @@ std::string ASTByteType::EmitCType(TypeMode mode) const } } -std::string ASTByteType::EmitCppType(TypeMode mode) const +std::string ASTByteType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_byte_type.h b/framework/tools/hdi-gen/ast/ast_byte_type.h index a8bc5f6d54e5e4bfa376707bf61085c326a2f5f5..9998c5a4f6cba704ee3f6d63b0324bf0841b7fe6 100644 --- a/framework/tools/hdi-gen/ast/ast_byte_type.h +++ b/framework/tools/hdi-gen/ast/ast_byte_type.h @@ -25,7 +25,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/ast/ast_double_type.cpp b/framework/tools/hdi-gen/ast/ast_double_type.cpp index 45126258eaf2ea8c5af3d707444962bcc9930c7b..247ddace3f36a1db10b2c72efab32a3d7ad98130 100644 --- a/framework/tools/hdi-gen/ast/ast_double_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_double_type.cpp @@ -41,7 +41,7 @@ std::string ASTDoubleType::EmitCType(TypeMode mode) const } } -std::string ASTDoubleType::EmitCppType(TypeMode mode) const +std::string ASTDoubleType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_double_type.h b/framework/tools/hdi-gen/ast/ast_double_type.h index 62218e9a6dc0f577292f1e75ba67f8e68d90859e..da321a113908bfcedc9da0650dc4430d2fa5b998 100644 --- a/framework/tools/hdi-gen/ast/ast_double_type.h +++ b/framework/tools/hdi-gen/ast/ast_double_type.h @@ -25,7 +25,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/ast/ast_enum_type.cpp b/framework/tools/hdi-gen/ast/ast_enum_type.cpp index a9051a780982bcb6aea1cb5fef80ba3930f8771d..53d0ac96bc7d1471ebed947ce02c600985587bf0 100644 --- a/framework/tools/hdi-gen/ast/ast_enum_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_enum_type.cpp @@ -76,7 +76,7 @@ std::string ASTEnumType::EmitCType(TypeMode mode) const } } -std::string ASTEnumType::EmitCppType(TypeMode mode) const +std::string ASTEnumType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_enum_type.h b/framework/tools/hdi-gen/ast/ast_enum_type.h index 15aefe27a70b1518f9c7d977764292eafbccc1e7..9882a6cc165fd3ca4147d9770883e04017e4f95a 100644 --- a/framework/tools/hdi-gen/ast/ast_enum_type.h +++ b/framework/tools/hdi-gen/ast/ast_enum_type.h @@ -116,7 +116,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/ast/ast_fd_type.cpp b/framework/tools/hdi-gen/ast/ast_fd_type.cpp index a376afc2104774c8fb631101baf8e69b73787cbd..1e9698633d8ac30cb6637e9ef8d21607b893f5e6 100644 --- a/framework/tools/hdi-gen/ast/ast_fd_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_fd_type.cpp @@ -41,7 +41,7 @@ std::string ASTFdType::EmitCType(TypeMode mode) const } } -std::string ASTFdType::EmitCppType(TypeMode mode) const +std::string ASTFdType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_fd_type.h b/framework/tools/hdi-gen/ast/ast_fd_type.h index f9d773248a587191537e0f8298cde398c3914986..a49faea0b2caa700b1e07e3a83590dbf7417bb52 100644 --- a/framework/tools/hdi-gen/ast/ast_fd_type.h +++ b/framework/tools/hdi-gen/ast/ast_fd_type.h @@ -25,7 +25,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/ast/ast_float_type.cpp b/framework/tools/hdi-gen/ast/ast_float_type.cpp index 9316f228c01648fd3c91b7a55b5309f52772fae3..0386a264f2914f11d977266c962abc953dfd08dc 100644 --- a/framework/tools/hdi-gen/ast/ast_float_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_float_type.cpp @@ -41,7 +41,7 @@ std::string ASTFloatType::EmitCType(TypeMode mode) const } } -std::string ASTFloatType::EmitCppType(TypeMode mode) const +std::string ASTFloatType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_float_type.h b/framework/tools/hdi-gen/ast/ast_float_type.h index a0eedb8b318d8513f6487ba67a2828a18f8306fd..214d8caba298cbdd3dd46b1c6bdcc750037ebd4c 100644 --- a/framework/tools/hdi-gen/ast/ast_float_type.h +++ b/framework/tools/hdi-gen/ast/ast_float_type.h @@ -25,7 +25,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/ast/ast_integer_type.cpp b/framework/tools/hdi-gen/ast/ast_integer_type.cpp index 21977f9725038b8a109282aa5dc5e7dbd71d8082..0d239acf59d356d227a661763e7f973eb8722839 100644 --- a/framework/tools/hdi-gen/ast/ast_integer_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_integer_type.cpp @@ -41,7 +41,7 @@ std::string ASTIntegerType::EmitCType(TypeMode mode) const } } -std::string ASTIntegerType::EmitCppType(TypeMode mode) const +std::string ASTIntegerType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_integer_type.h b/framework/tools/hdi-gen/ast/ast_integer_type.h index aee9b5ead964e8af995733cf02a589a75c9defab..fec5c658aec84d02ff3e4fc9e6ad27d25ebcd8d4 100644 --- a/framework/tools/hdi-gen/ast/ast_integer_type.h +++ b/framework/tools/hdi-gen/ast/ast_integer_type.h @@ -25,7 +25,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/ast/ast_interface_type.cpp b/framework/tools/hdi-gen/ast/ast_interface_type.cpp index 8aa6eb710719e7fc7ada40128047696b211cdfaf..a7fbe090643f4b13d03a929e783ce1cbade80f8a 100644 --- a/framework/tools/hdi-gen/ast/ast_interface_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_interface_type.cpp @@ -117,7 +117,7 @@ std::string ASTInterfaceType::EmitCType(TypeMode mode) const } } -std::string ASTInterfaceType::EmitCppType(TypeMode mode) const +std::string ASTInterfaceType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { std::string pointerName = "sptr"; if (Options::GetInstance().GetSystemLevel() == SystemLevel::LITE) { diff --git a/framework/tools/hdi-gen/ast/ast_interface_type.h b/framework/tools/hdi-gen/ast/ast_interface_type.h index 6d1868418f038fa697b41695350db155fd1c60a8..cb699ec0513f14d65314e240381a8be24d90c256 100644 --- a/framework/tools/hdi-gen/ast/ast_interface_type.h +++ b/framework/tools/hdi-gen/ast/ast_interface_type.h @@ -148,7 +148,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/ast/ast_long_type.cpp b/framework/tools/hdi-gen/ast/ast_long_type.cpp index fdbe692e725c1a8bf7858ee9eb06613ae6d04ede..691aa60b63fb81f90b9ab967575445c9824defad 100644 --- a/framework/tools/hdi-gen/ast/ast_long_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_long_type.cpp @@ -41,7 +41,7 @@ std::string ASTLongType::EmitCType(TypeMode mode) const } } -std::string ASTLongType::EmitCppType(TypeMode mode) const +std::string ASTLongType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_long_type.h b/framework/tools/hdi-gen/ast/ast_long_type.h index 7e8e8d3a47d608eb6a2e4cb2bf4a2cee1133178c..680e16eb1aabf1c21ab644a565313ab2628ae99a 100644 --- a/framework/tools/hdi-gen/ast/ast_long_type.h +++ b/framework/tools/hdi-gen/ast/ast_long_type.h @@ -25,7 +25,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/ast/ast_map_type.cpp b/framework/tools/hdi-gen/ast/ast_map_type.cpp index cd653e3b5d2d2dab87f4171d268894b131526f19..6e612e3867d2be3dc70fe0e1dd1661df01dbebf5 100644 --- a/framework/tools/hdi-gen/ast/ast_map_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_map_type.cpp @@ -56,7 +56,7 @@ std::string ASTMapType::EmitCType(TypeMode mode) const return "/"; } -std::string ASTMapType::EmitCppType(TypeMode mode) const +std::string ASTMapType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_map_type.h b/framework/tools/hdi-gen/ast/ast_map_type.h index b1183b9bc802734343042ff80a97eddc81308e60..899bbff84fe27e21347b1ae22c50491dc27ffedb 100644 --- a/framework/tools/hdi-gen/ast/ast_map_type.h +++ b/framework/tools/hdi-gen/ast/ast_map_type.h @@ -48,7 +48,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/ast/ast_method.h b/framework/tools/hdi-gen/ast/ast_method.h index 89e44ce4a5e17de743dbdfb6c3b62be300421369..2eeaa5b92d9a285e52df4c1d4ad9c604d33ed2b7 100644 --- a/framework/tools/hdi-gen/ast/ast_method.h +++ b/framework/tools/hdi-gen/ast/ast_method.h @@ -29,10 +29,10 @@ public: return name_; } - inline void SetAttribute(AutoPtr attr) + inline void SetAttribute(const AutoPtr &attr) { - if (attr_ != nullptr && attr != nullptr) { - attr_->SetValue(attr->GetValue()); + if (attr != nullptr) { + attr_ = attr; } } diff --git a/framework/tools/hdi-gen/ast/ast_native_buffer_type.cpp b/framework/tools/hdi-gen/ast/ast_native_buffer_type.cpp index 3764c77823f5bac9a2c531f8db105b6f915177d8..42b0f38e8dfec9fbc1d7661b27836c7951b1b1c4 100644 --- a/framework/tools/hdi-gen/ast/ast_native_buffer_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_native_buffer_type.cpp @@ -41,7 +41,7 @@ std::string ASTNativeBufferType::EmitCType(TypeMode mode) const } } -std::string ASTNativeBufferType::EmitCppType(TypeMode mode) const +std::string ASTNativeBufferType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_native_buffer_type.h b/framework/tools/hdi-gen/ast/ast_native_buffer_type.h index 4a2dffbfc996d0d6e8ed4486cca7f02b12c2555a..a1883902bedd88c5450a933962fb882e2167e3bf 100644 --- a/framework/tools/hdi-gen/ast/ast_native_buffer_type.h +++ b/framework/tools/hdi-gen/ast/ast_native_buffer_type.h @@ -25,7 +25,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; void EmitCWriteVar(const std::string &parcelName, const std::string &name, const std::string &ecName, const std::string &gotoLabel, StringBuilder &sb, const std::string &prefix) const override; diff --git a/framework/tools/hdi-gen/ast/ast_parameter.cpp b/framework/tools/hdi-gen/ast/ast_parameter.cpp index d337ba6a6803fa01ce7f99ea21ce594e1947f5bb..5416e61c4c4856dce3a1c1d8c8d985186ab5c44b 100644 --- a/framework/tools/hdi-gen/ast/ast_parameter.cpp +++ b/framework/tools/hdi-gen/ast/ast_parameter.cpp @@ -87,9 +87,9 @@ std::string ASTParameter::EmitCParameter() std::string ASTParameter::EmitCppParameter() { if (attr_->value_ == ParamAttr::PARAM_IN) { - return StringHelper::Format("%s %s", type_->EmitCppType(TypeMode::PARAM_IN).c_str(), name_.c_str()); + return StringHelper::Format("%s %s", type_->EmitCppType(TypeMode::PARAM_IN, isIdentifiedVersion_).c_str(), name_.c_str()); } else { - return StringHelper::Format("%s %s", type_->EmitCppType(TypeMode::PARAM_OUT).c_str(), name_.c_str()); + return StringHelper::Format("%s %s", type_->EmitCppType(TypeMode::PARAM_OUT, isIdentifiedVersion_).c_str(), name_.c_str()); } } diff --git a/framework/tools/hdi-gen/ast/ast_parameter.h b/framework/tools/hdi-gen/ast/ast_parameter.h index 11d0f87bc66a72f2410077f91fd9fdf4c5bb5ff9..6f66501e0994479f5aabd01ed64423abf4486130 100644 --- a/framework/tools/hdi-gen/ast/ast_parameter.h +++ b/framework/tools/hdi-gen/ast/ast_parameter.h @@ -28,6 +28,12 @@ public: { } + ASTParameter(const std::string &name, const AutoPtr &attribute, const AutoPtr &type, + const bool &isIdentifiedVersion) + : ASTNode(), name_(name), attr_(attribute), type_(type), isIdentifiedVersion_(isIdentifiedVersion) + { + } + inline std::string GetName() { return name_; @@ -75,6 +81,7 @@ private: std::string name_; AutoPtr attr_; AutoPtr type_; + bool isIdentifiedVersion_; }; } // namespace HDI } // namespace OHOS diff --git a/framework/tools/hdi-gen/ast/ast_pointer_type.cpp b/framework/tools/hdi-gen/ast/ast_pointer_type.cpp index 13876fe56cd5feb47aa885947dcfcec6d6a2b102..208a69d46a0dbb22ae795bc8c555226f1df94477 100644 --- a/framework/tools/hdi-gen/ast/ast_pointer_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_pointer_type.cpp @@ -41,7 +41,7 @@ std::string ASTPointerType::EmitCType(TypeMode mode) const } } -std::string ASTPointerType::EmitCppType(TypeMode mode) const +std::string ASTPointerType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_pointer_type.h b/framework/tools/hdi-gen/ast/ast_pointer_type.h index db4a6fc7d1fbafe4f0c011c3baead4029eb4c365..8df7be42fac552eb5032219ab57a32db405eb494 100644 --- a/framework/tools/hdi-gen/ast/ast_pointer_type.h +++ b/framework/tools/hdi-gen/ast/ast_pointer_type.h @@ -25,7 +25,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; // the 'Pointer' type only support use in 'passthrough' mode }; diff --git a/framework/tools/hdi-gen/ast/ast_sequenceable_type.cpp b/framework/tools/hdi-gen/ast/ast_sequenceable_type.cpp index cf6894ba4c76f8b0d8b70fa2eb6a5275efd35fef..f9446f9b5e4fda1aa96666b67a8845f2853c1402 100644 --- a/framework/tools/hdi-gen/ast/ast_sequenceable_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_sequenceable_type.cpp @@ -54,7 +54,7 @@ std::string ASTSequenceableType::EmitCType(TypeMode mode) const return "/"; } -std::string ASTSequenceableType::EmitCppType(TypeMode mode) const +std::string ASTSequenceableType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_sequenceable_type.h b/framework/tools/hdi-gen/ast/ast_sequenceable_type.h index 5035f37ebf276d36777e58c4476db870104eaa8b..6cd76ac9577722796bcaabee02660b18d8bdc075 100644 --- a/framework/tools/hdi-gen/ast/ast_sequenceable_type.h +++ b/framework/tools/hdi-gen/ast/ast_sequenceable_type.h @@ -29,7 +29,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/ast/ast_short_type.cpp b/framework/tools/hdi-gen/ast/ast_short_type.cpp index 65551cdbf6847a8c5180565cf6c69506f5062c66..82f9b0fc9803287cca3e2dee68c59b085174c000 100644 --- a/framework/tools/hdi-gen/ast/ast_short_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_short_type.cpp @@ -41,7 +41,7 @@ std::string ASTShortType::EmitCType(TypeMode mode) const } } -std::string ASTShortType::EmitCppType(TypeMode mode) const +std::string ASTShortType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_short_type.h b/framework/tools/hdi-gen/ast/ast_short_type.h index 445e173307b875a9f54ccd60ed4c1cce1b51ad0c..b633cfed6e02c3bda9cf9b992b5da19893ae43db 100644 --- a/framework/tools/hdi-gen/ast/ast_short_type.h +++ b/framework/tools/hdi-gen/ast/ast_short_type.h @@ -25,7 +25,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/ast/ast_smq_type.cpp b/framework/tools/hdi-gen/ast/ast_smq_type.cpp index b9fe3910273d0abb1d0bc32aac97c20a34772c13..030f4d3431705c18dca5c045f003ea670988d0bd 100644 --- a/framework/tools/hdi-gen/ast/ast_smq_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_smq_type.cpp @@ -38,7 +38,7 @@ TypeKind ASTSmqType::GetTypeKind() return TypeKind::TYPE_SMQ; } -std::string ASTSmqType::EmitCppType(TypeMode mode) const +std::string ASTSmqType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: @@ -141,7 +141,7 @@ TypeKind ASTAshmemType::GetTypeKind() return TypeKind::TYPE_ASHMEM; } -std::string ASTAshmemType::EmitCppType(TypeMode mode) const +std::string ASTAshmemType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_smq_type.h b/framework/tools/hdi-gen/ast/ast_smq_type.h index 64c0f1ec35fe3bfbbb65f626620ae8c44fb78c10..8cfb51c49c52ce7b4d591bc940829ef49f571f4c 100644 --- a/framework/tools/hdi-gen/ast/ast_smq_type.h +++ b/framework/tools/hdi-gen/ast/ast_smq_type.h @@ -30,7 +30,7 @@ public: TypeKind GetTypeKind() override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; void EmitCppWriteVar(const std::string &parcelName, const std::string &name, StringBuilder &sb, const std::string &prefix, unsigned int innerLevel = 0) const override; @@ -58,7 +58,7 @@ public: TypeKind GetTypeKind() override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; void EmitCppWriteVar(const std::string &parcelName, const std::string &name, StringBuilder &sb, const std::string &prefix, unsigned int innerLevel = 0) const override; diff --git a/framework/tools/hdi-gen/ast/ast_string_type.cpp b/framework/tools/hdi-gen/ast/ast_string_type.cpp index 0891fc25d1009c12ebb09a5d1e2b7f43319379d7..ef0e5be4e9666d9ba97c9ced03ed3c9f437ee351 100644 --- a/framework/tools/hdi-gen/ast/ast_string_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_string_type.cpp @@ -41,7 +41,7 @@ std::string ASTStringType::EmitCType(TypeMode mode) const } } -std::string ASTStringType::EmitCppType(TypeMode mode) const +std::string ASTStringType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_string_type.h b/framework/tools/hdi-gen/ast/ast_string_type.h index 19307d79793ea1792305eae25e9096bac65e9531..6d22a27b3a4d8c58b0d7391438c332a733dc2150 100644 --- a/framework/tools/hdi-gen/ast/ast_string_type.h +++ b/framework/tools/hdi-gen/ast/ast_string_type.h @@ -25,7 +25,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/ast/ast_struct_type.cpp b/framework/tools/hdi-gen/ast/ast_struct_type.cpp index 68fe13006e998ba13f15fa4ea36b8ac98bca907e..edeb0badfb759ec92b4c31c6a0260ff1baf92d12 100644 --- a/framework/tools/hdi-gen/ast/ast_struct_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_struct_type.cpp @@ -66,15 +66,15 @@ std::string ASTStructType::EmitCType(TypeMode mode) const } } -std::string ASTStructType::EmitCppType(TypeMode mode) const +std::string ASTStructType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: return StringHelper::Format("%s", name_.c_str()); case TypeMode::PARAM_IN: - return StringHelper::Format("const %s&", name_.c_str()); + return StringHelper::Format("const %s&", isIdentifiedVersion ? GetNameWithNamespace(namespace_, name_).c_str() : name_.c_str()); case TypeMode::PARAM_OUT: - return StringHelper::Format("%s&", name_.c_str()); + return StringHelper::Format("%s&", isIdentifiedVersion ? GetNameWithNamespace(namespace_, name_).c_str() : name_.c_str()); case TypeMode::LOCAL_VAR: return StringHelper::Format("%s", name_.c_str()); default: diff --git a/framework/tools/hdi-gen/ast/ast_struct_type.h b/framework/tools/hdi-gen/ast/ast_struct_type.h index 81ad65be287894166d61f8918ebf5c6530751ddb..81799f59d9648e77a3c782624f4fd31857d713ba 100644 --- a/framework/tools/hdi-gen/ast/ast_struct_type.h +++ b/framework/tools/hdi-gen/ast/ast_struct_type.h @@ -80,7 +80,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const override; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/ast/ast_type.cpp b/framework/tools/hdi-gen/ast/ast_type.cpp index e322569fecc27e4e9a78cf5f35ce619facff6490..6cabc44d2348ad28f76e53f07aaaa6b81c32439c 100644 --- a/framework/tools/hdi-gen/ast/ast_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_type.cpp @@ -185,7 +185,7 @@ std::string ASTType::EmitCType(TypeMode mode) const return "unknow"; } -std::string ASTType::EmitCppType(TypeMode mode) const +std::string ASTType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { return "unknow"; } diff --git a/framework/tools/hdi-gen/ast/ast_type.h b/framework/tools/hdi-gen/ast/ast_type.h index 33b812671ab70795300188fc1f7541495815500c..19e43ef0f7f34374238607b5aaac4a4f7298f7d5 100644 --- a/framework/tools/hdi-gen/ast/ast_type.h +++ b/framework/tools/hdi-gen/ast/ast_type.h @@ -143,7 +143,7 @@ public: virtual std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const; - virtual std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const; + virtual std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; virtual std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const; diff --git a/framework/tools/hdi-gen/ast/ast_uchar_type.cpp b/framework/tools/hdi-gen/ast/ast_uchar_type.cpp index 375a85f0621c746b38f82cc7fd592b11c80ae081..351100dee31446f3455e6725b61ccecbfc2ca831 100644 --- a/framework/tools/hdi-gen/ast/ast_uchar_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_uchar_type.cpp @@ -41,7 +41,7 @@ std::string ASTUcharType::EmitCType(TypeMode mode) const } } -std::string ASTUcharType::EmitCppType(TypeMode mode) const +std::string ASTUcharType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_uchar_type.h b/framework/tools/hdi-gen/ast/ast_uchar_type.h index aec6b77b0d124a494d89ce739d757110a80ad923..dc811ff8f704598340aa064c9ba3249c5dc79c4e 100644 --- a/framework/tools/hdi-gen/ast/ast_uchar_type.h +++ b/framework/tools/hdi-gen/ast/ast_uchar_type.h @@ -25,7 +25,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/ast/ast_uint_type.cpp b/framework/tools/hdi-gen/ast/ast_uint_type.cpp index 143cdc9d3b9ea2f0ac8e437fbd5941ebbbab66fd..3dc57d35391bc584254abe6cbd776ce3fcce801e 100644 --- a/framework/tools/hdi-gen/ast/ast_uint_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_uint_type.cpp @@ -41,7 +41,7 @@ std::string ASTUintType::EmitCType(TypeMode mode) const } } -std::string ASTUintType::EmitCppType(TypeMode mode) const +std::string ASTUintType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_uint_type.h b/framework/tools/hdi-gen/ast/ast_uint_type.h index e9f6eaf74c0031f459cd5dc05625acf47c50fb83..dc9700c55613d4a5e023c6bc3333e9a134975773 100644 --- a/framework/tools/hdi-gen/ast/ast_uint_type.h +++ b/framework/tools/hdi-gen/ast/ast_uint_type.h @@ -25,7 +25,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/ast/ast_ulong_type.cpp b/framework/tools/hdi-gen/ast/ast_ulong_type.cpp index 2a1d0ba530a285de3f8a9dfddd640bac1db7d946..4c60e8dddbd6c0adbef4eba271180cf9b8c03cca 100644 --- a/framework/tools/hdi-gen/ast/ast_ulong_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_ulong_type.cpp @@ -41,7 +41,7 @@ std::string ASTUlongType::EmitCType(TypeMode mode) const } } -std::string ASTUlongType::EmitCppType(TypeMode mode) const +std::string ASTUlongType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_ulong_type.h b/framework/tools/hdi-gen/ast/ast_ulong_type.h index 31046509e2e4d0679a9dece5220ffe44a1928956..898e52baa31356d43d420d7cc4116b2de85a89f7 100644 --- a/framework/tools/hdi-gen/ast/ast_ulong_type.h +++ b/framework/tools/hdi-gen/ast/ast_ulong_type.h @@ -25,7 +25,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/ast/ast_union_type.cpp b/framework/tools/hdi-gen/ast/ast_union_type.cpp index af4899120d62bf820c26819078175d54d0eb35bc..c5f4e4632a7c862c2daa204486e6d086fc1b9992 100644 --- a/framework/tools/hdi-gen/ast/ast_union_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_union_type.cpp @@ -63,7 +63,7 @@ std::string ASTUnionType::EmitCType(TypeMode mode) const } } -std::string ASTUnionType::EmitCppType(TypeMode mode) const +std::string ASTUnionType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_union_type.h b/framework/tools/hdi-gen/ast/ast_union_type.h index 0aca1910a32bdc1da764db84943d12148cb753df..44a4e3ea710b86b792cbf56a3b73f0ad54170c32 100644 --- a/framework/tools/hdi-gen/ast/ast_union_type.h +++ b/framework/tools/hdi-gen/ast/ast_union_type.h @@ -80,7 +80,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/ast/ast_ushort_type.cpp b/framework/tools/hdi-gen/ast/ast_ushort_type.cpp index 9b460ade3626d0c561931c90fcc8e3b22474a2cc..94d8ade6e4fd1afa2d9b29aa13040eabcc162822 100644 --- a/framework/tools/hdi-gen/ast/ast_ushort_type.cpp +++ b/framework/tools/hdi-gen/ast/ast_ushort_type.cpp @@ -41,7 +41,7 @@ std::string ASTUshortType::EmitCType(TypeMode mode) const } } -std::string ASTUshortType::EmitCppType(TypeMode mode) const +std::string ASTUshortType::EmitCppType(TypeMode mode, const bool &isIdentifiedVersion) const { switch (mode) { case TypeMode::NO_MODE: diff --git a/framework/tools/hdi-gen/ast/ast_ushort_type.h b/framework/tools/hdi-gen/ast/ast_ushort_type.h index e5fd7d75542fc02f8acebeace87d293a17da3a70..70067148a4630a87f52c1680de3b6e1e58d85efa 100644 --- a/framework/tools/hdi-gen/ast/ast_ushort_type.h +++ b/framework/tools/hdi-gen/ast/ast_ushort_type.h @@ -25,7 +25,7 @@ public: std::string EmitCType(TypeMode mode = TypeMode::NO_MODE) const override; - std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE) const override; + std::string EmitCppType(TypeMode mode = TypeMode::NO_MODE, const bool &isIdentifiedVersion = false) const; std::string EmitJavaType(TypeMode mode, bool isInnerType = false) const override; diff --git a/framework/tools/hdi-gen/build/ast/ast.o b/framework/tools/hdi-gen/build/ast/ast.o new file mode 100644 index 0000000000000000000000000000000000000000..ec92b786abc2889a7fc5e61f30008000dfc1264e Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_array_type.o b/framework/tools/hdi-gen/build/ast/ast_array_type.o new file mode 100644 index 0000000000000000000000000000000000000000..88718f0d908fddf331acdfe8eff2f72c32f98999 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_array_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_attribute.o b/framework/tools/hdi-gen/build/ast/ast_attribute.o new file mode 100644 index 0000000000000000000000000000000000000000..28d885d606a1cd0257282174772a5c012dc984a0 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_attribute.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_boolean_type.o b/framework/tools/hdi-gen/build/ast/ast_boolean_type.o new file mode 100644 index 0000000000000000000000000000000000000000..93663801f998be76d9da65181f2b1d01d5b035f8 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_boolean_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_byte_type.o b/framework/tools/hdi-gen/build/ast/ast_byte_type.o new file mode 100644 index 0000000000000000000000000000000000000000..54b5a9be41192d7564a1fcabe7eb7ac992559653 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_byte_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_double_type.o b/framework/tools/hdi-gen/build/ast/ast_double_type.o new file mode 100644 index 0000000000000000000000000000000000000000..2449192cd8a6a7303828a37956c3997f698c3073 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_double_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_enum_type.o b/framework/tools/hdi-gen/build/ast/ast_enum_type.o new file mode 100644 index 0000000000000000000000000000000000000000..339275c6d1f8e47cdec74880885b7f7671881458 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_enum_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_expr.o b/framework/tools/hdi-gen/build/ast/ast_expr.o new file mode 100644 index 0000000000000000000000000000000000000000..b4377154407d9220d20623db5abae7b8584fce82 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_expr.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_fd_type.o b/framework/tools/hdi-gen/build/ast/ast_fd_type.o new file mode 100644 index 0000000000000000000000000000000000000000..d54217a8072704c55f389c00151be8ae2dd3441d Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_fd_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_float_type.o b/framework/tools/hdi-gen/build/ast/ast_float_type.o new file mode 100644 index 0000000000000000000000000000000000000000..4695b5a9275fab718aafd331f0c2f3f204d5a7a4 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_float_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_integer_type.o b/framework/tools/hdi-gen/build/ast/ast_integer_type.o new file mode 100644 index 0000000000000000000000000000000000000000..dff16944c533ebdfff34ef43dcb9cb386706b789 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_integer_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_interface_type.o b/framework/tools/hdi-gen/build/ast/ast_interface_type.o new file mode 100644 index 0000000000000000000000000000000000000000..24e00a67416ba4ecab6e58f93bb854342641abec Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_interface_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_long_type.o b/framework/tools/hdi-gen/build/ast/ast_long_type.o new file mode 100644 index 0000000000000000000000000000000000000000..63ab3205229ea70da7e7ce7a7277f9157114de1a Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_long_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_map_type.o b/framework/tools/hdi-gen/build/ast/ast_map_type.o new file mode 100644 index 0000000000000000000000000000000000000000..db76be4dfab4301dd1c876c34aa885fca71ddf8d Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_map_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_method.o b/framework/tools/hdi-gen/build/ast/ast_method.o new file mode 100644 index 0000000000000000000000000000000000000000..09df2cd44d01048ab03a3be4725db0f27222f21a Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_method.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_namespace.o b/framework/tools/hdi-gen/build/ast/ast_namespace.o new file mode 100644 index 0000000000000000000000000000000000000000..30048eb9534f53335af35c1025450aa7d7f74a53 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_namespace.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_native_buffer_type.o b/framework/tools/hdi-gen/build/ast/ast_native_buffer_type.o new file mode 100644 index 0000000000000000000000000000000000000000..54ead6b534a07687fa1a2e8cfbe3eb52dabc97d4 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_native_buffer_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_node.o b/framework/tools/hdi-gen/build/ast/ast_node.o new file mode 100644 index 0000000000000000000000000000000000000000..4b0849b17f31d2a0d2126202a89dfda7710c141d Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_node.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_parameter.o b/framework/tools/hdi-gen/build/ast/ast_parameter.o new file mode 100644 index 0000000000000000000000000000000000000000..e3d773b63c57f3dea87b5840d3da9f0e0d92745d Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_parameter.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_pointer_type.o b/framework/tools/hdi-gen/build/ast/ast_pointer_type.o new file mode 100644 index 0000000000000000000000000000000000000000..dd4f4000be00af16adee9ba996bfc7bc2c4b578f Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_pointer_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_sequenceable_type.o b/framework/tools/hdi-gen/build/ast/ast_sequenceable_type.o new file mode 100644 index 0000000000000000000000000000000000000000..b6a16a14e374309ccf355c99fd770f77f93890fb Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_sequenceable_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_short_type.o b/framework/tools/hdi-gen/build/ast/ast_short_type.o new file mode 100644 index 0000000000000000000000000000000000000000..9ff136ff1e9e262710ce57c08a0c25b2a9356764 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_short_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_smq_type.o b/framework/tools/hdi-gen/build/ast/ast_smq_type.o new file mode 100644 index 0000000000000000000000000000000000000000..caa303326a5e78782eae635be27374d1faf0a987 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_smq_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_string_type.o b/framework/tools/hdi-gen/build/ast/ast_string_type.o new file mode 100644 index 0000000000000000000000000000000000000000..6ecf1757bed9aebafe56543215f4957dd85ec51a Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_string_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_struct_type.o b/framework/tools/hdi-gen/build/ast/ast_struct_type.o new file mode 100644 index 0000000000000000000000000000000000000000..1bce18fd114954942e389244b0aa18f390bbf1a9 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_struct_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_type.o b/framework/tools/hdi-gen/build/ast/ast_type.o new file mode 100644 index 0000000000000000000000000000000000000000..3a0fae8c0ba1e5a4a09c0e179cae9e117e0c66f4 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_uchar_type.o b/framework/tools/hdi-gen/build/ast/ast_uchar_type.o new file mode 100644 index 0000000000000000000000000000000000000000..fc07911f914a2094d948a6920977cad72a2f7f44 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_uchar_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_uint_type.o b/framework/tools/hdi-gen/build/ast/ast_uint_type.o new file mode 100644 index 0000000000000000000000000000000000000000..32be6cfeb1c0252b3bfeccd344073a4b16575d00 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_uint_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_ulong_type.o b/framework/tools/hdi-gen/build/ast/ast_ulong_type.o new file mode 100644 index 0000000000000000000000000000000000000000..575c1e9e78efd860dd256ab59daf16332b1ca5f7 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_ulong_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_union_type.o b/framework/tools/hdi-gen/build/ast/ast_union_type.o new file mode 100644 index 0000000000000000000000000000000000000000..89afe4339f1486fd9eded2db814126493d6a5fd1 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_union_type.o differ diff --git a/framework/tools/hdi-gen/build/ast/ast_ushort_type.o b/framework/tools/hdi-gen/build/ast/ast_ushort_type.o new file mode 100644 index 0000000000000000000000000000000000000000..4f357619be705beb8523ce55561913d3a0bf0ff5 Binary files /dev/null and b/framework/tools/hdi-gen/build/ast/ast_ushort_type.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/fscanf_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/fscanf_s.o new file mode 100644 index 0000000000000000000000000000000000000000..5bb389d11eaf5f5d82ec9e6f182ce1fd7d822ab1 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/fscanf_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/fwscanf_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/fwscanf_s.o new file mode 100644 index 0000000000000000000000000000000000000000..9754ab4ba0e43e7aa358ae4fb5f5c9ef31d3ec89 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/fwscanf_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/gets_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/gets_s.o new file mode 100644 index 0000000000000000000000000000000000000000..f02b9f69038bfeeccd440b34953a9b50594295eb Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/gets_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/memcpy_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/memcpy_s.o new file mode 100644 index 0000000000000000000000000000000000000000..5e806bf75617341335f02eb40e91dd66b43c8a7b Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/memcpy_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/memmove_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/memmove_s.o new file mode 100644 index 0000000000000000000000000000000000000000..fb8399402968d9c3d7489b35f5ef37fe9d3775b4 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/memmove_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/memset_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/memset_s.o new file mode 100644 index 0000000000000000000000000000000000000000..2190f43014f6ea904f34d5dc8182cb8f5bd3da56 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/memset_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/scanf_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/scanf_s.o new file mode 100644 index 0000000000000000000000000000000000000000..a7b2090012fd4c6f3780f028882b550904a109ab Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/scanf_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/securecutil.o b/framework/tools/hdi-gen/build/bounds_checking_function/securecutil.o new file mode 100644 index 0000000000000000000000000000000000000000..61751572fb98639818bed9d4e8d5e883d36b2b7f Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/securecutil.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/secureinput_a.o b/framework/tools/hdi-gen/build/bounds_checking_function/secureinput_a.o new file mode 100644 index 0000000000000000000000000000000000000000..c71661d22d553efca5b8436c63d2f7742d7e913f Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/secureinput_a.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/secureinput_w.o b/framework/tools/hdi-gen/build/bounds_checking_function/secureinput_w.o new file mode 100644 index 0000000000000000000000000000000000000000..e2748332dd9c3726081a5f4d63d690e23dc7617d Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/secureinput_w.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/secureprintoutput_a.o b/framework/tools/hdi-gen/build/bounds_checking_function/secureprintoutput_a.o new file mode 100644 index 0000000000000000000000000000000000000000..ba65b25f45ffe752a97c75df7e2e9464a4f38994 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/secureprintoutput_a.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/secureprintoutput_w.o b/framework/tools/hdi-gen/build/bounds_checking_function/secureprintoutput_w.o new file mode 100644 index 0000000000000000000000000000000000000000..0e8f13e0c9e570dfc499f7cf15188981c3ec5bf8 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/secureprintoutput_w.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/snprintf_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/snprintf_s.o new file mode 100644 index 0000000000000000000000000000000000000000..26a2aace4d100e5de0864a0a44a0906b83e99f37 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/snprintf_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/sprintf_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/sprintf_s.o new file mode 100644 index 0000000000000000000000000000000000000000..dc514504f4236f77b7f66bc53d4d2437907e59f2 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/sprintf_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/sscanf_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/sscanf_s.o new file mode 100644 index 0000000000000000000000000000000000000000..d8978166f2084125d36d23ce902ccacced0541d5 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/sscanf_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/strcat_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/strcat_s.o new file mode 100644 index 0000000000000000000000000000000000000000..1a555639163f10cef888ccd5cdb7a44b7ba0b4a1 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/strcat_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/strcpy_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/strcpy_s.o new file mode 100644 index 0000000000000000000000000000000000000000..cc374595145d66a63a74ed85b330df5cf35db26a Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/strcpy_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/strncat_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/strncat_s.o new file mode 100644 index 0000000000000000000000000000000000000000..fedec8dc97cf5961ad91b6069b2747357acee274 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/strncat_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/strncpy_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/strncpy_s.o new file mode 100644 index 0000000000000000000000000000000000000000..0c01e8e7704c0c0b074084507c66e6865add8df1 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/strncpy_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/strtok_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/strtok_s.o new file mode 100644 index 0000000000000000000000000000000000000000..0a962c601e086c3383de419da1ee68ca9b2546ec Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/strtok_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/swprintf_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/swprintf_s.o new file mode 100644 index 0000000000000000000000000000000000000000..5f1c44be5f2b076a2d3814e43f6c77278fd47205 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/swprintf_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/swscanf_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/swscanf_s.o new file mode 100644 index 0000000000000000000000000000000000000000..a49e11f0fd1ae24bab21f50a5a200e90b331b478 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/swscanf_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/vfscanf_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/vfscanf_s.o new file mode 100644 index 0000000000000000000000000000000000000000..4cc7a3f308420fc0f42d4c8b11bcbd2404b101ed Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/vfscanf_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/vfwscanf_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/vfwscanf_s.o new file mode 100644 index 0000000000000000000000000000000000000000..e188328bcf8b6ebcb99b93c03fb98bcca0f78436 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/vfwscanf_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/vscanf_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/vscanf_s.o new file mode 100644 index 0000000000000000000000000000000000000000..692e68272b5e50bf204f54ed2f1c1ab486d623fa Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/vscanf_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/vsnprintf_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/vsnprintf_s.o new file mode 100644 index 0000000000000000000000000000000000000000..2e024b7a8f9db0263c606800d6ddba424f9a9893 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/vsnprintf_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/vsprintf_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/vsprintf_s.o new file mode 100644 index 0000000000000000000000000000000000000000..ec099d54236003f8e2daa90536e3673551b9f0b8 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/vsprintf_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/vsscanf_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/vsscanf_s.o new file mode 100644 index 0000000000000000000000000000000000000000..c73c505ca1feb2fc80182d843cd49890be11181f Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/vsscanf_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/vswprintf_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/vswprintf_s.o new file mode 100644 index 0000000000000000000000000000000000000000..f75b4830a69095eb9c11185dd97cb2682aef7533 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/vswprintf_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/vswscanf_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/vswscanf_s.o new file mode 100644 index 0000000000000000000000000000000000000000..e4368682c97ff88a20b9dbb799f955c96765e35e Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/vswscanf_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/vwscanf_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/vwscanf_s.o new file mode 100644 index 0000000000000000000000000000000000000000..e870dfd79eb4ab8ab3dc72618437c759c01601c9 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/vwscanf_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/wcscat_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/wcscat_s.o new file mode 100644 index 0000000000000000000000000000000000000000..3c7b65c5d0e320ad42d062be41000be772f900ca Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/wcscat_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/wcscpy_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/wcscpy_s.o new file mode 100644 index 0000000000000000000000000000000000000000..0caac27d43e7b12d39b4c3e837eab3fb511ca8c6 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/wcscpy_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/wcsncat_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/wcsncat_s.o new file mode 100644 index 0000000000000000000000000000000000000000..d5ce0988b60ddd980f3b6f3163dd933e2c984cb7 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/wcsncat_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/wcsncpy_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/wcsncpy_s.o new file mode 100644 index 0000000000000000000000000000000000000000..28ccc8bdbfcaab5dbcfff2198b5f3ebb7a1fc5b1 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/wcsncpy_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/wcstok_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/wcstok_s.o new file mode 100644 index 0000000000000000000000000000000000000000..a6402bf41b6a73e34828790486954cfd29d9b344 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/wcstok_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/wmemcpy_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/wmemcpy_s.o new file mode 100644 index 0000000000000000000000000000000000000000..607de2cde706309c87654b4a1764fd6203af24c3 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/wmemcpy_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/wmemmove_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/wmemmove_s.o new file mode 100644 index 0000000000000000000000000000000000000000..de227b89fecfa404aaf17d8f9b31d1e2d0f45430 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/wmemmove_s.o differ diff --git a/framework/tools/hdi-gen/build/bounds_checking_function/wscanf_s.o b/framework/tools/hdi-gen/build/bounds_checking_function/wscanf_s.o new file mode 100644 index 0000000000000000000000000000000000000000..13ed00dc03723345e7c06d2b3336cab805430e64 Binary files /dev/null and b/framework/tools/hdi-gen/build/bounds_checking_function/wscanf_s.o differ diff --git a/framework/tools/hdi-gen/build/codegen/c_client_proxy_code_emitter.o b/framework/tools/hdi-gen/build/codegen/c_client_proxy_code_emitter.o new file mode 100644 index 0000000000000000000000000000000000000000..4424ad11501a4c52e437bfe82ccfe56c76f82fcf Binary files /dev/null and b/framework/tools/hdi-gen/build/codegen/c_client_proxy_code_emitter.o differ diff --git a/framework/tools/hdi-gen/build/codegen/c_code_emitter.o b/framework/tools/hdi-gen/build/codegen/c_code_emitter.o new file mode 100644 index 0000000000000000000000000000000000000000..5aa43ba86224b3f2c97b062ca9268f3c2f125e34 Binary files /dev/null and b/framework/tools/hdi-gen/build/codegen/c_code_emitter.o differ diff --git a/framework/tools/hdi-gen/build/codegen/c_custom_types_code_emitter.o b/framework/tools/hdi-gen/build/codegen/c_custom_types_code_emitter.o new file mode 100644 index 0000000000000000000000000000000000000000..6a720c4e1016e7c6e98245a294e171710f49ad7c Binary files /dev/null and b/framework/tools/hdi-gen/build/codegen/c_custom_types_code_emitter.o differ diff --git a/framework/tools/hdi-gen/build/codegen/c_interface_code_emitter.o b/framework/tools/hdi-gen/build/codegen/c_interface_code_emitter.o new file mode 100644 index 0000000000000000000000000000000000000000..3f9b3d55d8c4f42e6eeb441b4b62f199ec7817c9 Binary files /dev/null and b/framework/tools/hdi-gen/build/codegen/c_interface_code_emitter.o differ diff --git a/framework/tools/hdi-gen/build/codegen/c_service_driver_code_emitter.o b/framework/tools/hdi-gen/build/codegen/c_service_driver_code_emitter.o new file mode 100644 index 0000000000000000000000000000000000000000..2ebff06e3b81adceb7130eb4cc0284508cdd4333 Binary files /dev/null and b/framework/tools/hdi-gen/build/codegen/c_service_driver_code_emitter.o differ diff --git a/framework/tools/hdi-gen/build/codegen/c_service_impl_code_emitter.o b/framework/tools/hdi-gen/build/codegen/c_service_impl_code_emitter.o new file mode 100644 index 0000000000000000000000000000000000000000..bd2c22d430a1b2c875ff13dd915583ff8f39d532 Binary files /dev/null and b/framework/tools/hdi-gen/build/codegen/c_service_impl_code_emitter.o differ diff --git a/framework/tools/hdi-gen/build/codegen/c_service_stub_code_emitter.o b/framework/tools/hdi-gen/build/codegen/c_service_stub_code_emitter.o new file mode 100644 index 0000000000000000000000000000000000000000..5b909e4438fde13cf636d0b3d286317f7de15fa6 Binary files /dev/null and b/framework/tools/hdi-gen/build/codegen/c_service_stub_code_emitter.o differ diff --git a/framework/tools/hdi-gen/build/codegen/code_emitter.o b/framework/tools/hdi-gen/build/codegen/code_emitter.o new file mode 100644 index 0000000000000000000000000000000000000000..01bf986d707899b8857cfe03b3f4e06ba4a8dc3c Binary files /dev/null and b/framework/tools/hdi-gen/build/codegen/code_emitter.o differ diff --git a/framework/tools/hdi-gen/build/codegen/code_generator.o b/framework/tools/hdi-gen/build/codegen/code_generator.o new file mode 100644 index 0000000000000000000000000000000000000000..30b7f4b005cb228d6acce120c3c83bfb3e80efb1 Binary files /dev/null and b/framework/tools/hdi-gen/build/codegen/code_generator.o differ diff --git a/framework/tools/hdi-gen/build/codegen/cpp_client_proxy_code_emitter.o b/framework/tools/hdi-gen/build/codegen/cpp_client_proxy_code_emitter.o new file mode 100644 index 0000000000000000000000000000000000000000..148e289b3156d2447f54718b956b2364b110857b Binary files /dev/null and b/framework/tools/hdi-gen/build/codegen/cpp_client_proxy_code_emitter.o differ diff --git a/framework/tools/hdi-gen/build/codegen/cpp_code_emitter.o b/framework/tools/hdi-gen/build/codegen/cpp_code_emitter.o new file mode 100644 index 0000000000000000000000000000000000000000..88b4854b25e7d4ca87723ed1ed3ef07bc372acdc Binary files /dev/null and b/framework/tools/hdi-gen/build/codegen/cpp_code_emitter.o differ diff --git a/framework/tools/hdi-gen/build/codegen/cpp_custom_types_code_emitter.o b/framework/tools/hdi-gen/build/codegen/cpp_custom_types_code_emitter.o new file mode 100644 index 0000000000000000000000000000000000000000..9e00e93d2e2918d1af474db141c17e8105e422b6 Binary files /dev/null and b/framework/tools/hdi-gen/build/codegen/cpp_custom_types_code_emitter.o differ diff --git a/framework/tools/hdi-gen/build/codegen/cpp_interface_code_emitter.o b/framework/tools/hdi-gen/build/codegen/cpp_interface_code_emitter.o new file mode 100644 index 0000000000000000000000000000000000000000..756f0a775220b1beb2ccc2f67366e17cb3061a8a Binary files /dev/null and b/framework/tools/hdi-gen/build/codegen/cpp_interface_code_emitter.o differ diff --git a/framework/tools/hdi-gen/build/codegen/cpp_service_driver_code_emitter.o b/framework/tools/hdi-gen/build/codegen/cpp_service_driver_code_emitter.o new file mode 100644 index 0000000000000000000000000000000000000000..0f84e071e79602e35c28696d780c5703913ebfe4 Binary files /dev/null and b/framework/tools/hdi-gen/build/codegen/cpp_service_driver_code_emitter.o differ diff --git a/framework/tools/hdi-gen/build/codegen/cpp_service_impl_code_emitter.o b/framework/tools/hdi-gen/build/codegen/cpp_service_impl_code_emitter.o new file mode 100644 index 0000000000000000000000000000000000000000..3efad8272835579c8c528221fd199eb85f8c0029 Binary files /dev/null and b/framework/tools/hdi-gen/build/codegen/cpp_service_impl_code_emitter.o differ diff --git a/framework/tools/hdi-gen/build/codegen/cpp_service_stub_code_emitter.o b/framework/tools/hdi-gen/build/codegen/cpp_service_stub_code_emitter.o new file mode 100644 index 0000000000000000000000000000000000000000..aaed499c3b4be0ff00a2d2f5dd4343aa0b31853c Binary files /dev/null and b/framework/tools/hdi-gen/build/codegen/cpp_service_stub_code_emitter.o differ diff --git a/framework/tools/hdi-gen/build/codegen/java_client_interface_code_emitter.o b/framework/tools/hdi-gen/build/codegen/java_client_interface_code_emitter.o new file mode 100644 index 0000000000000000000000000000000000000000..b235961e0e8b51c1d2312bdcae6e6a789f00e667 Binary files /dev/null and b/framework/tools/hdi-gen/build/codegen/java_client_interface_code_emitter.o differ diff --git a/framework/tools/hdi-gen/build/codegen/java_client_proxy_code_emitter.o b/framework/tools/hdi-gen/build/codegen/java_client_proxy_code_emitter.o new file mode 100644 index 0000000000000000000000000000000000000000..1048b3399fe57267b6f3a7f1b6c93b4786881dc1 Binary files /dev/null and b/framework/tools/hdi-gen/build/codegen/java_client_proxy_code_emitter.o differ diff --git a/framework/tools/hdi-gen/build/codegen/java_code_emitter.o b/framework/tools/hdi-gen/build/codegen/java_code_emitter.o new file mode 100644 index 0000000000000000000000000000000000000000..d74269ae266b0048dd9809c424bf10376b84e0e0 Binary files /dev/null and b/framework/tools/hdi-gen/build/codegen/java_code_emitter.o differ diff --git a/framework/tools/hdi-gen/build/hash/hash.o b/framework/tools/hdi-gen/build/hash/hash.o new file mode 100644 index 0000000000000000000000000000000000000000..93704571efded467dc6d9f9175faf1d19ef534c2 Binary files /dev/null and b/framework/tools/hdi-gen/build/hash/hash.o differ diff --git a/framework/tools/hdi-gen/build/lexer/lexer.o b/framework/tools/hdi-gen/build/lexer/lexer.o new file mode 100644 index 0000000000000000000000000000000000000000..ea611a1c7350b3f298c784d287a9dc9c7a04aca2 Binary files /dev/null and b/framework/tools/hdi-gen/build/lexer/lexer.o differ diff --git a/framework/tools/hdi-gen/build/lexer/token.o b/framework/tools/hdi-gen/build/lexer/token.o new file mode 100644 index 0000000000000000000000000000000000000000..e14fbb650c521affcb627927b5bd9fd74aaf4976 Binary files /dev/null and b/framework/tools/hdi-gen/build/lexer/token.o differ diff --git a/framework/tools/hdi-gen/build/main.o b/framework/tools/hdi-gen/build/main.o new file mode 100644 index 0000000000000000000000000000000000000000..975fd9dbcf4239c4f2e8f459e6e26e5ddbc028a9 Binary files /dev/null and b/framework/tools/hdi-gen/build/main.o differ diff --git a/framework/tools/hdi-gen/build/parser/parser.o b/framework/tools/hdi-gen/build/parser/parser.o new file mode 100644 index 0000000000000000000000000000000000000000..2375b136625c9c5030fe23ef253694a935662ebb Binary files /dev/null and b/framework/tools/hdi-gen/build/parser/parser.o differ diff --git a/framework/tools/hdi-gen/build/preprocessor/preprocessor.o b/framework/tools/hdi-gen/build/preprocessor/preprocessor.o new file mode 100644 index 0000000000000000000000000000000000000000..8af1200ad4fd1aa036df3511b6738b88482acc00 Binary files /dev/null and b/framework/tools/hdi-gen/build/preprocessor/preprocessor.o differ diff --git a/framework/tools/hdi-gen/build/util/file.o b/framework/tools/hdi-gen/build/util/file.o new file mode 100644 index 0000000000000000000000000000000000000000..4d84c4a471e3d9704db7252619e6b96a716247fe Binary files /dev/null and b/framework/tools/hdi-gen/build/util/file.o differ diff --git a/framework/tools/hdi-gen/build/util/light_refcount_base.o b/framework/tools/hdi-gen/build/util/light_refcount_base.o new file mode 100644 index 0000000000000000000000000000000000000000..6767eecd93486ae5121b8b6d06200f1cb62f45d5 Binary files /dev/null and b/framework/tools/hdi-gen/build/util/light_refcount_base.o differ diff --git a/framework/tools/hdi-gen/build/util/logger.o b/framework/tools/hdi-gen/build/util/logger.o new file mode 100644 index 0000000000000000000000000000000000000000..790a5303c624d6ff6a7158832b81361682abe47e Binary files /dev/null and b/framework/tools/hdi-gen/build/util/logger.o differ diff --git a/framework/tools/hdi-gen/build/util/options.o b/framework/tools/hdi-gen/build/util/options.o new file mode 100644 index 0000000000000000000000000000000000000000..d83158c5614a04f8bd6ad24ca38f8317d5a06c9e Binary files /dev/null and b/framework/tools/hdi-gen/build/util/options.o differ diff --git a/framework/tools/hdi-gen/build/util/string_builder.o b/framework/tools/hdi-gen/build/util/string_builder.o new file mode 100644 index 0000000000000000000000000000000000000000..770197031bd3a54e32385c0531f7bc3e46e60668 Binary files /dev/null and b/framework/tools/hdi-gen/build/util/string_builder.o differ diff --git a/framework/tools/hdi-gen/build/util/string_helper.o b/framework/tools/hdi-gen/build/util/string_helper.o new file mode 100644 index 0000000000000000000000000000000000000000..1e1b668df47ae6608d7218bac97da9235322e625 Binary files /dev/null and b/framework/tools/hdi-gen/build/util/string_helper.o differ diff --git a/framework/tools/hdi-gen/hdi-gen b/framework/tools/hdi-gen/hdi-gen new file mode 100644 index 0000000000000000000000000000000000000000..a0e6d33e08feac2442a1f269e7ffe5cea4356d4a Binary files /dev/null and b/framework/tools/hdi-gen/hdi-gen differ diff --git a/framework/tools/hdi-gen/out/test/v1_0/itest_callback.h b/framework/tools/hdi-gen/out/test/v1_0/itest_callback.h new file mode 100644 index 0000000000000000000000000000000000000000..fbafc13fb1b823460dab9d4ed5c0b0e65fe17441 --- /dev/null +++ b/framework/tools/hdi-gen/out/test/v1_0/itest_callback.h @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_HDI_TEST_V1_0_ITESTCALLBACK_H +#define OHOS_HDI_TEST_V1_0_ITESTCALLBACK_H + +#include +#include +#include +#include "test/v1_0/test_types.h" + +#ifndef HDI_BUFF_MAX_SIZE +#define HDI_BUFF_MAX_SIZE (1024 * 200) +#endif + +#ifndef HDI_CHECK_VALUE_RETURN +#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ + if ((lv) compare (rv)) { \ + return ret; \ + } \ +} while (false) +#endif + +#ifndef HDI_CHECK_VALUE_RET_GOTO +#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ + if ((lv) compare (rv)) { \ + ret = value; \ + goto table; \ + } \ +} while (false) +#endif + +namespace OHOS { +namespace HDI { +namespace Test { +namespace V1_0 { +using namespace OHOS; +using namespace OHOS::HDI; + +enum { + CMD_TEST_CALLBACK_GET_VERSION = 0, + CMD_TEST_CALLBACK_ON_DATA_EVENT = 1, +}; + +class ITestCallback : public HdiBase { +public: + DECLARE_HDI_DESCRIPTOR(u"ohos.hdi.test.v1_0.ITestCallback"); + + virtual ~ITestCallback() = default; + + virtual int32_t OnDataEvent(const HdfTestEvent& event) = 0; + + virtual int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) + { + majorVer = 1; + minorVer = 0; + return HDF_SUCCESS; + } + + virtual const std::u16string GetDesc() + { + return metaDescriptor_; + } +}; +} // V1_0 +} // Test +} // HDI +} // OHOS + +#endif // OHOS_HDI_TEST_V1_0_ITESTCALLBACK_H \ No newline at end of file diff --git a/framework/tools/hdi-gen/out/test/v1_0/test_callback_proxy.cpp b/framework/tools/hdi-gen/out/test/v1_0/test_callback_proxy.cpp new file mode 100644 index 0000000000000000000000000000000000000000..aa21a406ec982718ed68a9bec80aaafc0765ee60 --- /dev/null +++ b/framework/tools/hdi-gen/out/test/v1_0/test_callback_proxy.cpp @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "v1_0/test_callback_proxy.h" +#include +#include +#include +#include +#include +#include + +#define HDF_LOG_TAG test_callback_proxy + +namespace OHOS { +namespace HDI { +namespace Test { +namespace V1_0 { + + +int32_t OHOS::HDI::Test::V1_0::TestCallbackProxy::OnDataEvent(const HdfTestEvent& event) +{ + return OHOS::HDI::Test::V1_0::TestCallbackProxy::OnDataEvent_(event, Remote()); +} + +int32_t OHOS::HDI::Test::V1_0::TestCallbackProxy::GetVersion(uint32_t& majorVer, uint32_t& minorVer) +{ + return OHOS::HDI::Test::V1_0::TestCallbackProxy::GetVersion_(majorVer, minorVer, Remote()); +} + +int32_t OHOS::HDI::Test::V1_0::TestCallbackProxy::OnDataEvent_(const HdfTestEvent& event, + const sptr remote) +{ + MessageParcel testCallbackData; + MessageParcel testCallbackReply; + MessageOption testCallbackOption(MessageOption::TF_SYNC); + + if (!testCallbackData.WriteInterfaceToken(OHOS::HDI::Test::V1_0::ITestCallback::GetDescriptor())) { + HDF_LOGE("%{public}s: failed to write interface descriptor!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (!HdfTestEventBlockMarshalling(testCallbackData, event)) { + HDF_LOGE("%{public}s: write event failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (remote == nullptr) { + HDF_LOGE("%{public}s: invalid remote object!", __func__); + return HDF_ERR_INVALID_OBJECT; + } + + int32_t testCallbackRet = remote->SendRequest(CMD_TEST_CALLBACK_ON_DATA_EVENT, testCallbackData, testCallbackReply, testCallbackOption); + if (testCallbackRet != HDF_SUCCESS) { + HDF_LOGE("%{public}s failed, error code is %{public}d", __func__, testCallbackRet); + return testCallbackRet; + } + + return testCallbackRet; +} + +int32_t OHOS::HDI::Test::V1_0::TestCallbackProxy::GetVersion_(uint32_t& majorVer, uint32_t& minorVer, + const sptr remote) +{ + MessageParcel testCallbackData; + MessageParcel testCallbackReply; + MessageOption testCallbackOption(MessageOption::TF_SYNC); + + if (!testCallbackData.WriteInterfaceToken(OHOS::HDI::Test::V1_0::ITestCallback::GetDescriptor())) { + HDF_LOGE("%{public}s: failed to write interface descriptor!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (remote == nullptr) { + HDF_LOGE("%{public}s: invalid remote object!", __func__); + return HDF_ERR_INVALID_OBJECT; + } + + int32_t testCallbackRet = remote->SendRequest(CMD_TEST_CALLBACK_GET_VERSION, testCallbackData, testCallbackReply, testCallbackOption); + if (testCallbackRet != HDF_SUCCESS) { + HDF_LOGE("%{public}s failed, error code is %{public}d", __func__, testCallbackRet); + return testCallbackRet; + } + + if (!testCallbackReply.ReadUint32(majorVer)) { + HDF_LOGE("%{public}s: read majorVer failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (!testCallbackReply.ReadUint32(minorVer)) { + HDF_LOGE("%{public}s: read minorVer failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + return testCallbackRet; +} + +} // V1_0 +} // Test +} // HDI +} // OHOS diff --git a/framework/tools/hdi-gen/out/test/v1_0/test_callback_proxy.h b/framework/tools/hdi-gen/out/test/v1_0/test_callback_proxy.h new file mode 100644 index 0000000000000000000000000000000000000000..36e2eedb20734f2df278a5b07e4d3b33d86c2bf8 --- /dev/null +++ b/framework/tools/hdi-gen/out/test/v1_0/test_callback_proxy.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_HDI_TEST_V1_0_TESTCALLBACKPROXY_H +#define OHOS_HDI_TEST_V1_0_TESTCALLBACKPROXY_H + +#include "v1_0/itest_callback.h" +#include + +namespace OHOS { +namespace HDI { +namespace Test { +namespace V1_0 { + +class TestCallbackProxy : public IProxyBroker { +public: + explicit TestCallbackProxy(const sptr& remote) : IProxyBroker(remote) {} + + virtual ~TestCallbackProxy() = default; + + int32_t OnDataEvent(const HdfTestEvent& event) override; + + int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) override; + + static int32_t OnDataEvent_(const HdfTestEvent& event, const sptr remote); + + static int32_t GetVersion_(uint32_t& majorVer, uint32_t& minorVer, const sptr remote); + +private: + static inline BrokerDelegator delegator_; +}; + +} // V1_0 +} // Test +} // HDI +} // OHOS + +#endif // OHOS_HDI_TEST_V1_0_TESTCALLBACKPROXY_H \ No newline at end of file diff --git a/framework/tools/hdi-gen/out/test/v1_0/test_callback_service.cpp b/framework/tools/hdi-gen/out/test/v1_0/test_callback_service.cpp new file mode 100644 index 0000000000000000000000000000000000000000..39a60a0883d69c69a6592475403fa3f5fea1312b --- /dev/null +++ b/framework/tools/hdi-gen/out/test/v1_0/test_callback_service.cpp @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "v1_0/test_callback_service.h" +#include + +#define HDF_LOG_TAG test_callback_service + +namespace OHOS { +namespace HDI { +namespace Test { +namespace V1_0 { +int32_t TestCallbackService::OnDataEvent(const HdfTestEvent& event) +{ + return HDF_SUCCESS; +} + +} // V1_0 +} // Test +} // HDI +} // OHOS diff --git a/framework/tools/hdi-gen/out/test/v1_0/test_callback_service.h b/framework/tools/hdi-gen/out/test/v1_0/test_callback_service.h new file mode 100644 index 0000000000000000000000000000000000000000..13364214d11bc107f6a3663b0242fa32da4f7631 --- /dev/null +++ b/framework/tools/hdi-gen/out/test/v1_0/test_callback_service.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_HDI_TEST_V1_0_TESTCALLBACKSERVICE_H +#define OHOS_HDI_TEST_V1_0_TESTCALLBACKSERVICE_H + +#include "v1_0/itest_callback.h" + +namespace OHOS { +namespace HDI { +namespace Test { +namespace V1_0 { +class TestCallbackService : public OHOS::HDI::Test::V1_0::ITestCallback { +public: + TestCallbackService() = default; + virtual ~TestCallbackService() = default; + + int32_t OnDataEvent(const HdfTestEvent& event) override; + +}; +} // V1_0 +} // Test +} // HDI +} // OHOS + +#endif // OHOS_HDI_TEST_V1_0_TESTCALLBACKSERVICE_H \ No newline at end of file diff --git a/framework/tools/hdi-gen/out/test/v1_0/test_callback_stub.cpp b/framework/tools/hdi-gen/out/test/v1_0/test_callback_stub.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b3e6cebcf5a88e6ca4a438a3a7ec43755355d0f9 --- /dev/null +++ b/framework/tools/hdi-gen/out/test/v1_0/test_callback_stub.cpp @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "v1_0/test_callback_stub.h" +#include +#include + +#define HDF_LOG_TAG test_callback_stub + +namespace OHOS { +namespace HDI { +namespace Test { +namespace V1_0 { + + + +OHOS::HDI::Test::V1_0::TestCallbackStub::TestCallbackStub(const sptr &impl) + : IPCObjectStub(OHOS::HDI::Test::V1_0::ITestCallback::GetDescriptor()), impl_(impl) +{ +} + +OHOS::HDI::Test::V1_0::TestCallbackStub::~TestCallbackStub() +{ + ObjectCollector::GetInstance().RemoveObject(impl_); +} + +int32_t OHOS::HDI::Test::V1_0::TestCallbackStub::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) +{ + switch (code) { + case CMD_TEST_CALLBACK_GET_VERSION: + return TestCallbackStubGetVersion(data, reply, option); + case CMD_TEST_CALLBACK_ON_DATA_EVENT: + return TestCallbackStubOnDataEvent(data, reply, option); + default: { + HDF_LOGE("%{public}s: cmd %{public}d is not supported", __func__, code); + return IPCObjectStub::OnRemoteRequest(code, data, reply, option); + } + } +} + +int32_t OHOS::HDI::Test::V1_0::TestCallbackStub::TestCallbackStubOnDataEvent(MessageParcel& testCallbackData, MessageParcel& testCallbackReply, MessageOption& testCallbackOption) +{ + return OHOS::HDI::Test::V1_0::TestCallbackStub::TestCallbackStubOnDataEvent_(testCallbackData, testCallbackReply, testCallbackOption, impl_); +} + +int32_t OHOS::HDI::Test::V1_0::TestCallbackStub::TestCallbackStubGetVersion(MessageParcel& testCallbackData, MessageParcel& testCallbackReply, MessageOption& testCallbackOption) +{ + return OHOS::HDI::Test::V1_0::TestCallbackStub::TestCallbackStubGetVersion_(testCallbackData, testCallbackReply, testCallbackOption, impl_); +} + +int32_t OHOS::HDI::Test::V1_0::TestCallbackStub::TestCallbackStubOnDataEvent_(MessageParcel& testCallbackData, MessageParcel& testCallbackReply, MessageOption& testCallbackOption, sptr impl) +{ + if (testCallbackData.ReadInterfaceToken() != OHOS::HDI::Test::V1_0::ITestCallback::GetDescriptor()) { + HDF_LOGE("%{public}s: interface token check failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + HdfTestEvent event; + if (!HdfTestEventBlockUnmarshalling(testCallbackData, event)) { + HDF_LOGE("%{public}s: read event failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (impl == nullptr) { + HDF_LOGE("%{public}s: impl is nullptr!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + int32_t testCallbackRet = impl->OnDataEvent(event); + if (testCallbackRet != HDF_SUCCESS) { + HDF_LOGE("%{public}s failed, error code is %{public}d", __func__, testCallbackRet); + return testCallbackRet; + } + + return testCallbackRet; +} + +int32_t OHOS::HDI::Test::V1_0::TestCallbackStub::TestCallbackStubGetVersion_(MessageParcel& testCallbackData, MessageParcel& testCallbackReply, MessageOption& testCallbackOption, sptr impl) +{ + if (testCallbackData.ReadInterfaceToken() != OHOS::HDI::Test::V1_0::ITestCallback::GetDescriptor()) { + HDF_LOGE("%{public}s: interface token check failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + uint32_t majorVer = 0; + + uint32_t minorVer = 0; + + if (impl == nullptr) { + HDF_LOGE("%{public}s: impl is nullptr!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + int32_t testCallbackRet = impl->GetVersion(majorVer, minorVer); + if (testCallbackRet != HDF_SUCCESS) { + HDF_LOGE("%{public}s failed, error code is %{public}d", __func__, testCallbackRet); + return testCallbackRet; + } + + if (!testCallbackReply.WriteUint32(majorVer)) { + HDF_LOGE("%{public}s: write majorVer failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (!testCallbackReply.WriteUint32(minorVer)) { + HDF_LOGE("%{public}s: write minorVer failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + return testCallbackRet; +} +} // V1_0 +} // Test +} // HDI +} // OHOS diff --git a/framework/tools/hdi-gen/out/test/v1_0/test_callback_stub.h b/framework/tools/hdi-gen/out/test/v1_0/test_callback_stub.h new file mode 100644 index 0000000000000000000000000000000000000000..0cce95fa5b1b6c86f9c502b55a6938866bcfb2b1 --- /dev/null +++ b/framework/tools/hdi-gen/out/test/v1_0/test_callback_stub.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_HDI_TEST_V1_0_TESTCALLBACKSTUB_H +#define OHOS_HDI_TEST_V1_0_TESTCALLBACKSTUB_H + +#include +#include +#include +#include +#include +#include "v1_0/itest_callback.h" + +namespace OHOS { +namespace HDI { +namespace Test { +namespace V1_0 { + +using namespace OHOS; +class TestCallbackStub : public IPCObjectStub { +public: + explicit TestCallbackStub(const sptr &impl); + virtual ~TestCallbackStub(); + + int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; + + static int32_t TestCallbackStubOnDataEvent_(MessageParcel& testCallbackData, MessageParcel& testCallbackReply, MessageOption& testCallbackOption, sptr impl); + + static int32_t TestCallbackStubGetVersion_(MessageParcel& testCallbackData, MessageParcel& testCallbackReply, MessageOption& testCallbackOption, sptr impl); + +private: + int32_t TestCallbackStubOnDataEvent(MessageParcel& testCallbackData, MessageParcel& testCallbackReply, MessageOption& testCallbackOption); + + int32_t TestCallbackStubGetVersion(MessageParcel& testCallbackData, MessageParcel& testCallbackReply, MessageOption& testCallbackOption); + + + static inline ObjectDelegator objDelegator_; + sptr impl_; +}; +} // V1_0 +} // Test +} // HDI +} // OHOS + +#endif // OHOS_HDI_TEST_V1_0_TESTCALLBACKSTUB_H \ No newline at end of file diff --git a/framework/tools/hdi-gen/out/test/v1_1/itest_interface.h b/framework/tools/hdi-gen/out/test/v1_1/itest_interface.h new file mode 100644 index 0000000000000000000000000000000000000000..1771c4c165fe1371d9fab3eb55393a0cc075a1ec --- /dev/null +++ b/framework/tools/hdi-gen/out/test/v1_1/itest_interface.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_HDI_TEST_V1_1_ITESTINTERFACE_H +#define OHOS_HDI_TEST_V1_1_ITESTINTERFACE_H + +#include +#include +#include +#include +#include "test/v1_0/itest_callback.h" +#include "test/v1_0/itest_interface.h" +#include "test/v1_0/test_types.h" +#include "test/v1_1/test_types.h" + +#ifndef HDI_BUFF_MAX_SIZE +#define HDI_BUFF_MAX_SIZE (1024 * 200) +#endif + +#ifndef HDI_CHECK_VALUE_RETURN +#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ + if ((lv) compare (rv)) { \ + return ret; \ + } \ +} while (false) +#endif + +#ifndef HDI_CHECK_VALUE_RET_GOTO +#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ + if ((lv) compare (rv)) { \ + ret = value; \ + goto table; \ + } \ +} while (false) +#endif + +namespace OHOS { +namespace HDI { +namespace Test { +namespace V1_1 { +using namespace OHOS; +using namespace OHOS::HDI; +using namespace OHOS::HDI::Test::V1_0; + +enum { + CMD_TEST_INTERFACE_SET_TEST_CONFIG = 5, + CMD_TEST_INTERFACE_STRUCT_VERSION_TEST = 6, + CMD_TEST_INTERFACE_TEST_UNREGISTER = 7, +}; + +class ITestInterface : public OHOS::HDI::Test::V1_0::ITestInterface { +public: + DECLARE_HDI_DESCRIPTOR(u"ohos.hdi.test.v1_1.ITestInterface"); + + virtual ~ITestInterface() = default; + + static sptr Get(bool isStub = false); + static sptr Get(const std::string &serviceName, bool isStub = false); + + virtual int32_t SetTestConfig(int32_t testType, const std::vector& data) = 0; + + virtual int32_t StructVersionTest(int32_t testType, const std::vector& data, + const OHOS::HDI::Test::V1_1::WaveParam& testWPIn, OHOS::HDI::Test::V1_0::WaveParam& testWPOut, const WaveParam& testWPNoVersion) = 0; + + virtual int32_t TestUnregister(const sptr& callbackObj) = 0; + + int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) override + { + majorVer = 1; + minorVer = 1; + return HDF_SUCCESS; + } + + const std::u16string GetDesc() override + { + return metaDescriptor_; + } +}; +} // V1_1 +} // Test +} // HDI +} // OHOS + +#endif // OHOS_HDI_TEST_V1_1_ITESTINTERFACE_H \ No newline at end of file diff --git a/framework/tools/hdi-gen/out/test/v1_1/test_interface_driver.cpp b/framework/tools/hdi-gen/out/test/v1_1/test_interface_driver.cpp new file mode 100644 index 0000000000000000000000000000000000000000..035a1d7968f2bb72cce5dfb0cacbda2639443114 --- /dev/null +++ b/framework/tools/hdi-gen/out/test/v1_1/test_interface_driver.cpp @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include "v1_1/test_interface_stub.h" + +#define HDF_LOG_TAG test_interface_driver + +using namespace OHOS::HDI::Test::V1_1; + +struct HdfTestInterfaceHost { + struct IDeviceIoService ioService; + OHOS::sptr stub; +}; + +static int32_t TestInterfaceDriverDispatch(struct HdfDeviceIoClient *client, int cmdId, struct HdfSBuf *data, + struct HdfSBuf *reply) +{ + auto *hdfTestInterfaceHost = CONTAINER_OF(client->device->service, struct HdfTestInterfaceHost, ioService); + + OHOS::MessageParcel *dataParcel = nullptr; + OHOS::MessageParcel *replyParcel = nullptr; + OHOS::MessageOption option; + + if (SbufToParcel(data, &dataParcel) != HDF_SUCCESS) { + HDF_LOGE("%{public}s: invalid data sbuf object to dispatch", __func__); + return HDF_ERR_INVALID_PARAM; + } + if (SbufToParcel(reply, &replyParcel) != HDF_SUCCESS) { + HDF_LOGE("%{public}s: invalid reply sbuf object to dispatch", __func__); + return HDF_ERR_INVALID_PARAM; + } + + return hdfTestInterfaceHost->stub->SendRequest(cmdId, *dataParcel, *replyParcel, option); +} + +static int HdfTestInterfaceDriverInit(struct HdfDeviceObject *deviceObject) +{ + HDF_LOGI("%{public}s: driver init start", __func__); + return HDF_SUCCESS; +} + +static int HdfTestInterfaceDriverBind(struct HdfDeviceObject *deviceObject) +{ + HDF_LOGI("%{public}s: driver bind start", __func__); + auto *hdfTestInterfaceHost = new (std::nothrow) HdfTestInterfaceHost; + if (hdfTestInterfaceHost == nullptr) { + HDF_LOGE("%{public}s: failed to create create HdfTestInterfaceHost object", __func__); + return HDF_FAILURE; + } + + hdfTestInterfaceHost->ioService.Dispatch = TestInterfaceDriverDispatch; + hdfTestInterfaceHost->ioService.Open = NULL; + hdfTestInterfaceHost->ioService.Release = NULL; + + auto serviceImpl = OHOS::HDI::Test::V1_1::ITestInterface::Get(true); + if (serviceImpl == nullptr) { + HDF_LOGE("%{public}s: failed to get of implement service", __func__); + delete hdfTestInterfaceHost; + return HDF_FAILURE; + } + + hdfTestInterfaceHost->stub = OHOS::HDI::ObjectCollector::GetInstance().GetOrNewObject(serviceImpl, + OHOS::HDI::Test::V1_1::ITestInterface::GetDescriptor()); + if (hdfTestInterfaceHost->stub == nullptr) { + HDF_LOGE("%{public}s: failed to get stub object", __func__); + delete hdfTestInterfaceHost; + return HDF_FAILURE; + } + + deviceObject->service = &hdfTestInterfaceHost->ioService; + return HDF_SUCCESS; +} + +static void HdfTestInterfaceDriverRelease(struct HdfDeviceObject *deviceObject) +{ + HDF_LOGI("%{public}s: driver release start", __func__); + if (deviceObject->service == nullptr) { + return; + } + + auto *hdfTestInterfaceHost = CONTAINER_OF(deviceObject->service, struct HdfTestInterfaceHost, ioService); + if (hdfTestInterfaceHost != nullptr) { + delete hdfTestInterfaceHost; + } +} + +struct HdfDriverEntry g_testinterfaceDriverEntry = { + .moduleVersion = 1, + .moduleName = "", + .Bind = HdfTestInterfaceDriverBind, + .Init = HdfTestInterfaceDriverInit, + .Release = HdfTestInterfaceDriverRelease, +}; + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ +HDF_INIT(g_testinterfaceDriverEntry); +#ifdef __cplusplus +} +#endif /* __cplusplus */ diff --git a/framework/tools/hdi-gen/out/test/v1_1/test_interface_proxy.cpp b/framework/tools/hdi-gen/out/test/v1_1/test_interface_proxy.cpp new file mode 100644 index 0000000000000000000000000000000000000000..690457e3d0e6f58066665b1daee2e09ae59e8430 --- /dev/null +++ b/framework/tools/hdi-gen/out/test/v1_1/test_interface_proxy.cpp @@ -0,0 +1,271 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "v1_1/test_interface_proxy.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#define HDF_LOG_TAG test_interface_proxy + +namespace OHOS { +namespace HDI { +namespace Test { +namespace V1_1 { + +template +static bool WritePodArray(MessageParcel &parcel, const std::vector &data); + +sptr OHOS::HDI::Test::V1_1::ITestInterface::Get(bool isStub) +{ + return ITestInterface::Get("test_interface_service", isStub); +} + +sptr OHOS::HDI::Test::V1_1::ITestInterface::Get(const std::string& serviceName, bool isStub) +{ + if (isStub) { + std::string desc = Str16ToStr8(OHOS::HDI::Test::V1_1::ITestInterface::GetDescriptor()); + void *impl = LoadHdiImpl(desc.c_str(), serviceName == "test_interface_service" ? "service" : serviceName.c_str()); + if (impl == nullptr) { + HDF_LOGE("failed to load hdi impl %{public}s", desc.data()); + return nullptr; + } + return reinterpret_cast(impl); + } + + using namespace OHOS::HDI::ServiceManager::V1_0; + auto servMgr = IServiceManager::Get(); + if (servMgr == nullptr) { + HDF_LOGE("%{public}s:get IServiceManager failed!", __func__); + return nullptr; + } + + sptr remote = servMgr->GetService(serviceName.c_str()); + if (remote == nullptr) { + HDF_LOGE("%{public}s:get remote object failed!", __func__); + return nullptr; + } + + sptr proxy = OHOS::HDI::hdi_facecast(remote); + if (proxy == nullptr) { + HDF_LOGE("%{public}s:iface_cast failed!", __func__); + return nullptr; + } + + uint32_t serMajorVer = 0; + uint32_t serMinorVer = 0; + int32_t testInterfaceRet = proxy->GetVersion(serMajorVer, serMinorVer); + if (testInterfaceRet != HDF_SUCCESS) { + HDF_LOGE("%{public}s:get version failed!", __func__); + return nullptr; + } + + if (serMajorVer != 1) { + HDF_LOGE("%{public}s:check version failed! version of service:%u.%u, version of client:1.1", __func__, serMajorVer, serMinorVer); + return nullptr; + } + + return proxy; +} + + +template +static bool WritePodArray(MessageParcel &parcel, const std::vector &data) +{ + if (!parcel.WriteUint32(data.size())) { + HDF_LOGE("%{public}s: failed to write data size", __func__); + return false; + } + if (data.empty()) { + return true; + } + if (!parcel.WriteUnpadBuffer((const void*)data.data(), sizeof(ElementType) * data.size())) { + HDF_LOGE("%{public}s: failed to write array", __func__); + return false; + } + return true; +} +int32_t OHOS::HDI::Test::V1_1::TestInterfaceProxy::SetTestConfig(int32_t testType, const std::vector& data) +{ + return OHOS::HDI::Test::V1_1::TestInterfaceProxy::SetTestConfig_(testType, data, Remote()); +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceProxy::StructVersionTest(int32_t testType, const std::vector& data, + const OHOS::HDI::Test::V1_1::WaveParam& testWPIn, OHOS::HDI::Test::V1_0::WaveParam& testWPOut, const WaveParam& testWPNoVersion) +{ + return OHOS::HDI::Test::V1_1::TestInterfaceProxy::StructVersionTest_(testType, data, testWPIn, testWPOut, testWPNoVersion, Remote()); +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceProxy::TestUnregister(const sptr& callbackObj) +{ + return OHOS::HDI::Test::V1_1::TestInterfaceProxy::TestUnregister_(callbackObj, Remote()); +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceProxy::EnableTest(int32_t testType) +{ + return OHOS::HDI::Test::V1_0::TestInterfaceProxy::EnableTest_(testType, Remote()); +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceProxy::DisableTest(int32_t testType) +{ + return OHOS::HDI::Test::V1_0::TestInterfaceProxy::DisableTest_(testType, Remote()); +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceProxy::Register(const sptr& callbackObj) +{ + return OHOS::HDI::Test::V1_0::TestInterfaceProxy::Register_(callbackObj, Remote()); +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceProxy::Unregister(const sptr& callbackObj) +{ + return OHOS::HDI::Test::V1_0::TestInterfaceProxy::Unregister_(callbackObj, Remote()); +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceProxy::GetVersion(uint32_t& majorVer, uint32_t& minorVer) +{ + return OHOS::HDI::Test::V1_0::TestInterfaceProxy::GetVersion_(majorVer, minorVer, Remote()); +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceProxy::SetTestConfig_(int32_t testType, const std::vector& data, + const sptr remote) +{ + MessageParcel testInterfaceData; + MessageParcel testInterfaceReply; + MessageOption testInterfaceOption(MessageOption::TF_SYNC); + + if (!testInterfaceData.WriteInterfaceToken(OHOS::HDI::Test::V1_1::ITestInterface::GetDescriptor())) { + HDF_LOGE("%{public}s: failed to write interface descriptor!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (!testInterfaceData.WriteInt32(testType)) { + HDF_LOGE("%{public}s: write testType failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (!WritePodArray(testInterfaceData, data)) { + HDF_LOGE("%{public}s: failed to write data", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (remote == nullptr) { + HDF_LOGE("%{public}s: invalid remote object!", __func__); + return HDF_ERR_INVALID_OBJECT; + } + + int32_t testInterfaceRet = remote->SendRequest(CMD_TEST_INTERFACE_SET_TEST_CONFIG, testInterfaceData, testInterfaceReply, testInterfaceOption); + if (testInterfaceRet != HDF_SUCCESS) { + HDF_LOGE("%{public}s failed, error code is %{public}d", __func__, testInterfaceRet); + return testInterfaceRet; + } + + return testInterfaceRet; +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceProxy::StructVersionTest_(int32_t testType, + const std::vector& data, const OHOS::HDI::Test::V1_1::WaveParam& testWPIn, OHOS::HDI::Test::V1_0::WaveParam& testWPOut, const WaveParam& testWPNoVersion, const sptr remote) +{ + MessageParcel testInterfaceData; + MessageParcel testInterfaceReply; + MessageOption testInterfaceOption(MessageOption::TF_SYNC); + + if (!testInterfaceData.WriteInterfaceToken(OHOS::HDI::Test::V1_1::ITestInterface::GetDescriptor())) { + HDF_LOGE("%{public}s: failed to write interface descriptor!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (!testInterfaceData.WriteInt32(testType)) { + HDF_LOGE("%{public}s: write testType failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (!WritePodArray(testInterfaceData, data)) { + HDF_LOGE("%{public}s: failed to write data", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (!WaveParamBlockMarshalling(testInterfaceData, testWPIn)) { + HDF_LOGE("%{public}s: write testWPIn failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (!WaveParamBlockMarshalling(testInterfaceData, testWPNoVersion)) { + HDF_LOGE("%{public}s: write testWPNoVersion failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (remote == nullptr) { + HDF_LOGE("%{public}s: invalid remote object!", __func__); + return HDF_ERR_INVALID_OBJECT; + } + + int32_t testInterfaceRet = remote->SendRequest(CMD_TEST_INTERFACE_STRUCT_VERSION_TEST, testInterfaceData, testInterfaceReply, testInterfaceOption); + if (testInterfaceRet != HDF_SUCCESS) { + HDF_LOGE("%{public}s failed, error code is %{public}d", __func__, testInterfaceRet); + return testInterfaceRet; + } + + if (!WaveParamBlockUnmarshalling(testInterfaceReply, testWPOut)) { + HDF_LOGE("%{public}s: read testWPOut failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + return testInterfaceRet; +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceProxy::TestUnregister_(const sptr& callbackObj, const sptr remote) +{ + MessageParcel testInterfaceData; + MessageParcel testInterfaceReply; + MessageOption testInterfaceOption(MessageOption::TF_SYNC); + + if (!testInterfaceData.WriteInterfaceToken(OHOS::HDI::Test::V1_1::ITestInterface::GetDescriptor())) { + HDF_LOGE("%{public}s: failed to write interface descriptor!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (callbackObj == nullptr) { + HDF_LOGE("%{public}s: parameter callbackObj is nullptr!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (!testInterfaceData.WriteRemoteObject(OHOS::HDI::ObjectCollector::GetInstance().GetOrNewObject(callbackObj, OHOS::HDI::Test::V1_0::ITestCallback::GetDescriptor()))) { + HDF_LOGE("%{public}s: write callbackObj failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (remote == nullptr) { + HDF_LOGE("%{public}s: invalid remote object!", __func__); + return HDF_ERR_INVALID_OBJECT; + } + + int32_t testInterfaceRet = remote->SendRequest(CMD_TEST_INTERFACE_TEST_UNREGISTER, testInterfaceData, testInterfaceReply, testInterfaceOption); + if (testInterfaceRet != HDF_SUCCESS) { + HDF_LOGE("%{public}s failed, error code is %{public}d", __func__, testInterfaceRet); + return testInterfaceRet; + } + + return testInterfaceRet; +} + +} // V1_1 +} // Test +} // HDI +} // OHOS diff --git a/framework/tools/hdi-gen/out/test/v1_1/test_interface_proxy.h b/framework/tools/hdi-gen/out/test/v1_1/test_interface_proxy.h new file mode 100644 index 0000000000000000000000000000000000000000..e395ba9c595d93b884400e5dd865697f7c8777f9 --- /dev/null +++ b/framework/tools/hdi-gen/out/test/v1_1/test_interface_proxy.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_HDI_TEST_V1_1_TESTINTERFACEPROXY_H +#define OHOS_HDI_TEST_V1_1_TESTINTERFACEPROXY_H + +#include "v1_0/test_interface_proxy.h" +#include "v1_1/itest_interface.h" +#include + +namespace OHOS { +namespace HDI { +namespace Test { +namespace V1_1 { + +class TestInterfaceProxy : public IProxyBroker { +public: + explicit TestInterfaceProxy(const sptr& remote) : IProxyBroker(remote) {} + + virtual ~TestInterfaceProxy() = default; + + int32_t SetTestConfig(int32_t testType, const std::vector& data) override; + + int32_t StructVersionTest(int32_t testType, const std::vector& data, + const OHOS::HDI::Test::V1_1::WaveParam& testWPIn, OHOS::HDI::Test::V1_0::WaveParam& testWPOut, const WaveParam& testWPNoVersion) override; + + int32_t TestUnregister(const sptr& callbackObj) override; + + int32_t EnableTest(int32_t testType) override; + + int32_t DisableTest(int32_t testType) override; + + int32_t Register(const sptr& callbackObj) override; + + int32_t Unregister(const sptr& callbackObj) override; + + int32_t GetVersion(uint32_t& majorVer, uint32_t& minorVer) override; + + static int32_t SetTestConfig_(int32_t testType, const std::vector& data, const sptr remote); + + static int32_t StructVersionTest_(int32_t testType, const std::vector& data, + const OHOS::HDI::Test::V1_1::WaveParam& testWPIn, OHOS::HDI::Test::V1_0::WaveParam& testWPOut, const WaveParam& testWPNoVersion, const sptr remote); + + static int32_t TestUnregister_(const sptr& callbackObj, + const sptr remote); + +private: + static inline BrokerDelegator delegator_; +}; + +} // V1_1 +} // Test +} // HDI +} // OHOS + +#endif // OHOS_HDI_TEST_V1_1_TESTINTERFACEPROXY_H \ No newline at end of file diff --git a/framework/tools/hdi-gen/out/test/v1_1/test_interface_service.cpp b/framework/tools/hdi-gen/out/test/v1_1/test_interface_service.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c7b5fa961f597d9262b381ac7e3f79439648eeaa --- /dev/null +++ b/framework/tools/hdi-gen/out/test/v1_1/test_interface_service.cpp @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "v1_1/test_interface_service.h" +#include + +#define HDF_LOG_TAG test_interface_service + +namespace OHOS { +namespace HDI { +namespace Test { +namespace V1_1 { +extern "C" ITestInterface *TestInterfaceImplGetInstance(void) +{ + return new (std::nothrow) TestInterfaceService(); +} + +int32_t TestInterfaceService::SetTestConfig(int32_t testType, const std::vector& data) +{ + return HDF_SUCCESS; +} + +int32_t TestInterfaceService::StructVersionTest(int32_t testType, const std::vector& data, + const OHOS::HDI::Test::V1_1::WaveParam& testWPIn, OHOS::HDI::Test::V1_0::WaveParam& testWPOut, const WaveParam& testWPNoVersion) +{ + return HDF_SUCCESS; +} + +int32_t TestInterfaceService::TestUnregister(const sptr& callbackObj) +{ + return HDF_SUCCESS; +} + +int32_t TestInterfaceService::EnableTest(int32_t testType) +{ + return HDF_SUCCESS; +} + +int32_t TestInterfaceService::DisableTest(int32_t testType) +{ + return HDF_SUCCESS; +} + +int32_t TestInterfaceService::Register(const sptr& callbackObj) +{ + return HDF_SUCCESS; +} + +int32_t TestInterfaceService::Unregister(const sptr& callbackObj) +{ + return HDF_SUCCESS; +} + +} // V1_1 +} // Test +} // HDI +} // OHOS diff --git a/framework/tools/hdi-gen/out/test/v1_1/test_interface_service.h b/framework/tools/hdi-gen/out/test/v1_1/test_interface_service.h new file mode 100644 index 0000000000000000000000000000000000000000..d2c067ee764210704d6604b80e8be40cd939dc56 --- /dev/null +++ b/framework/tools/hdi-gen/out/test/v1_1/test_interface_service.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_HDI_TEST_V1_1_TESTINTERFACESERVICE_H +#define OHOS_HDI_TEST_V1_1_TESTINTERFACESERVICE_H + +#include "v1_1/itest_interface.h" + +namespace OHOS { +namespace HDI { +namespace Test { +namespace V1_1 { +class TestInterfaceService : public OHOS::HDI::Test::V1_1::ITestInterface { +public: + TestInterfaceService() = default; + virtual ~TestInterfaceService() = default; + + int32_t SetTestConfig(int32_t testType, const std::vector& data) override; + + int32_t StructVersionTest(int32_t testType, const std::vector& data, + const OHOS::HDI::Test::V1_1::WaveParam& testWPIn, OHOS::HDI::Test::V1_0::WaveParam& testWPOut, const WaveParam& testWPNoVersion) override; + + int32_t TestUnregister(const sptr& callbackObj) override; + + int32_t EnableTest(int32_t testType) override; + + int32_t DisableTest(int32_t testType) override; + + int32_t Register(const sptr& callbackObj) override; + + int32_t Unregister(const sptr& callbackObj) override; + +}; +} // V1_1 +} // Test +} // HDI +} // OHOS + +#endif // OHOS_HDI_TEST_V1_1_TESTINTERFACESERVICE_H \ No newline at end of file diff --git a/framework/tools/hdi-gen/out/test/v1_1/test_interface_stub.cpp b/framework/tools/hdi-gen/out/test/v1_1/test_interface_stub.cpp new file mode 100644 index 0000000000000000000000000000000000000000..be3c808a2381e88f8093787d392fb969142bf142 --- /dev/null +++ b/framework/tools/hdi-gen/out/test/v1_1/test_interface_stub.cpp @@ -0,0 +1,285 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "v1_1/test_interface_stub.h" +#include +#include +#include +#include +#include +#include + +#define HDF_LOG_TAG test_interface_stub + +namespace OHOS { +namespace HDI { +namespace Test { +namespace V1_1 { +template +static bool ReadInterface(MessageParcel &parcel, sptr& object); +template +static bool ReadPodArray(MessageParcel &parcel, std::vector &data); + + +template +static bool ReadInterface(MessageParcel &parcel, sptr& object) +{ + sptr remote = parcel.ReadRemoteObject(); + if (remote == nullptr) { + HDF_LOGE("%{public}s: read an invalid remote object", __func__); + return false; + } + + object = hdi_facecast(remote); + if (object == nullptr) { + HDF_LOGE("%{public}s: failed to cast interface object", __func__); + return false; + } + return true; +} + +template +static bool ReadPodArray(MessageParcel &parcel, std::vector &data) +{ + data.clear(); + uint32_t size = 0; + if (!parcel.ReadUint32(size)) { + HDF_LOGE("%{public}s: failed to read size", __func__); + return false; + } + + if (size == 0) { + return true; + } + const ElementType *dataPtr = reinterpret_cast(parcel.ReadUnpadBuffer(sizeof(ElementType) * size)); + if (dataPtr == nullptr) { + HDF_LOGI("%{public}s: failed to read data", __func__); + return false; + } + data.assign(dataPtr, dataPtr + size); + return true; +} + +sptr OHOS::HDI::Test::V1_1::ITestInterface::Get(bool isStub) +{ + return OHOS::HDI::Test::V1_1::ITestInterface::Get("test_interface_service", isStub); +} + +sptr OHOS::HDI::Test::V1_1::ITestInterface::Get(const std::string& serviceName, bool isStub) +{ + if (!isStub) { + return nullptr; + } + std::string desc = Str16ToStr8(OHOS::HDI::Test::V1_1::ITestInterface::GetDescriptor()); + void *impl = LoadHdiImpl(desc.c_str(), serviceName == "test_interface_service" ? "service" : serviceName.c_str()); + if (impl == nullptr) { + HDF_LOGE("failed to load hdi impl %{public}s", desc.c_str()); + return nullptr; + } + return reinterpret_cast(impl); +} + + +OHOS::HDI::Test::V1_1::TestInterfaceStub::TestInterfaceStub(const sptr &impl) + : IPCObjectStub(OHOS::HDI::Test::V1_1::ITestInterface::GetDescriptor()), impl_(impl) +{ +} + +OHOS::HDI::Test::V1_1::TestInterfaceStub::~TestInterfaceStub() +{ + ObjectCollector::GetInstance().RemoveObject(impl_); +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceStub::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) +{ + switch (code) { + case CMD_TEST_INTERFACE_GET_VERSION: + return TestInterfaceStubGetVersion(data, reply, option); + case CMD_TEST_INTERFACE_SET_TEST_CONFIG: + return TestInterfaceStubSetTestConfig(data, reply, option); + case CMD_TEST_INTERFACE_STRUCT_VERSION_TEST: + return TestInterfaceStubStructVersionTest(data, reply, option); + case CMD_TEST_INTERFACE_TEST_UNREGISTER: + return TestInterfaceStubTestUnregister(data, reply, option); + case CMD_TEST_INTERFACE_ENABLE_TEST: + return TestInterfaceStubEnableTest(data, reply, option); + case CMD_TEST_INTERFACE_DISABLE_TEST: + return TestInterfaceStubDisableTest(data, reply, option); + case CMD_TEST_INTERFACE_REGISTER: + return TestInterfaceStubRegister(data, reply, option); + case CMD_TEST_INTERFACE_UNREGISTER: + return TestInterfaceStubUnregister(data, reply, option); + default: { + HDF_LOGE("%{public}s: cmd %{public}d is not supported", __func__, code); + return IPCObjectStub::OnRemoteRequest(code, data, reply, option); + } + } +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceStub::TestInterfaceStubSetTestConfig(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption) +{ + return OHOS::HDI::Test::V1_1::TestInterfaceStub::TestInterfaceStubSetTestConfig_(testInterfaceData, testInterfaceReply, testInterfaceOption, impl_); +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceStub::TestInterfaceStubStructVersionTest(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption) +{ + return OHOS::HDI::Test::V1_1::TestInterfaceStub::TestInterfaceStubStructVersionTest_(testInterfaceData, testInterfaceReply, testInterfaceOption, impl_); +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceStub::TestInterfaceStubTestUnregister(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption) +{ + return OHOS::HDI::Test::V1_1::TestInterfaceStub::TestInterfaceStubTestUnregister_(testInterfaceData, testInterfaceReply, testInterfaceOption, impl_); +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceStub::TestInterfaceStubEnableTest(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption) +{ + return OHOS::HDI::Test::V1_0::TestInterfaceStub::TestInterfaceStubEnableTest_(testInterfaceData, testInterfaceReply, testInterfaceOption, impl_); +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceStub::TestInterfaceStubDisableTest(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption) +{ + return OHOS::HDI::Test::V1_0::TestInterfaceStub::TestInterfaceStubDisableTest_(testInterfaceData, testInterfaceReply, testInterfaceOption, impl_); +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceStub::TestInterfaceStubRegister(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption) +{ + return OHOS::HDI::Test::V1_0::TestInterfaceStub::TestInterfaceStubRegister_(testInterfaceData, testInterfaceReply, testInterfaceOption, impl_); +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceStub::TestInterfaceStubUnregister(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption) +{ + return OHOS::HDI::Test::V1_0::TestInterfaceStub::TestInterfaceStubUnregister_(testInterfaceData, testInterfaceReply, testInterfaceOption, impl_); +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceStub::TestInterfaceStubGetVersion(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption) +{ + return OHOS::HDI::Test::V1_0::TestInterfaceStub::TestInterfaceStubGetVersion_(testInterfaceData, testInterfaceReply, testInterfaceOption, impl_); +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceStub::TestInterfaceStubSetTestConfig_(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption, sptr impl) +{ + if (testInterfaceData.ReadInterfaceToken() != OHOS::HDI::Test::V1_1::ITestInterface::GetDescriptor()) { + HDF_LOGE("%{public}s: interface token check failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + int32_t testType = 0; + if (!testInterfaceData.ReadInt32(testType)) { + HDF_LOGE("%{public}s: read testType failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + std::vector data; + if (!ReadPodArray(testInterfaceData, data)) { + HDF_LOGE("%{public}s: failed to read data", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (impl == nullptr) { + HDF_LOGE("%{public}s: impl is nullptr!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + int32_t testInterfaceRet = impl->SetTestConfig(testType, data); + if (testInterfaceRet != HDF_SUCCESS) { + HDF_LOGE("%{public}s failed, error code is %{public}d", __func__, testInterfaceRet); + return testInterfaceRet; + } + + return testInterfaceRet; +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceStub::TestInterfaceStubStructVersionTest_(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption, sptr impl) +{ + if (testInterfaceData.ReadInterfaceToken() != OHOS::HDI::Test::V1_1::ITestInterface::GetDescriptor()) { + HDF_LOGE("%{public}s: interface token check failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + int32_t testType = 0; + if (!testInterfaceData.ReadInt32(testType)) { + HDF_LOGE("%{public}s: read testType failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + std::vector data; + if (!ReadPodArray(testInterfaceData, data)) { + HDF_LOGE("%{public}s: failed to read data", __func__); + return HDF_ERR_INVALID_PARAM; + } + + WaveParam testWPIn; + if (!WaveParamBlockUnmarshalling(testInterfaceData, testWPIn)) { + HDF_LOGE("%{public}s: read testWPIn failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + WaveParam testWPOut; + + WaveParam testWPNoVersion; + if (!WaveParamBlockUnmarshalling(testInterfaceData, testWPNoVersion)) { + HDF_LOGE("%{public}s: read testWPNoVersion failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (impl == nullptr) { + HDF_LOGE("%{public}s: impl is nullptr!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + int32_t testInterfaceRet = impl->StructVersionTest(testType, data, testWPIn, testWPOut, testWPNoVersion); + if (testInterfaceRet != HDF_SUCCESS) { + HDF_LOGE("%{public}s failed, error code is %{public}d", __func__, testInterfaceRet); + return testInterfaceRet; + } + + if (!WaveParamBlockMarshalling(testInterfaceReply, testWPOut)) { + HDF_LOGE("%{public}s: write testWPOut failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + return testInterfaceRet; +} + +int32_t OHOS::HDI::Test::V1_1::TestInterfaceStub::TestInterfaceStubTestUnregister_(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption, sptr impl) +{ + if (testInterfaceData.ReadInterfaceToken() != OHOS::HDI::Test::V1_1::ITestInterface::GetDescriptor()) { + HDF_LOGE("%{public}s: interface token check failed!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + sptr callbackObj; + if (!ReadInterface(testInterfaceData, callbackObj)) { + HDF_LOGE("%{public}s: failed to read interface object", __func__); + return HDF_ERR_INVALID_PARAM; + } + + if (impl == nullptr) { + HDF_LOGE("%{public}s: impl is nullptr!", __func__); + return HDF_ERR_INVALID_PARAM; + } + + int32_t testInterfaceRet = impl->TestUnregister(callbackObj); + if (testInterfaceRet != HDF_SUCCESS) { + HDF_LOGE("%{public}s failed, error code is %{public}d", __func__, testInterfaceRet); + return testInterfaceRet; + } + + return testInterfaceRet; +} +} // V1_1 +} // Test +} // HDI +} // OHOS diff --git a/framework/tools/hdi-gen/out/test/v1_1/test_interface_stub.h b/framework/tools/hdi-gen/out/test/v1_1/test_interface_stub.h new file mode 100644 index 0000000000000000000000000000000000000000..5869da6b77189afa7192f8282205c594ad0fcaa9 --- /dev/null +++ b/framework/tools/hdi-gen/out/test/v1_1/test_interface_stub.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_HDI_TEST_V1_1_TESTINTERFACESTUB_H +#define OHOS_HDI_TEST_V1_1_TESTINTERFACESTUB_H + +#include +#include +#include +#include +#include +#include "v1_0/test_interface_stub.h" +#include "v1_1/itest_interface.h" + +namespace OHOS { +namespace HDI { +namespace Test { +namespace V1_1 { + +using namespace OHOS; +class TestInterfaceStub : public IPCObjectStub { +public: + explicit TestInterfaceStub(const sptr &impl); + virtual ~TestInterfaceStub(); + + int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; + + static int32_t TestInterfaceStubSetTestConfig_(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption, sptr impl); + + static int32_t TestInterfaceStubStructVersionTest_(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption, sptr impl); + + static int32_t TestInterfaceStubTestUnregister_(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption, sptr impl); + +private: + int32_t TestInterfaceStubSetTestConfig(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption); + + int32_t TestInterfaceStubStructVersionTest(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption); + + int32_t TestInterfaceStubTestUnregister(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption); + + int32_t TestInterfaceStubEnableTest(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption); + + int32_t TestInterfaceStubDisableTest(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption); + + int32_t TestInterfaceStubRegister(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption); + + int32_t TestInterfaceStubUnregister(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption); + + int32_t TestInterfaceStubGetVersion(MessageParcel& testInterfaceData, MessageParcel& testInterfaceReply, MessageOption& testInterfaceOption); + + + static inline ObjectDelegator objDelegator_; + sptr impl_; +}; +} // V1_1 +} // Test +} // HDI +} // OHOS + +#endif // OHOS_HDI_TEST_V1_1_TESTINTERFACESTUB_H \ No newline at end of file diff --git a/framework/tools/hdi-gen/out/test/v1_1/test_types.cpp b/framework/tools/hdi-gen/out/test/v1_1/test_types.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b76c655facc4a899442e5e3814e6da94d7111ac6 --- /dev/null +++ b/framework/tools/hdi-gen/out/test/v1_1/test_types.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "v1_1/test_types.h" +#include +#include +#include + +namespace OHOS { +namespace HDI { +namespace Test { +namespace V1_1 { + + + +bool WaveParamBlockMarshalling(OHOS::MessageParcel& data, const WaveParam& dataBlock) +{ + if (!data.WriteUnpadBuffer((const void*)&dataBlock, sizeof(WaveParam))) { + return false; + } + return true; +} + +bool WaveParamBlockUnmarshalling(OHOS::MessageParcel& data, WaveParam& dataBlock) +{ + const WaveParam *dataBlockPtr = reinterpret_cast(data.ReadUnpadBuffer(sizeof(WaveParam))); + if (dataBlockPtr == NULL) { + return false; + } + + if (memcpy_s(&dataBlock, sizeof(WaveParam), dataBlockPtr, sizeof(WaveParam)) != EOK) { + return false; + } + return true; +} + +} // V1_1 +} // Test +} // HDI +} // OHOS diff --git a/framework/tools/hdi-gen/out/test/v1_1/test_types.h b/framework/tools/hdi-gen/out/test/v1_1/test_types.h new file mode 100644 index 0000000000000000000000000000000000000000..7a0bb397a3f727997cf3005a2264716608a3a74a --- /dev/null +++ b/framework/tools/hdi-gen/out/test/v1_1/test_types.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_HDI_TEST_V1_1_TESTTYPES_H +#define OHOS_HDI_TEST_V1_1_TESTTYPES_H + +#include +#include +#include "test/v1_0/test_types.h" + +#ifndef HDI_BUFF_MAX_SIZE +#define HDI_BUFF_MAX_SIZE (1024 * 200) +#endif + +#ifndef HDI_CHECK_VALUE_RETURN +#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ + if ((lv) compare (rv)) { \ + return ret; \ + } \ +} while (false) +#endif + +#ifndef HDI_CHECK_VALUE_RET_GOTO +#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ + if ((lv) compare (rv)) { \ + ret = value; \ + goto table; \ + } \ +} while (false) +#endif + +namespace OHOS { +class MessageParcel; +} + +namespace OHOS { +namespace HDI { +namespace Test { +namespace V1_1 { + +using namespace OHOS; +using namespace OHOS::HDI::Test::V1_0; + +struct WaveParam { + int32_t waveFrequency; + int32_t waveAmplitude; + bool isUseGyroscope; +} __attribute__ ((aligned(8))); + +bool WaveParamBlockMarshalling(OHOS::MessageParcel &data, const WaveParam& dataBlock); + +bool WaveParamBlockUnmarshalling(OHOS::MessageParcel &data, WaveParam& dataBlock); + +} // V1_1 +} // Test +} // HDI +} // OHOS + +#endif // OHOS_HDI_TEST_V1_1_TESTTYPES_H \ No newline at end of file diff --git a/framework/tools/hdi-gen/parser/parser.cpp b/framework/tools/hdi-gen/parser/parser.cpp index 396686972d9263b648b4d50c437878633642ded4..bd3326ea2c54e60d7d59fb1a0d8edabfc452b381 100644 --- a/framework/tools/hdi-gen/parser/parser.cpp +++ b/framework/tools/hdi-gen/parser/parser.cpp @@ -20,6 +20,7 @@ #include "ast/ast_union_type.h" #include "util/logger.h" #include "util/string_builder.h" +#include "util/string_helper.h" #define RE_BIN_DIGIT "0[b][0|1]+" // binary digit #define RE_OCT_DIGIT "0[0-7]+" // octal digit @@ -684,6 +685,7 @@ void Parser::ParseMethodParamList(const AutoPtr &method) AutoPtr Parser::ParseParam() { AutoPtr paramAttr = ParseParamAttr(); + SetIdentifiedVersion(false); AutoPtr paramType = ParseType(); std::string paramName = ""; @@ -709,7 +711,7 @@ AutoPtr Parser::ParseParam() } } - return new ASTParameter(paramName, paramAttr, paramType); + return new ASTParameter(paramName, paramAttr, paramType, GetIdentifiedVersion()); } AutoPtr Parser::ParseParamAttr() @@ -977,6 +979,9 @@ AutoPtr Parser::ParseUserDefType() LogError(token, StringHelper::Format("expected identifier before '%s' token", token.value.c_str())); return nullptr; } else { + if (StringHelper::GetVersionName(token.value) != StringHelper::STRING_HELPER_NULL_STRING) { + SetIdentifiedVersion(true); + } lexer_.GetToken(); } diff --git a/framework/tools/hdi-gen/parser/parser.h b/framework/tools/hdi-gen/parser/parser.h index aac32b37e1d3920194d4b83bdacb54bbc916a29e..e3dafd62eeec730bde4100584406a5f268f85804 100644 --- a/framework/tools/hdi-gen/parser/parser.h +++ b/framework/tools/hdi-gen/parser/parser.h @@ -239,10 +239,22 @@ private: void ModifyInterfaceNamespace(AutoPtr &ns); + inline void SetIdentifiedVersion(const bool &isIdentifiedVersion) + { + g_isIdentifiedVersion_ = isIdentifiedVersion; + } + + inline bool GetIdentifiedVersion() + { + return g_isIdentifiedVersion_; + } + Lexer lexer_; std::vector errors_; AutoPtr ast_; StrAstMap allAsts_; + + bool g_isIdentifiedVersion_; }; } // namespace HDI } // namespace OHOS