summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhyunho <hhstark.kang@samsung.com>2020-06-04 17:01:02 +0900
committerhyunho <hhstark.kang@samsung.com>2020-06-04 19:02:42 +0900
commit6b6823f7f954b9030ac2f1b2bb7a288d55560243 (patch)
treee7c82462570a889ed5e9bd6cbbdd1e76d1f44de5
parent6ce62d292e028a20a01b881e37f0401e76a1dd62 (diff)
downloadtidl-6b6823f7f954b9030ac2f1b2bb7a288d55560243.tar.gz
tidl-6b6823f7f954b9030ac2f1b2bb7a288d55560243.tar.bz2
tidl-6b6823f7f954b9030ac2f1b2bb7a288d55560243.zip
Add file sharing grammar for the C# language
Change-Id: Iaaea53bb6e8ccad8c43de8567d863713d3c451e4 Signed-off-by: hyunho <hhstark.kang@samsung.com>
-rw-r--r--idlc/gen/cs_gen_base.cc4
-rw-r--r--idlc/gen/cs_proxy_gen.cc26
-rw-r--r--idlc/gen/cs_proxy_gen_cb.h15
3 files changed, 43 insertions, 2 deletions
diff --git a/idlc/gen/cs_gen_base.cc b/idlc/gen/cs_gen_base.cc
index bb1e5bb..4266ba3 100644
--- a/idlc/gen/cs_gen_base.cc
+++ b/idlc/gen/cs_gen_base.cc
@@ -33,7 +33,8 @@ CsGeneratorBase::CsGeneratorBase(std::shared_ptr<Document> doc)
{"char", "byte"}, {"int", "int"}, {"short", "short"},
{"long", "long"}, {"string", "string"}, {"bool", "bool"},
{"list", "LinkedList"}, {"array", "List"}, {"float", "float"},
- {"double", "double"}, {"bundle", "Bundle"}, {"void", "void"}
+ {"double", "double"}, {"bundle", "Bundle"}, {"void", "void"},
+ {"file", "string"}
};
parcel_type_map_ = {
@@ -46,6 +47,7 @@ CsGeneratorBase::CsGeneratorBase(std::shared_ptr<Document> doc)
{"float", "Float"},
{"double", "Double"},
{"bundle", "Bundle"},
+ {"file", "String"}
};
}
diff --git a/idlc/gen/cs_proxy_gen.cc b/idlc/gen/cs_proxy_gen.cc
index 280decd..9bcece4 100644
--- a/idlc/gen/cs_proxy_gen.cc
+++ b/idlc/gen/cs_proxy_gen.cc
@@ -122,6 +122,32 @@ void CsProxyGen::GenInvocation(std::ofstream& stream, const Declaration& decl) {
GenTemplate(CB_INVOCATION_PRE, stream,
[&]()->std::string {
std::string st;
+ for (auto& i : decl.GetParameters().GetParams()) {
+ auto& pt = i->GetParameterType();
+ if (pt.GetDirection() == ParameterType::Direction::OUT)
+ continue;
+
+ if (pt.GetBaseType().ToString() == "file" ||
+ (pt.GetBaseType().GetMetaType() != nullptr &&
+ pt.GetBaseType().GetMetaType()->ToString() == "file")) {
+ st += GenTemplateString(CB_SHARE_FILE, [&]()->std::string {
+ std::string str = "";
+ if (pt.GetBaseType().GetMetaType() != nullptr) {
+ str += Tab(6) + "foreach (var i in myFile)" + NLine(1);
+ str += Tab(6) + "{" + NLine(1);
+ str += Tab(6) + " p.ShareFile(Port, i);" + NLine(1);
+ str += Tab(6) + "}";
+ } else {
+ str += Tab(6) + "p.ShareFile(Port, myFile);";
+ }
+ return str;
+ });
+ }
+ std::cout << "name : " << pt.GetBaseType().GetFullName() << std::endl;
+ std::cout << "name : " << pt.GetBaseType().ToString() << std::endl;
+ std::cout << "id : " << i->GetID() << std::endl;
+ }
+
st += Tab(5)
+ "p.WriteInt((int)MethodId." + decl.GetID() + ");" + NLine(1);
std::string m;
diff --git a/idlc/gen/cs_proxy_gen_cb.h b/idlc/gen/cs_proxy_gen_cb.h
index a9f51ff..f1e4743 100644
--- a/idlc/gen/cs_proxy_gen_cb.h
+++ b/idlc/gen/cs_proxy_gen_cb.h
@@ -148,7 +148,20 @@ R"__cs_cb( if (!_online)
using (Parcel p = new Parcel())
{
$$
- }
+ }
+)__cs_cb";
+
+
+const char CB_SHARE_FILE[] =
+R"__cs_cb(
+ try
+ {
+$$
+ }
+ catch (InvalidIOException)
+ {
+ throw new InvalidIOException();
+ }
)__cs_cb";
const char CB_INVOCATION_MID[] =