diff options
author | Steven Moreland <smoreland@google.com> | 2018-08-16 14:59:28 -0700 |
---|---|---|
committer | Steven Moreland <smoreland@google.com> | 2018-08-20 18:33:52 -0700 |
commit | 860b194607f79c1089477fa1682f79c20de8e558 (patch) | |
tree | 569009e8a9f375a2cbd6b2f7608a2b35a6b0a463 /aidl_to_cpp.cpp | |
parent | 3f658cf84ee06b6d33349c89261d0f72a40bb756 (diff) | |
download | aidl-860b194607f79c1089477fa1682f79c20de8e558.tar.gz |
Defaults for List in structured parcelables.
parcelable MyFoo {
String[] a = {"a", "b", "c"};
}
Test: runtests.sh (added tests)
Bug: 110758329
Change-Id: Iada2f2aaf620cc8b1af45f24090ffd98a617d6f9
Diffstat (limited to 'aidl_to_cpp.cpp')
-rw-r--r-- | aidl_to_cpp.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/aidl_to_cpp.cpp b/aidl_to_cpp.cpp new file mode 100644 index 00000000..2668408e --- /dev/null +++ b/aidl_to_cpp.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2018, The Android Open Source Project + * + * 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 "aidl_to_cpp.h" +#include "aidl_language.h" + +namespace android { +namespace aidl { +namespace cpp { + +std::string ConstantValueDecorator(const AidlTypeSpecifier& type, const std::string& raw_value) { + if (type.GetName() == "String" && !type.IsArray() && !type.IsUtf8InCpp()) { + return "::android::String16(" + raw_value + ")"; + } + + return raw_value; +}; + +} // namespace cpp +} // namespace aidl +} // namespace android |