From 0dc6237be665ba55d8f597a9a35bdd7194f29da3 Mon Sep 17 00:00:00 2001 From: jusung Date: Thu, 11 Nov 2021 12:59:59 +0900 Subject: [PATCH] Fix C# generator for cion - indentation - method name confilct - missing description Change-Id: I88005751dd1b29a1ef064f356ceb56d6907eeef9 Signed-off-by: jusung --- idlc/gen_cion/cs_cion_gen_base.cc | 2 +- idlc/gen_cion/cs_cion_gen_base_cb.h | 6 +++--- idlc/gen_cion/cs_cion_proxy_gen.cc | 2 +- idlc/gen_cion/cs_cion_proxy_gen_cb.h | 19 +++++++++++++------ idlc/gen_cion/cs_cion_stub_gen.cc | 4 ++-- idlc/gen_cion/cs_cion_stub_gen_cb.h | 6 +----- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/idlc/gen_cion/cs_cion_gen_base.cc b/idlc/gen_cion/cs_cion_gen_base.cc index 0b6430e..9d08f1f 100644 --- a/idlc/gen_cion/cs_cion_gen_base.cc +++ b/idlc/gen_cion/cs_cion_gen_base.cc @@ -619,7 +619,7 @@ void CsCionGeneratorBase::GenInvokeMethod(std::ofstream& stream, for (auto& i : decl.GetParameters().GetParams()) { auto& pt = i->GetParameterType(); if(HasFile(pt.GetBaseType())) - m += "_serverBase.ShareFile(" + i->GetID() + ");\n"; + m += "_serverBase.TryShareFile(" + i->GetID() + ");\n"; } return AddIndent(TAB_SIZE * 6, m); }); diff --git a/idlc/gen_cion/cs_cion_gen_base_cb.h b/idlc/gen_cion/cs_cion_gen_base_cb.h index 04a7cb5..5fd1441 100644 --- a/idlc/gen_cion/cs_cion_gen_base_cb.h +++ b/idlc/gen_cion/cs_cion_gen_base_cb.h @@ -131,19 +131,19 @@ R"__cs_cb( const char CB_SHARE_FILE_DEF[] = R"__cs_cb( - private void ShareFile(IEnumerable paths) + private void TryShareFile(IEnumerable paths) { if (paths == null) throw new ArgumentException("Invalid path"); foreach (string path in paths) { - ShareFile(path); + TryShareFile(path); } } - private void ShareFile(string path) + private void TryShareFile(string path) { if (path == null) throw new ArgumentException("Invalid path"); diff --git a/idlc/gen_cion/cs_cion_proxy_gen.cc b/idlc/gen_cion/cs_cion_proxy_gen.cc index a137bb7..f33cd7c 100644 --- a/idlc/gen_cion/cs_cion_proxy_gen.cc +++ b/idlc/gen_cion/cs_cion_proxy_gen.cc @@ -185,7 +185,7 @@ void CsCionProxyGen::GenInvocation(std::ofstream& stream, const Declaration& dec pt.GetBaseType().GetMetaType()->ToString() == "file")) { st += GenTemplateString(CB_SHARE_FILE, [&]()->std::string { std::string str = ""; - str += Tab(7) + "ShareFile(" + i->GetID() + ");"; + str += Tab(7) + "TryShareFile(" + i->GetID() + ");"; return str; }); } diff --git a/idlc/gen_cion/cs_cion_proxy_gen_cb.h b/idlc/gen_cion/cs_cion_proxy_gen_cb.h index 09f2551..f321b2c 100644 --- a/idlc/gen_cion/cs_cion_proxy_gen_cb.h +++ b/idlc/gen_cion/cs_cion_proxy_gen_cb.h @@ -33,7 +33,6 @@ R"__cs_cb( public delegate void DiscoveredEvent(object sender, PeerIn public new string ServiceName; - private static readonly string _tidlVersion = ""; private bool _online = false; private Object _lock = new Object(); private List _delegateList = new List(); @@ -43,7 +42,8 @@ const char CB_EVENT_METHODS[] = R"__cs_cb( protected override void OnConnectionResult(PeerInfo peerInfo, ConnectionResult result) { - if (result.Status == ConnectionStatus.OK) { + if (result.Status == ConnectionStatus.OK) + { _online = true; } @@ -61,11 +61,14 @@ R"__cs_cb( Discovered?.Invoke(this, peerInfo); } - protected override void OnPayloadReceived(Payload payload, PayloadTransferStatus status) + protected override void OnPayloadReceived(Payload payload, PayloadTransferStatus status) { - if(payload.PayloadType == PayloadType.FilePayload) { + if(payload.PayloadType == PayloadType.FilePayload) + { FileReceived?.Invoke(this, (FilePayload)payload, status); - } else { + } + else + { Parcel parcelReceived; try @@ -113,9 +116,13 @@ const char CB_CONNECT_METHOD[] = R"__cs_cb( /// /// Starts discovering cion servers. + /// http://tizen.org/privilege/d2d.datasharing + /// http://tizen.org/privilege/internet /// /// Thrown when the discovery operation is already in progress. - public new void TryDiscovery() { + /// Thrown when an application does not have the privilege to access this method. + public new void TryDiscovery() + { base.TryDiscovery(); } diff --git a/idlc/gen_cion/cs_cion_stub_gen.cc b/idlc/gen_cion/cs_cion_stub_gen.cc index 73b811f..aa71ab6 100644 --- a/idlc/gen_cion/cs_cion_stub_gen.cc +++ b/idlc/gen_cion/cs_cion_stub_gen.cc @@ -193,14 +193,14 @@ void CsCionStubGen::GenSyncInvocation(std::ofstream& stream, const Declaration& "param" + std::to_string(cnt), "result"); if (HasFile(pt.GetBaseType())) { - m += "ShareFile(param" + std::to_string(cnt) + ");\n\n"; + m += "TryShareFile(param" + std::to_string(cnt) + ");\n\n"; } } if (hasRet) { m += ConvertTypeToSerializer(decl.GetType(), "retVal", "result"); if (HasFile(decl.GetType())) { - m += "ShareFile(retVal);\n"; + m += "TryShareFile(retVal);\n"; } } diff --git a/idlc/gen_cion/cs_cion_stub_gen_cb.h b/idlc/gen_cion/cs_cion_stub_gen_cb.h index 0bee020..82c4b61 100644 --- a/idlc/gen_cion/cs_cion_stub_gen_cb.h +++ b/idlc/gen_cion/cs_cion_stub_gen_cb.h @@ -17,13 +17,9 @@ #ifndef IDLC_CS_CION_GEN_CS_STUB_GEN_CB_H_ #define IDLC_CS_CION_GEN_CS_STUB_GEN_CB_H_ -/** - * Version of TIDL Compiler. - */ const char CB_DATA_MEMBERS[] = R"__cs_cb( private List _services = new List(); private Type _serviceType; - private static readonly string _tidlVersion = ""; )__cs_cb"; const char CB_SERVICE_BASE_FRONT[] = @@ -252,8 +248,8 @@ R"__cs_cb( s.DisplayName = base.DisplayName; s.ConnectionRequestClient = peerInfo; s.ServerBase = this; - s.OnConnectionRequest(); _services.Add(s); + s.OnConnectionRequest(); } )__cs_cb"; -- 2.7.4