diff options
Diffstat (limited to 'idlc/cs_gen/cs_gen_base.cc')
-rw-r--r-- | idlc/cs_gen/cs_gen_base.cc | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/idlc/cs_gen/cs_gen_base.cc b/idlc/cs_gen/cs_gen_base.cc index 982a252..09b01eb 100644 --- a/idlc/cs_gen/cs_gen_base.cc +++ b/idlc/cs_gen/cs_gen_base.cc @@ -31,7 +31,7 @@ CsGeneratorBase::CsGeneratorBase(std::shared_ptr<Document> doc) type_map_ = { {"char", "byte"}, {"int", "int"}, {"short", "short"}, {"long", "long"}, {"string", "string"}, {"bool", "bool"}, - {"list", "LinkedList"}, {"array", "List"}, {"float","float"}, + {"list", "LinkedList"}, {"array", "List"}, {"float", "float"}, {"double", "double"}, {"bundle", "Bundle"}, {"void", "void"} }; @@ -74,8 +74,7 @@ void CsGeneratorBase::GenStructure(std::ofstream& stream, const Structure& st) { }, [&]()->std::string { return i->GetID(); - } - ); + }); if (i->GetType().ToString() == "bundle") { v.push_back(i->GetID() + " = " + "new Bundle()"); } @@ -91,12 +90,12 @@ void CsGeneratorBase::GenStructure(std::ofstream& stream, const Structure& st) { str += " " + i + ";\n"; } return str; - } - ); + }); }); } -void CsGeneratorBase::GenSerializer(std::ofstream& stream, const Structure& st) { +void CsGeneratorBase::GenSerializer(std::ofstream& stream, + const Structure& st) { stream << NLine(1) << Tab(3) << "private static void Serialize(IntPtr h, " << st.GetID() << " param)" << NLine(1); GenBrace(stream, TAB_SIZE * 3, [&]() { @@ -146,7 +145,6 @@ void CsGeneratorBase::GenSerializer(std::ofstream& stream, const Structure& st) stream << Tab(4) << "Deserialize(h, param." << i->GetID() << ");" << NLine(1); } - } }); } @@ -167,7 +165,8 @@ void CsGeneratorBase::AddSerializerList(const BaseType& type) { } } -void CsGeneratorBase::GenListSerializer(std::ofstream& stream, const BaseType& type) { +void CsGeneratorBase::GenListSerializer(std::ofstream& stream, + const BaseType& type) { stream << NLine(1) << Tab(3) << "private static void Serialize(IntPtr h, " << ConvertTypeToString(type) << " param)" << NLine(1); GenBrace(stream, TAB_SIZE * 3, [&]() { @@ -344,18 +343,19 @@ std::string CsGeneratorBase::NLine(int cnt) { return t; } -void CsGeneratorBase::GenWriteBundle(std::ofstream& stream, const std::string& id) { +void CsGeneratorBase::GenWriteBundle(std::ofstream& stream, + const std::string& id) { GenTemplate(CB_WRITE_BUNDLE, stream, [&]()->std::string { return id; }, [&]()->std::string { return id; - } - ); + }); } -void CsGeneratorBase::GenMethodId(std::ofstream& stream, const Interface& iface) { +void CsGeneratorBase::GenMethodId(std::ofstream& stream, + const Interface& iface) { stream << Tab(3) << "private enum MethodId : int" << NLine(1); GenBrace(stream, TAB_SIZE * 3, [&]() { int cnt = 2; @@ -370,7 +370,8 @@ void CsGeneratorBase::GenMethodId(std::ofstream& stream, const Interface& iface) }); } -void CsGeneratorBase::GenDelegateId(std::ofstream& stream, const Interface& iface) { +void CsGeneratorBase::GenDelegateId(std::ofstream& stream, + const Interface& iface) { stream << Tab(3) << "private enum DelegateId : int" << NLine(1); GenBrace(stream, TAB_SIZE * 3, [&]() { int cnt = 1; @@ -395,7 +396,8 @@ void CsGeneratorBase::GenDeclaration(std::ofstream& stream, stream << ")"; } -void CsGeneratorBase::GenParameters(std::ofstream& stream, const Parameters& ps) { +void CsGeneratorBase::GenParameters(std::ofstream& stream, + const Parameters& ps) { stream << GetParameters(ps); } @@ -446,8 +448,7 @@ void CsGeneratorBase::GenCallback(std::ofstream& stream, }, [&]()->std::string { return decl.GetID(); - } - ); + }); stream << NLine(1); if (is_proxy) { @@ -508,8 +509,7 @@ void CsGeneratorBase::GenInvokeMethod(std::ofstream& stream, m += ConvertTypeToSerializer(pt.GetBaseType(), i->GetID(), "p", id); } return AddIndent(TAB_SIZE * 5, m); - } - ); + }); } void CsGeneratorBase::GenCopyright(std::ofstream& stream) { @@ -521,8 +521,7 @@ void CsGeneratorBase::GenCopyright(std::ofstream& stream) { std::time_t t = std::time(NULL); std::tm* local_time = std::localtime(&t); return std::to_string(local_time->tm_year + 1900); - } - ); + }); stream << NLine(1); } } // namespace tidl |