Fix coding style 49/297249/1
authorjusung son <jusung07.son@samsung.com>
Wed, 16 Aug 2023 01:26:25 +0000 (10:26 +0900)
committerjusung son <jusung07.son@samsung.com>
Wed, 16 Aug 2023 01:26:25 +0000 (10:26 +0900)
Change-Id: I0b70c79a4af3695fbd3aac39e30c3363a771542e
Signed-off-by: jusung son <jusung07.son@samsung.com>
idlc/gen/version2/cs_generator_base.cc
idlc/gen/version2/cs_generator_base.h
idlc/gen/version2/cs_proxy_generator.cc
idlc/gen/version2/cs_stub_generator.h

index 839bf64e7bbf470b43d44971520917c0ea64637d..3d72736806035a7ad8db989204c4f5b58b79b589 100644 (file)
@@ -30,11 +30,12 @@ namespace version2 {
 
 CsGeneratorBase::CsGeneratorBase(std::shared_ptr<Document> doc)
     : Generator(doc) {
-  type_map_ = {{"char", "byte"},       {"int", "int"},       {"short", "short"},
-               {"long", "long"},       {"string", "string"}, {"bool", "bool"},
-               {"list", "LinkedList"}, {"array", "List"},    {"float", "float"},
-               {"double", "double"},   {"bundle", "Bundle"}, {"void", "void"},
-               {"file", "string"} ,    {"set", "HashSet"},   {"map", "Dictionary"}};
+  type_map_ = {
+      {"char", "byte"},       {"int", "int"},       {"short", "short"},
+      {"long", "long"},       {"string", "string"}, {"bool", "bool"},
+      {"list", "LinkedList"}, {"array", "List"},    {"float", "float"},
+      {"double", "double"},   {"bundle", "Bundle"}, {"void", "void"},
+      {"file", "string"},     {"set", "HashSet"},   {"map", "Dictionary"}};
 
   parcel_type_map_ = {{"char", "Byte"},     {"int", "Int"},
                       {"short", "Short"},   {"long", "Long"},
@@ -60,13 +61,13 @@ std::string CsGeneratorBase::GenEnum(const Block& block, int tab_size) {
   std::string str;
   for (const auto& e : block.GetEnums()) {
     str += Tab(tab_size) + "public enum " + e->GetID() + " {" + NLine(1);
-     for (auto& f : e->GetFields()) {
-       if (f->GetValue().empty()) {
+    for (auto& f : e->GetFields()) {
+      if (f->GetValue().empty()) {
         str += Tab(tab_size + 1) + f->GetID() + "," + NLine(1);
-       } else {
-        str += Tab(tab_size + 1) +  f->GetID() + " = " +
-                  f->GetValue() + "," + NLine(1);
-       }
+      } else {
+        str += Tab(tab_size + 1) + f->GetID() + " = " + f->GetValue() + "," +
+               NLine(1);
+      }
     }
     str += Tab(tab_size) + "}" + NLine(1);
   }
@@ -74,7 +75,7 @@ std::string CsGeneratorBase::GenEnum(const Block& block, int tab_size) {
 }
 
 void CsGeneratorBase::GenEnum(std::ofstream& stream, const Block& block,
-    int tab_size) {
+                              int tab_size) {
   stream << GenEnum(block, tab_size);
 }
 
@@ -93,7 +94,7 @@ void CsGeneratorBase::GenStructure(std::ofstream& stream, const Structure& st) {
           i->GetType().ToString() == "map" ||
           i->GetType().ToString() == "set") {
         v.push_back(i->GetID() + " = " + "new " +
-            ConvertTypeToString(i->GetType()) + "()");
+                    ConvertTypeToString(i->GetType()) + "()");
       }
     }
 
@@ -115,7 +116,6 @@ void CsGeneratorBase::GenSerializer(std::ofstream& stream,
 }
 
 std::string CsGeneratorBase::GetSerializer(const Structure& st) {
-
   std::string str(ReplaceAll(CB_SERIALIZER)
                       .Change("<TYPE>", st.GetID())
                       .Change("<BODY>", [&]() {
@@ -129,8 +129,8 @@ std::string CsGeneratorBase::GetSerializer(const Structure& st) {
                             type_str = GetTypeString(t);
 
                           ret += Tab(4) + "map.Write(\"" + i->GetID() +
-                                 "\", \"" +  type_str + "\"" +
-                                 ", param." + i->GetID() + ");" + NLine(1);
+                                 "\", \"" + type_str + "\"" + ", param." +
+                                 i->GetID() + ");" + NLine(1);
                         }
                         return ret;
                       }));
@@ -138,48 +138,49 @@ std::string CsGeneratorBase::GetSerializer(const Structure& st) {
   str += ReplaceAll(CB_DESERIALIZER)
              .Change("<TYPE>", st.GetID())
              .Change("<BODY>", [&]() {
-                std::string ret;
-                std::string type_str;
-                for (const auto& i : st.GetElements()) {
-                  auto& t = i->GetType();
-                  if (t.IsEnumType())
-                    type_str = "int";
-                  else
-                    type_str = GetTypeString(t);
-
-                  ret += Tab(4) + "map.Read(\"" + i->GetID() +
-                    "\", \"" + type_str +
-                    "\"" + ", out param." + i->GetID() + ");" + NLine(1);
-                }
-                return ret;
-                });
-    return str;
+               std::string ret;
+               std::string type_str;
+               for (const auto& i : st.GetElements()) {
+                 auto& t = i->GetType();
+                 if (t.IsEnumType())
+                   type_str = "int";
+                 else
+                   type_str = GetTypeString(t);
+
+                 ret += Tab(4) + "map.Read(\"" + i->GetID() + "\", \"" +
+                        type_str + "\"" + ", out param." + i->GetID() + ");" +
+                        NLine(1);
+               }
+               return ret;
+             });
+  return str;
 }
 
 void CsGeneratorBase::GenSerializer(std::ofstream& stream) {
-    stream << GetSerializer();
+  stream << GetSerializer();
 }
 
 std::string CsGeneratorBase::GetSerializer() {
-    std::string str;
-    for (auto& i : GetDocument().GetBlocks()) {
-      if (i->GetType() == Block::TYPE_STRUCTURE) {
-        const Structure& st = static_cast<const Structure&>(*i);
-        str += GetSerializer(st);
-      }
+  std::string str;
+  for (auto& i : GetDocument().GetBlocks()) {
+    if (i->GetType() == Block::TYPE_STRUCTURE) {
+      const Structure& st = static_cast<const Structure&>(*i);
+      str += GetSerializer(st);
     }
+  }
 
-    return str;
+  return str;
 }
 
 void CsGeneratorBase::AddSerializerList(const BaseType& type,
-    const std::string& st_id) {
+                                        const std::string& st_id) {
   if (type.GetMetaType() != nullptr) {
     if (type.GetMetaType()->GetUserDefinedType() == BaseType::UserType::ENUM &&
         !st_id.empty()) {
       BaseType new_type(type.ToString(), "", type.GetUserDefinedType());
-      BaseType* new_meta = new BaseType(st_id + "." +
-          type.GetMetaType()->ToString(), "", BaseType::UserType::ENUM);
+      BaseType* new_meta =
+          new BaseType(st_id + "." + type.GetMetaType()->ToString(), "",
+                       BaseType::UserType::ENUM);
       new_type.SetMetaType(new_meta);
       serializer_list_[ConvertTypeToString(type, st_id)] = new_type;
       return;
@@ -188,11 +189,12 @@ void CsGeneratorBase::AddSerializerList(const BaseType& type,
     serializer_list_[ConvertTypeToString(type, st_id)] = type;
     AddSerializerList(*type.GetMetaType(), st_id);
   } else if (type.GetKeyType() != nullptr && type.GetValueType() != nullptr) {
-    if (type.GetValueType()->IsEnumType()  && !st_id.empty()) {
+    if (type.GetValueType()->IsEnumType() && !st_id.empty()) {
       BaseType new_type(type.ToString(), "", type.GetUserDefinedType());
       BaseType* new_key = new BaseType(*(type.GetKeyType()));
-      BaseType* new_value = new BaseType(st_id + "." +
-          type.GetValueType()->ToString(), "", BaseType::UserType::ENUM);
+      BaseType* new_value =
+          new BaseType(st_id + "." + type.GetValueType()->ToString(), "",
+                       BaseType::UserType::ENUM);
 
       new_type.SetKeyType(new_key);
       new_type.SetValueType(new_value);
@@ -204,7 +206,7 @@ void CsGeneratorBase::AddSerializerList(const BaseType& type,
 }
 
 std::string CsGeneratorBase::GenListWrite(const BaseType& type,
-                                      const std::string& type_str) {
+                                          const std::string& type_str) {
   std::string ret;
   std::string type_string;
   if (type.ToString() == "map") {
@@ -213,17 +215,16 @@ std::string CsGeneratorBase::GenListWrite(const BaseType& type,
     else
       type_string = ConvertTypeToString(*type.GetValueType());
 
-    ret  = ReplaceAll(CB_LIST_MAP_WRITE)
+    ret = ReplaceAll(CB_LIST_MAP_WRITE)
               .Change("<KEY_TYPE>", ConvertTypeToString(*type.GetKeyType()))
               .Change("<VALUE_TYPE>", type_string);
   } else if (type.ToString() == "set") {
-    ret  = ReplaceAll(CB_LIST_SET_WRITE)
+    ret = ReplaceAll(CB_LIST_SET_WRITE)
               .Change("<VALUE_TYPE>", ConvertTypeToString(*type.GetMetaType()));
   } else if (type.GetMetaType()->IsEnumType()) {
-    ret  = ReplaceAll(CB_LIST_WRITE)
-              .Change("<VALUE_TYPE>", std::string("int"));
+    ret = ReplaceAll(CB_LIST_WRITE).Change("<VALUE_TYPE>", std::string("int"));
   } else {
-    ret  = ReplaceAll(CB_LIST_WRITE)
+    ret = ReplaceAll(CB_LIST_WRITE)
               .Change("<VALUE_TYPE>", ConvertTypeToString(*type.GetMetaType()));
   }
 
@@ -231,30 +232,32 @@ std::string CsGeneratorBase::GenListWrite(const BaseType& type,
 }
 
 std::string CsGeneratorBase::GenListRead(const BaseType& type,
-                                      const std::string& type_str) {
+                                         const std::string& type_str) {
   std::string ret;
 
   if (type.ToString() == "map") {
     if (type.GetValueType()->IsEnumType()) {
-      ret  = ReplaceAll(CB_LIST_MAP_READ)
-              .Change("<KEY_TYPE>", ConvertTypeToString(*type.GetKeyType()))
-              .Change("<TYPE_STRING>", std::string("int"))
-              .Change("<VALUE_TYPE>",  type.GetValueType()->ToString());
+      ret = ReplaceAll(CB_LIST_MAP_READ)
+                .Change("<KEY_TYPE>", ConvertTypeToString(*type.GetKeyType()))
+                .Change("<TYPE_STRING>", std::string("int"))
+                .Change("<VALUE_TYPE>", type.GetValueType()->ToString());
     } else {
-      ret  = ReplaceAll(CB_LIST_MAP_READ)
+      ret =
+          ReplaceAll(CB_LIST_MAP_READ)
               .Change("<KEY_TYPE>", ConvertTypeToString(*type.GetKeyType()))
               .Change("<TYPE_STRING>", ConvertTypeToString(*type.GetKeyType()))
-              .Change("<VALUE_TYPE>", ConvertTypeToString(*type.GetValueType()));
+              .Change("<VALUE_TYPE>",
+                      ConvertTypeToString(*type.GetValueType()));
     }
   } else if (type.ToString() == "set") {
-    ret  = ReplaceAll(CB_LIST_SET_READ)
+    ret = ReplaceAll(CB_LIST_SET_READ)
               .Change("<VALUE_TYPE>", ConvertTypeToString(*type.GetMetaType()));
   } else if (type.GetMetaType()->IsEnumType()) {
     std::string list_method;
     if (type.ToString() == "list")
       list_method = "Last";
 
-    ret  = ReplaceAll(CB_LIST_READ)
+    ret = ReplaceAll(CB_LIST_READ)
               .Change("<TYPE_STRING>", std::string("int"))
               .Change("<LIST_METHOD>", list_method)
               .Change("<VALUE_TYPE>", type.GetMetaType()->ToString());
@@ -263,7 +266,7 @@ std::string CsGeneratorBase::GenListRead(const BaseType& type,
     if (type.ToString() == "list")
       list_method = "Last";
 
-    ret  = ReplaceAll(CB_LIST_READ)
+    ret = ReplaceAll(CB_LIST_READ)
               .Change("<TYPE_STRING>", ConvertTypeToString(*type.GetMetaType()))
               .Change("<LIST_METHOD>", list_method)
               .Change("<VALUE_TYPE>", ConvertTypeToString(*type.GetMetaType()));
@@ -273,66 +276,66 @@ std::string CsGeneratorBase::GenListRead(const BaseType& type,
 }
 
 std::string CsGeneratorBase::GetLengthName(const BaseType& type) {
-    if (type.ToString() == "list") {
-      return "length";
-    } else {
-      return "size";
-    }
+  if (type.ToString() == "list") {
+    return "length";
+  } else {
+    return "size";
+  }
 }
 std::string CsGeneratorBase::GetListSerializer(const BaseType& type,
-                                      const std::string& type_str) {
-    std::string code;
-    code = ReplaceAll(CB_LIST_SERIALIZER)
-                      .Change("<TYPE>", type_str)
-                      .Change("<LENGTH_NAME>", GetLengthName(type))
-                      .Change("<WRITE_LIST>", GenListWrite(type, type_str));
+                                               const std::string& type_str) {
+  std::string code;
+  code = ReplaceAll(CB_LIST_SERIALIZER)
+             .Change("<TYPE>", type_str)
+             .Change("<LENGTH_NAME>", GetLengthName(type))
+             .Change("<WRITE_LIST>", GenListWrite(type, type_str));
 
-    code += ReplaceAll(CB_LIST_DESERIALIZER)
-                      .Change("<TYPE>", type_str)
-                      .Change("<LENGTH_NAME>", GetLengthName(type))
-                      .Change("<READ_LIST>", GenListRead(type, type_str));
+  code += ReplaceAll(CB_LIST_DESERIALIZER)
+              .Change("<TYPE>", type_str)
+              .Change("<LENGTH_NAME>", GetLengthName(type))
+              .Change("<READ_LIST>", GenListRead(type, type_str));
 
-    return code;
+  return code;
 }
 
 void CsGeneratorBase::GenListSerializer(std::ofstream& stream) {
-    stream << GetListSerializer();
+  stream << GetListSerializer();
 }
 
 std::string CsGeneratorBase::GetListSerializer() {
-    serializer_list_.clear();
-    for (auto& i : GetDocument().GetBlocks()) {
-      if (i->GetType() == Block::TYPE_STRUCTURE) {
-        const Structure& st = static_cast<const Structure&>(*i);
-        for (const auto& j : st.GetElements()) {
-          auto& t = j->GetType();
-          AddSerializerList(t, st.GetID());
-        }
-      } else if (i->GetType() == Block::TYPE_INTERFACE) {
-        const Interface& iface = static_cast<const Interface&>(*i);
-        for (const auto& j : iface.GetDeclarations()) {
-          auto& t = j->GetType();
-          AddSerializerList(t);
-          for (const auto& k : j->GetParameters()) {
-            auto& t1 = k->GetParameterType().GetBaseType();
-            AddSerializerList(t1);
-          }
+  serializer_list_.clear();
+  for (auto& i : GetDocument().GetBlocks()) {
+    if (i->GetType() == Block::TYPE_STRUCTURE) {
+      const Structure& st = static_cast<const Structure&>(*i);
+      for (const auto& j : st.GetElements()) {
+        auto& t = j->GetType();
+        AddSerializerList(t, st.GetID());
+      }
+    } else if (i->GetType() == Block::TYPE_INTERFACE) {
+      const Interface& iface = static_cast<const Interface&>(*i);
+      for (const auto& j : iface.GetDeclarations()) {
+        auto& t = j->GetType();
+        AddSerializerList(t);
+        for (const auto& k : j->GetParameters()) {
+          auto& t1 = k->GetParameterType().GetBaseType();
+          AddSerializerList(t1);
         }
       }
     }
+  }
 
-    std::string ret;
-    for (auto& p : serializer_list_) {
-      auto& type_str = p.first;
-      auto& t = p.second;
-      ret += GetListSerializer(t, type_str);
-    }
+  std::string ret;
+  for (auto& p : serializer_list_) {
+    auto& type_str = p.first;
+    auto& t = p.second;
+    ret += GetListSerializer(t, type_str);
+  }
 
-    return ret;
+  return ret;
 }
 
 std::string CsGeneratorBase::ConvertTypeToString(const BaseType& type,
-    const std::string& st_id) {
+                                                 const std::string& st_id) {
   if (type.GetUserDefinedType() == BaseType::UserType::ENUM && !st_id.empty()) {
     return st_id + "." + type.ToString();
   }
@@ -342,7 +345,7 @@ std::string CsGeneratorBase::ConvertTypeToString(const BaseType& type,
 
   if (type.GetMetaType() != nullptr)
     return type_map_[type.ToString()] + "<" +
-            ConvertTypeToString(*(type.GetMetaType()), st_id) + ">";
+           ConvertTypeToString(*(type.GetMetaType()), st_id) + ">";
 
   if (type.GetKeyType() != nullptr && type.GetValueType() != nullptr) {
     return type_map_[type.ToString()] + "<" +
@@ -354,49 +357,49 @@ std::string CsGeneratorBase::ConvertTypeToString(const BaseType& type,
 }
 
 std::string CsGeneratorBase::ConvertTypeToParcelType(const std::string& key) {
-    return parcel_type_map_[key];
+  return parcel_type_map_[key];
 }
 
 std::string CsGeneratorBase::ConvertTypeToDeserializer(
     const BaseType& type, std::string gen_id, std::string param_id,
     std::string map, bool make_new_type, std::string iface_id) {
-    std::string ret;
-    std::string new_type = "";
+  std::string ret;
+  std::string new_type = "";
 
-    if (make_new_type) {
-      if (type.IsUserDefinedType() || type.GetMetaType() != nullptr) {
-        if (type.GetMetaType() != nullptr)
-          new_type = ConvertTypeToString(type);
-        else
-          new_type = type.ToString();
-      } else {
+  if (make_new_type) {
+    if (type.IsUserDefinedType() || type.GetMetaType() != nullptr) {
+      if (type.GetMetaType() != nullptr)
         new_type = ConvertTypeToString(type);
-      }
+      else
+        new_type = type.ToString();
+    } else {
+      new_type = ConvertTypeToString(type);
     }
+  }
 
-    std::string type_str;
+  std::string type_str;
 
-    if (type.GetUserDefinedType() ==  BaseType::UserType::ENUM)
-      type_str = "int";
-    else
-      type_str = GetTypeString(type);
-    ret += map + ".Read(" + "\"" + param_id + "\", \"" + type_str + "\", out ";
-    if (IsDelegateType(type)) {
-      ret += "CallbackBase del_" + gen_id + ");\n";
-      ret +=
-          new_type + " " + gen_id + " = new " + new_type +
-          "(GetPort(Port.Type.Callback, instance), new WeakReference(b), del_" +
-          gen_id + ");\n";
+  if (type.GetUserDefinedType() == BaseType::UserType::ENUM)
+    type_str = "int";
+  else
+    type_str = GetTypeString(type);
+  ret += map + ".Read(" + "\"" + param_id + "\", \"" + type_str + "\", out ";
+  if (IsDelegateType(type)) {
+    ret += "CallbackBase del_" + gen_id + ");\n";
+    ret +=
+        new_type + " " + gen_id + " = new " + new_type +
+        "(GetPort(Port.Type.Callback, instance), new WeakReference(b), del_" +
+        gen_id + ");\n";
 
+  } else {
+    if (make_new_type) {
+      ret += new_type + " " + gen_id + ");\n";
     } else {
-      if (make_new_type) {
-        ret += new_type + " " + gen_id + ");\n";
-      } else {
-        ret += gen_id + ");\n";
-      }
+      ret += gen_id + ");\n";
     }
+  }
 
-    return ret;
+  return ret;
 }
 
 std::string CsGeneratorBase::ConvertTypeToSerializer(std::string gen_id,
@@ -404,138 +407,138 @@ std::string CsGeneratorBase::ConvertTypeToSerializer(std::string gen_id,
                                                      std::string param_type,
                                                      std::string map) {
   return map + ".Write(\"" + param_id + "\", \"" + param_type + "\", " +
-           gen_id + ");\n";
+         gen_id + ");\n";
 }
 
 std::string CsGeneratorBase::ConvertTypeToSerializer(std::string gen_id,
                                                      std::string param_id,
                                                      const BaseType& type,
                                                      std::string map) {
-  if (type.GetUserDefinedType() ==  BaseType::UserType::ENUM)
-    return ConvertTypeToSerializer(gen_id, param_id, "int" , map);
+  if (type.GetUserDefinedType() == BaseType::UserType::ENUM)
+    return ConvertTypeToSerializer(gen_id, param_id, "int", map);
   else
-    return ConvertTypeToSerializer(gen_id, param_id, GetTypeString(type) , map);
+    return ConvertTypeToSerializer(gen_id, param_id, GetTypeString(type), map);
 }
 
 std::string CsGeneratorBase::Tab(int cnt) {
-    std::string t;
+  std::string t;
 
-    for (int i = 0; i < cnt; i++) {
-      t += "    ";
-    }
+  for (int i = 0; i < cnt; i++) {
+    t += "    ";
+  }
 
-    return t;
+  return t;
 }
 
 std::string CsGeneratorBase::NLine(int cnt) {
-    std::string t;
+  std::string t;
 
-    for (int i = 0; i < cnt; i++) {
-      t += "\n";
-    }
+  for (int i = 0; i < cnt; i++) {
+    t += "\n";
+  }
 
-    return t;
+  return t;
 }
 
 void CsGeneratorBase::GenWriteBundle(std::ofstream& stream,
                                      const std::string& id) {
-    GenTemplate(
-        CB_WRITE_BUNDLE, stream, [&]() -> std::string { return id; },
-        [&]() -> std::string { return id; });
+  GenTemplate(
+      CB_WRITE_BUNDLE, stream, [&]() -> std::string { return id; },
+      [&]() -> std::string { return id; });
 }
 
 std::string CsGeneratorBase::GetMethodId(const Interface& iface) {
-    return std::string(ReplaceAll(CB_METHOD_IDS).Change("<METHOD_IDS>", [&]() {
-      int cnt = 2;
-      std::string str;
-      for (const auto& i : iface.GetDeclarations()) {
-        if (i->GetMethodType() == Declaration::MethodType::DELEGATE) continue;
-        str += Tab(4) + i->GetID() + " = " + std::to_string(cnt++) + "," +
-               NLine(1);
-      }
-      return str;
-    }));
+  return std::string(ReplaceAll(CB_METHOD_IDS).Change("<METHOD_IDS>", [&]() {
+    int cnt = 2;
+    std::string str;
+    for (const auto& i : iface.GetDeclarations()) {
+      if (i->GetMethodType() == Declaration::MethodType::DELEGATE) continue;
+      str +=
+          Tab(4) + i->GetID() + " = " + std::to_string(cnt++) + "," + NLine(1);
+    }
+    return str;
+  }));
 }
 
 void CsGeneratorBase::GenMethodId(std::ofstream& stream,
                                   const Interface& iface) {
-    stream << GetMethodId(iface);
+  stream << GetMethodId(iface);
 }
 
 void CsGeneratorBase::GenDelegateId(std::ofstream& stream,
                                     const Interface& iface) {
-    if (HasDelegate(iface) == false)
-      return;
+  if (HasDelegate(iface) == false)
+    return;
 
-    stream << Tab(3) << "private enum DelegateId : int" << NLine(1);
-    GenBrace(stream, TAB_SIZE * 3, [&]() {
-      int cnt = 1;
-      for (const auto& i : iface.GetDeclarations()) {
-        if (i->GetMethodType() != Declaration::MethodType::DELEGATE) continue;
-        stream << Tab(4) << i->GetID() << " = " << cnt++ << "," << NLine(1);
-      }
-    });
-    stream << NLine(1);
+  stream << Tab(3) << "private enum DelegateId : int" << NLine(1);
+  GenBrace(stream, TAB_SIZE * 3, [&]() {
+    int cnt = 1;
+    for (const auto& i : iface.GetDeclarations()) {
+      if (i->GetMethodType() != Declaration::MethodType::DELEGATE) continue;
+      stream << Tab(4) << i->GetID() << " = " << cnt++ << "," << NLine(1);
+    }
+  });
+  stream << NLine(1);
 }
 
 void CsGeneratorBase::GenDeclaration(std::ofstream& stream,
                                      const Declaration& decl, bool semicol) {
-    stream << GetDeclaration(decl, semicol);
+  stream << GetDeclaration(decl, semicol);
 }
 
 std::string CsGeneratorBase::GetDeclaration(const Declaration& decl,
                                             bool semicol) {
-    std::string ret;
-    ret += ConvertTypeToString(decl.GetType()) + " " + decl.GetID() + "(";
-    ret += GetParameters(decl.GetParameters());
-    if (semicol)
-      ret += ");";
-    else
-      ret += ")";
-    return ret;
+  std::string ret;
+  ret += ConvertTypeToString(decl.GetType()) + " " + decl.GetID() + "(";
+  ret += GetParameters(decl.GetParameters());
+  if (semicol)
+    ret += ");";
+  else
+    ret += ")";
+  return ret;
 }
 
 void CsGeneratorBase::GenParameters(std::ofstream& stream,
                                     const Parameters& ps) {
-    stream << GetParameters(ps);
+  stream << GetParameters(ps);
 }
 
 bool CsGeneratorBase::HasDelegate(const Interface& iface) {
-    bool found = false;
-    for (const auto& i : iface.GetDeclarations()) {
-      if (i->GetMethodType() == Declaration::MethodType::DELEGATE) {
-        found = true;
-        break;
-      }
+  bool found = false;
+  for (const auto& i : iface.GetDeclarations()) {
+    if (i->GetMethodType() == Declaration::MethodType::DELEGATE) {
+      found = true;
+      break;
     }
-    return found;
+  }
+  return found;
 }
 
 std::string CsGeneratorBase::GetParameters(const Parameters& ps) {
-    bool first = true;
-    std::string ret;
-    for (const auto& i : ps) {
-      if (!first) {
-        ret += ", ";
-      }
-
-      auto dir = i->GetParameterType().GetDirection();
-      if (dir == ParameterType::Direction::OUT) {
-        ret += "out ";
-      } else if (dir == ParameterType::Direction::REF) {
-        ret += "ref ";
-      }
+  bool first = true;
+  std::string ret;
+  for (const auto& i : ps) {
+    if (!first) {
+      ret += ", ";
+    }
 
-      ret += ConvertTypeToString(i->GetParameterType().GetBaseType()) + " " +
-             i->GetID();
-      first = false;
+    auto dir = i->GetParameterType().GetDirection();
+    if (dir == ParameterType::Direction::OUT) {
+      ret += "out ";
+    } else if (dir == ParameterType::Direction::REF) {
+      ret += "ref ";
     }
 
-    return ret;
+    ret += ConvertTypeToString(i->GetParameterType().GetBaseType()) + " " +
+           i->GetID();
+    first = false;
+  }
+
+  return ret;
 }
 
 std::string CsGeneratorBase::GenUnitMapParamType(const BaseType& base_type,
-    const std::string& type_str) {
+                                                 const std::string& type_str) {
   std::string ret;
   if (base_type.GetUserDefinedType() == BaseType::UserType::DELEGATE)
     ret = "CallbackBase";
@@ -556,33 +559,33 @@ std::string CsGeneratorBase::GetEnumTypeString(const BaseType& base_type) {
 }
 
 std::string CsGeneratorBase::GetTypeString(const BaseType& base_type) {
-    std::string ret;
+  std::string ret;
 
-    if (!base_type.IsUserDefinedType() && base_type.GetMetaType() == nullptr
-        && base_type.GetKeyType() == nullptr) {
-      if (base_type.ToString() == "file")
-        ret = base_type.ToString();
-      else
-        ret = ConvertTypeToString(base_type);
-    } else if (base_type.GetUserDefinedType() == BaseType::UserType::DELEGATE) {
-      ret = "delegate";
-    } else if (base_type.IsUserDefinedType()) {
+  if (!base_type.IsUserDefinedType() && base_type.GetMetaType() == nullptr &&
+      base_type.GetKeyType() == nullptr) {
+    if (base_type.ToString() == "file")
+      ret = base_type.ToString();
+    else
       ret = ConvertTypeToString(base_type);
-    } else {
-       ret = GetEnumTypeString(base_type);
-    }
+  } else if (base_type.GetUserDefinedType() == BaseType::UserType::DELEGATE) {
+    ret = "delegate";
+  } else if (base_type.IsUserDefinedType()) {
+    ret = ConvertTypeToString(base_type);
+  } else {
+    ret = GetEnumTypeString(base_type);
+  }
 
-    return ret;
+  return ret;
 }
 
 std::string CsGeneratorBase::GenUnitMaUintWrite(const Interface& iface,
                                                 const BaseType& base_type) {
   std::string ret;
 
-  if (!base_type.IsUserDefinedType() && base_type.GetMetaType() == nullptr
-        && base_type.GetKeyType() == nullptr) {
-    ret = "unit.parcel.Write" +
-          ConvertTypeToParcelType(base_type.ToString()) + "(value);";
+  if (!base_type.IsUserDefinedType() && base_type.GetMetaType() == nullptr &&
+      base_type.GetKeyType() == nullptr) {
+    ret = "unit.parcel.Write" + ConvertTypeToParcelType(base_type.ToString()) +
+          "(value);";
   } else if (base_type.GetUserDefinedType() == BaseType::UserType::ENUM) {
     ret = "unit.parcel.WriteInt((int)value);";
   } else if (base_type.GetUserDefinedType() == BaseType::UserType::DELEGATE) {
@@ -599,28 +602,27 @@ std::string CsGeneratorBase::GenUnitMaUintRead(const Interface& iface,
                                                const std::string& type_str) {
   std::string ret;
 
-  if (!base_type.IsUserDefinedType() && base_type.GetMetaType() == nullptr
-        && base_type.GetKeyType() == nullptr) {
+  if (!base_type.IsUserDefinedType() && base_type.GetMetaType() == nullptr &&
+      base_type.GetKeyType() == nullptr) {
     ret = "value = unit.parcel.Read" +
           ConvertTypeToParcelType(base_type.ToString()) + "();";
   } else if (base_type.GetUserDefinedType() == BaseType::UserType::ENUM) {
     ret = "int enum_int = unit.parcel.ReadInt();" + NLine(1) + Tab(1) +
-            "value = (" + type_str + ")enum_int;";
+          "value = (" + type_str + ")enum_int;";
   } else if (base_type.GetUserDefinedType() == BaseType::UserType::DELEGATE) {
     ret = "value = new CallbackBase(1, false);" + NLine(1) + Tab(1) +
           "CallbackBase.Deserialize(unit.parcel, value);";
   } else {
-    ret = "value = new " + type_str + "();" + NLine(1) +
-          Tab(1) + iface.GetID() + ".Deserialize(unit.parcel, value);";
+    ret = "value = new " + type_str + "();" + NLine(1) + Tab(1) +
+          iface.GetID() + ".Deserialize(unit.parcel, value);";
   }
 
   return ret;
 }
 
 void CsGeneratorBase::AddTypeMap(
-    std::unordered_map<std::string, BaseType>& types,
-    const BaseType& base_type, const std::string& st_id) {
-
+    std::unordered_map<std::string, BaseType>& types, const BaseType& base_type,
+    const std::string& st_id) {
   types[ConvertTypeToString(base_type, st_id)] = base_type;
 
   if (base_type.GetMetaType() != nullptr) {
@@ -637,167 +639,169 @@ void CsGeneratorBase::AddTypeMap(
 }
 
 std::string CsGeneratorBase::GenUnitMapReadWrite(const Interface& iface) {
-    std::unordered_map<std::string, BaseType> types;
-    BaseType bI("int", "int");
-    BaseType bS("string", "string");
-    BaseType bB("bool", "bool");
-
-    types[bI.GetFullName()] = bI;
-    types[bS.GetFullName()] = bS;
-    types[bB.GetFullName()] = bB;
-
-    for (const auto& i : iface.GetDeclarations()) {
-      types[ConvertTypeToString(i->GetType())] = i->GetType();
-      if (i->GetMethodType() == Declaration::MethodType::DELEGATE) {
-        BaseType del(i->GetID(), "", BaseType::UserType::DELEGATE);
-        AddTypeMap(types, del);
-      }
+  std::unordered_map<std::string, BaseType> types;
+  BaseType bI("int", "int");
+  BaseType bS("string", "string");
+  BaseType bB("bool", "bool");
+
+  types[bI.GetFullName()] = bI;
+  types[bS.GetFullName()] = bS;
+  types[bB.GetFullName()] = bB;
+
+  for (const auto& i : iface.GetDeclarations()) {
+    types[ConvertTypeToString(i->GetType())] = i->GetType();
+    if (i->GetMethodType() == Declaration::MethodType::DELEGATE) {
+      BaseType del(i->GetID(), "", BaseType::UserType::DELEGATE);
+      AddTypeMap(types, del);
+    }
 
-      for (const auto& j : i->GetParameters()) {
-        auto& type = j->GetParameterType().GetBaseType();
-        AddTypeMap(types, type);
-      }
+    for (const auto& j : i->GetParameters()) {
+      auto& type = j->GetParameterType().GetBaseType();
+      AddTypeMap(types, type);
     }
+  }
 
-    for (auto& i : GetDocument().GetBlocks()) {
-      if (i->GetType() == Block::TYPE_STRUCTURE) {
-        const Structure& st = static_cast<const Structure&>(*i);
-        for (const auto& i : st.GetElements()) {
-          auto& type = i->GetType();
-          AddTypeMap(types, type, st.GetID());
-        }
+  for (auto& i : GetDocument().GetBlocks()) {
+    if (i->GetType() == Block::TYPE_STRUCTURE) {
+      const Structure& st = static_cast<const Structure&>(*i);
+      for (const auto& i : st.GetElements()) {
+        auto& type = i->GetType();
+        AddTypeMap(types, type, st.GetID());
       }
     }
+  }
 
-    types.erase("void");
-
-    std::string code = "";
-    for (const auto& iter : types) {
-      auto& type_str = iter.first;
-      auto& base_type = iter.second;
-      code += ReplaceAll(CB_UNITMAP_READ_READ_BASE)
-                .Change("<PARAM_TYPE>", GenUnitMapParamType(base_type, type_str))
-                .Change("<UINT_READ>", GenUnitMaUintRead(iface, base_type, type_str));
-      code += ReplaceAll(CB_UNITMAP_READ_WRITE_BASE)
-                .Change("<PARAM_TYPE>", GenUnitMapParamType(base_type, type_str))
-                .Change("<UINT_WRITE>", GenUnitMaUintWrite(iface, base_type));
-    }
+  types.erase("void");
+
+  std::string code = "";
+  for (const auto& iter : types) {
+    auto& type_str = iter.first;
+    auto& base_type = iter.second;
+    code +=
+        ReplaceAll(CB_UNITMAP_READ_READ_BASE)
+            .Change("<PARAM_TYPE>", GenUnitMapParamType(base_type, type_str))
+            .Change("<UINT_READ>",
+                    GenUnitMaUintRead(iface, base_type, type_str));
+    code +=
+        ReplaceAll(CB_UNITMAP_READ_WRITE_BASE)
+            .Change("<PARAM_TYPE>", GenUnitMapParamType(base_type, type_str))
+            .Change("<UINT_WRITE>", GenUnitMaUintWrite(iface, base_type));
+  }
 
-    return code;
+  return code;
 }
 
 void CsGeneratorBase::GenUnitMap(std::ofstream& stream, const Interface& iface,
                                  int tabSize) {
-    stream << GetUnitMap(iface, tabSize);
+  stream << GetUnitMap(iface, tabSize);
 }
 
 std::string CsGeneratorBase::GetUnitMap(const Interface& iface, int tabSize) {
-    std::string ret_string(CB_UNIT_BASE);
-    ret_string += ReplaceAll(CB_UNITMAP_BASE)
-                      .Change("<PARAM_READ_WRITE>", GenUnitMapReadWrite(iface));
-    return AddIndent(TAB_SIZE * tabSize, ret_string);
+  std::string ret_string(CB_UNIT_BASE);
+  ret_string += ReplaceAll(CB_UNITMAP_BASE)
+                    .Change("<PARAM_READ_WRITE>", GenUnitMapReadWrite(iface));
+  return AddIndent(TAB_SIZE * tabSize, ret_string);
 }
 
 void CsGeneratorBase::GenCallbacks(std::ofstream& stream,
                                    const Interface& iface, bool is_proxy) {
-    if (HasDelegate(iface) == false)
-      return;
-    stream << CB_CALLBACK_BASE;
-
-    for (const auto& i : iface.GetDeclarations()) {
-      if (i->GetMethodType() != Declaration::MethodType::DELEGATE)
-        continue;
-      GenCallback(stream, *i, iface.GetID(), is_proxy);
-    }
+  if (HasDelegate(iface) == false)
+    return;
+  stream << CB_CALLBACK_BASE;
+
+  for (const auto& i : iface.GetDeclarations()) {
+    if (i->GetMethodType() != Declaration::MethodType::DELEGATE)
+      continue;
+    GenCallback(stream, *i, iface.GetID(), is_proxy);
+  }
 }
 
 void CsGeneratorBase::GenCallback(std::ofstream& stream,
                                   const Declaration& decl,
                                   const std::string& id, bool is_proxy) {
-    stream << Tab(3) << "public sealed class " << decl.GetID()
-           << " : CallbackBase" << NLine(1);
-    GenBrace(stream, TAB_SIZE * 3, [&]() {
-      if (is_proxy) {
-        GenTemplate(
-            CB_CALLBACK_CTOR_PROXY, stream,
-            [&]() -> std::string { return decl.GetID(); },
-            [&]() -> std::string { return decl.GetID(); });
-      } else {
-        GenTemplate(
-            CB_CALLBACK_CTOR_STUB, stream,
-            [&]() -> std::string { return decl.GetID(); },
-            [&]() -> std::string { return decl.GetID(); },
-            [&]() -> std::string { return decl.GetID(); });
-      }
-      stream << NLine(1);
-
-      if (is_proxy) {
-        stream << Tab(4) << "public delegate void Callback(";
-        GenParameters(stream, decl.GetParameters());
-        stream << ");" << NLine(1);
-        stream << Tab(4) << "public event Callback Received;" << NLine(2);
-        GenReceivedEvent(stream, decl, id);
-      } else {
-        stream << CB_CALLBACK_STUB_MEMBERS;
-        GenInvokeMethod(stream, decl, id);
-      }
-    });
+  stream << Tab(3) << "public sealed class " << decl.GetID()
+         << " : CallbackBase" << NLine(1);
+  GenBrace(stream, TAB_SIZE * 3, [&]() {
+    if (is_proxy) {
+      GenTemplate(
+          CB_CALLBACK_CTOR_PROXY, stream,
+          [&]() -> std::string { return decl.GetID(); },
+          [&]() -> std::string { return decl.GetID(); });
+    } else {
+      GenTemplate(
+          CB_CALLBACK_CTOR_STUB, stream,
+          [&]() -> std::string { return decl.GetID(); },
+          [&]() -> std::string { return decl.GetID(); },
+          [&]() -> std::string { return decl.GetID(); });
+    }
     stream << NLine(1);
+
+    if (is_proxy) {
+      stream << Tab(4) << "public delegate void Callback(";
+      GenParameters(stream, decl.GetParameters());
+      stream << ");" << NLine(1);
+      stream << Tab(4) << "public event Callback Received;" << NLine(2);
+      GenReceivedEvent(stream, decl, id);
+    } else {
+      stream << CB_CALLBACK_STUB_MEMBERS;
+      GenInvokeMethod(stream, decl, id);
+    }
+  });
+  stream << NLine(1);
 }
 
 void CsGeneratorBase::GenReceivedEvent(std::ofstream& stream,
                                        const Declaration& decl,
                                        const std::string& id) {
-    stream << Tab(4) << "internal override void OnReceivedEvent(UnitMap map)"
-           << NLine(1);
-    GenBrace(stream, TAB_SIZE * 4, [&]() {
-      int cnt = 1;
-      for (const auto& i : decl.GetParameters()) {
-        std::string v = "param" + std::to_string(cnt);
-        std::string c =
-            ConvertTypeToDeserializer(i->GetParameterType().GetBaseType(), v,
-                                      i->GetID(), "map", true, id);
-        stream << AddIndent(TAB_SIZE * 5, c);
-        cnt++;
-      }
+  stream << Tab(4) << "internal override void OnReceivedEvent(UnitMap map)"
+         << NLine(1);
+  GenBrace(stream, TAB_SIZE * 4, [&]() {
+    int cnt = 1;
+    for (const auto& i : decl.GetParameters()) {
+      std::string v = "param" + std::to_string(cnt);
+      std::string c = ConvertTypeToDeserializer(
+          i->GetParameterType().GetBaseType(), v, i->GetID(), "map", true, id);
+      stream << AddIndent(TAB_SIZE * 5, c);
+      cnt++;
+    }
 
-      cnt = 1;
-      stream << NLine(1) << Tab(5) << "Received?.Invoke(";
-      for (auto i = decl.GetParameters().begin();
-           i != decl.GetParameters().end(); ++i) {
-        if (cnt != 1) {
-          stream << ", ";
-        }
-        std::string v = "param" + std::to_string(cnt);
-        stream << v;
-        cnt++;
+    cnt = 1;
+    stream << NLine(1) << Tab(5) << "Received?.Invoke(";
+    for (auto i = decl.GetParameters().begin(); i != decl.GetParameters().end();
+         ++i) {
+      if (cnt != 1) {
+        stream << ", ";
       }
-      stream << ");" << NLine(1);
-    });
-    stream << NLine(1);
+      std::string v = "param" + std::to_string(cnt);
+      stream << v;
+      cnt++;
+    }
+    stream << ");" << NLine(1);
+  });
+  stream << NLine(1);
 }
 
 void CsGeneratorBase::GenInvokeMethod(std::ofstream& stream,
                                       const Declaration& decl,
                                       const std::string& id) {
-    GenTemplate(
-        CB_CALLBACK_INVOKE_METHOD, stream,
-        [&]() -> std::string { return GetParameters(decl.GetParameters()); },
-        [&]() -> std::string {
-          std::string m;
-          for (const auto& i : decl.GetParameters()) {
-            m += ConvertTypeToSerializer(
-                i->GetID(), i->GetID(),
-                GetTypeString(i->GetParameterType().GetBaseType()), "map");
-          }
-          return AddIndent(TAB_SIZE * 6, m);
-        });
+  GenTemplate(
+      CB_CALLBACK_INVOKE_METHOD, stream,
+      [&]() -> std::string { return GetParameters(decl.GetParameters()); },
+      [&]() -> std::string {
+        std::string m;
+        for (const auto& i : decl.GetParameters()) {
+          m += ConvertTypeToSerializer(
+              i->GetID(), i->GetID(),
+              GetTypeString(i->GetParameterType().GetBaseType()), "map");
+        }
+        return AddIndent(TAB_SIZE * 6, m);
+      });
 }
 
 void CsGeneratorBase::GenVersion(std::ofstream& stream) {
-    GenTemplate(::cs_cb_version, stream,
-                [&]() -> std::string { return FULLVER; });
-    stream << NLine(1);
+  GenTemplate(::cs_cb_version, stream,
+              [&]() -> std::string { return FULLVER; });
+  stream << NLine(1);
 }
 
 }  // namespace version2
index 3e45537a35ca0e3011cb2f08b6ba4408f5864c4b..88805eda3e4dc20df079f8f74b59ec9fb0484685 100644 (file)
@@ -43,7 +43,8 @@ class CsGeneratorBase : public Generator {
   std::string GetSerializer(const Structure& st);
   void GenListSerializer(std::ofstream& stream);
   std::string GetListSerializer();
-  std::string GetListSerializer(const BaseType& type, const std::string& st_id = "");
+  std::string GetListSerializer(const BaseType& type,
+                                const std::string& st_id = "");
   void GenMethodId(std::ofstream& stream, const Interface& iface);
   std::string GetMethodId(const Interface& iface);
   void GenDelegateId(std::ofstream& stream, const Interface& iface);
@@ -56,14 +57,15 @@ class CsGeneratorBase : public Generator {
 
   std::string ConvertTypeToString(const BaseType& type,
                                   const std::string& st_id = "");
-  std::string ConvertTypeToDeserializer(const BaseType& type, std::string gen_id,
+  std::string ConvertTypeToDeserializer(const BaseType& type,
+                                        std::string gen_id,
                                         std::string parma_id, std::string map,
                                         bool make_new_type = true,
                                         const std::string iface_id = "");
   std::string ConvertTypeToSerializer(std::string gen_id, std::string param_id,
-                                        const BaseType& type, std::string map);
+                                      const BaseType& type, std::string map);
   std::string ConvertTypeToSerializer(std::string gen_id, std::string param_id,
-                                        std::string param_type, std::string map);
+                                      std::string param_type, std::string map);
   std::string ConvertTypeToParcelType(const std::string& key);
   std::string GetParameters(const Parameters& ps);
   std::string Tab(int cnt);
@@ -99,10 +101,8 @@ class CsGeneratorBase : public Generator {
                                 const std::string& type_str);
   std::string GenUnitMaUintWrite(const Interface& iface,
                                  const BaseType& base_type);
-  std::string GenListWrite(const BaseType& type,
-                                const std::string& type_str);
-  std::string GenListRead(const BaseType& type,
-                                const std::string& type_str);
+  std::string GenListWrite(const BaseType& type, const std::string& type_str);
+  std::string GenListRead(const BaseType& type, const std::string& type_str);
   std::string GetLengthName(const BaseType& type);
 
  private:
index 465ee797e9e428e350a0fe40d1989c5f7a4d676d..ce7a10ca39d9ca5f5a700dcbd183ac29dbf620f7 100644 (file)
@@ -78,8 +78,8 @@ void CsProxyGen::GenInterface(std::ofstream& stream, const Interface& iface) {
 void CsProxyGen::GenMemberData(std::ofstream& stream, const Interface& iface) {
   ReplaceAll(CB_DATA_MEMBERS)
       .Change("<VERSION>", std::string(FULLVER))
-      .Change("<CALLBACK_LIST>", HasDelegate(iface) ?
-          CB_DATA_CALLBACK_LIST : std::string(""))
+      .Change("<CALLBACK_LIST>",
+              HasDelegate(iface) ? CB_DATA_CALLBACK_LIST : std::string(""))
       .Out(stream);
 }
 
@@ -87,10 +87,10 @@ void CsProxyGen::GenEventMethod(std::ofstream& stream, const Interface& iface) {
   bool found = HasDelegate(iface);
 
   ReplaceAll(CB_EVENT_METHODS)
-      .Change("<PROCESS_EVENT_BASE>", found ?
-          CB_EVENT_PROCESS_EVENT_BASE : std::string(""))
-      .Change("<RECEIVE_EVENT_BASE>", found ?
-          CB_EVENT_RECEIVE_EVENT_BASE : std::string(""))
+      .Change("<PROCESS_EVENT_BASE>",
+              found ? CB_EVENT_PROCESS_EVENT_BASE : std::string(""))
+      .Change("<RECEIVE_EVENT_BASE>",
+              found ? CB_EVENT_RECEIVE_EVENT_BASE : std::string(""))
       .Out(stream);
 }
 
@@ -128,9 +128,7 @@ void CsProxyGen::GenMethods(std::ofstream& stream, const Interface& iface) {
     stream << Tab(3) << "public ";
     GenDeclaration(stream, *i, false);
     stream << NLine(1);
-    GenBrace(stream, TAB_SIZE * 3, [&]() {
-          GenInvocation(stream, *i);
-      });
+    GenBrace(stream, TAB_SIZE * 3, [&]() { GenInvocation(stream, *i); });
     stream << NLine(1);
   }
 }
@@ -165,8 +163,8 @@ void CsProxyGen::GenInvocation(std::ofstream& stream, const Declaration& decl) {
       if (pt.GetDirection() == ParameterType::Direction::OUT)
         continue;
 
-        m += ConvertTypeToSerializer(i->GetID(), i->GetID(),
-                                        pt.GetBaseType(), "map");
+      m += ConvertTypeToSerializer(i->GetID(), i->GetID(), pt.GetBaseType(),
+                                   "map");
 
       if (IsDelegateType(pt.GetBaseType())) {
         l += "_delegateList.Add(" + i->GetID() + ");\n";
@@ -182,7 +180,7 @@ void CsProxyGen::GenInvocation(std::ofstream& stream, const Declaration& decl) {
 
     st += CB_INVOCATION_MID + NLine(1);
 
-      // Deserialize
+    // Deserialize
     if (decl.GetMethodType() == Declaration::MethodType::ASYNC) {
       st += Tab(5) + "}";
       return st;
@@ -211,7 +209,6 @@ void CsProxyGen::GenInvocation(std::ofstream& stream, const Declaration& decl) {
     }
     st += AddIndent(TAB_SIZE * 5, NLine(1) + "}");
 
-
     return st;
   });
 }
index 33d4673bef5a9cd5a64f8deb747b2cac3f892f03..ddbafdae8bef07a5de38c451cd95175050c89eaa 100644 (file)
@@ -25,7 +25,6 @@
 namespace tidl {
 namespace version2 {
 
-
 class CsStubGen : public CsGeneratorBase {
  public:
   explicit CsStubGen(std::shared_ptr<Document> doc);
@@ -49,7 +48,7 @@ class CsStubGen : public CsGeneratorBase {
   void GenDisposable(std::ofstream& stream, const Interface& iface);
 };
 
-}  //namespace version2
+}  // namespace version2
 }  // namespace tidl
 
 #endif  // IDLC_CS_GEN_VERSION2_CS_STUB_GENRATOR_H_
\ No newline at end of file