Add file sharing grammar for the C# language 96/235396/3
authorhyunho <hhstark.kang@samsung.com>
Thu, 4 Jun 2020 08:01:02 +0000 (17:01 +0900)
committerhyunho <hhstark.kang@samsung.com>
Thu, 4 Jun 2020 10:02:42 +0000 (19:02 +0900)
Change-Id: Iaaea53bb6e8ccad8c43de8567d863713d3c451e4
Signed-off-by: hyunho <hhstark.kang@samsung.com>
idlc/gen/cs_gen_base.cc
idlc/gen/cs_proxy_gen.cc
idlc/gen/cs_proxy_gen_cb.h

index bb1e5bb..4266ba3 100644 (file)
@@ -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"}
   };
 }
 
index 280decd..9bcece4 100644 (file)
@@ -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;
index a9f51ff..f1e4743 100644 (file)
@@ -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[] =