Example #1
0
 private bool GeneriteRemove(ProtoMessage pm)
 {
     Hashtable ht = new Hashtable();
     ht["$OBJECT$"] = pm.name;
     /// Write top
     print((ArrayList) template_hash_table["CPP-REMOVE-DEFINE"], ht, ref cpp_sw);
     return true;
 }
Example #2
0
 private bool GeneriteUpdate(ProtoMessage pm)
 {
     Hashtable ht = new Hashtable();
     ht["$OBJECT$"] = pm.name;
     /// Write top
     print((ArrayList) template_hash_table["CPP-UPDATE-DEFINE-TOP"], ht, ref cpp_sw);
     /// Write insert code
     bool first_time = true;
     foreach (ProtoMessageMember pmm in pm.members)
     {
         ht["$MEMBER$"] = pmm.name;
         ht["$CPP-TYPE$"] = pmm.cpp_type;
         if (first_time)
         {
             first_time = false;
         }
         else
         {
             print((ArrayList) template_hash_table["CPP-INSERT-QUERY-SPEC"], ref cpp_sw);
         }
         if (pmm.store == 3)
         {
             if (pmm.cpp_type == "::std::string")
                 print((ArrayList) template_hash_table["CPP-INSERT-REPEATED-STRING-MEMBER-QUERY"], ht, ref cpp_sw);
             else if (isMessageType(pmm.cpp_type))
                 print((ArrayList)template_hash_table["CPP-INSERT-REPEATED-MESSAGE-MEMBER-QUERY"], ht, ref cpp_sw);
             else
                 print((ArrayList) template_hash_table["CPP-INSERT-REPEATED-NONSTRING-MEMBER-QUERY"], ht, ref cpp_sw);
         }
         else if (pmm.cpp_type == "::std::string")
             print((ArrayList) template_hash_table["CPP-INSERT-STRING-MEMBER-QUERY"], ht, ref cpp_sw);
         else
             print((ArrayList) template_hash_table["CPP-INSERT-NONSTRING-MEMBER-QUERY"], ht, ref cpp_sw);
     }
     /// Write buttom
     print((ArrayList) template_hash_table["CPP-UPDATE-DEFINE-BUTTOM"], ht, ref cpp_sw);
     return true;
 }
Example #3
0
        private bool GeneriteLoad(ProtoMessage pm)
        {
            Hashtable ht = new Hashtable();
            ht["$OBJECT$"] = pm.name;
            ht["$MEMBER-LIST$"] = "";
            foreach (ProtoMessageMember pmm in pm.members)
            {
                ht["$MEMBER-LIST$"] += pmm.name;
                ht["$MEMBER-LIST$"] += ",";
            }
            string temp = ht["$MEMBER-LIST$"].ToString();
            if (temp.Substring(temp.Length - 1, 1) == ",")
                ht["$MEMBER-LIST$"] = temp.Remove(temp.Length - 1, 1);
            /// Write top
            print((ArrayList) template_hash_table["CPP-LOAD-DEFINE-TOP"], ht, ref cpp_sw);
            /// Write member load code
            int index = 0;
            foreach (ProtoMessageMember pmm in pm.members)
            {
                ht["$MEMBER$"] = pmm.name;
                ht["$CPP-TYPE$"] = pmm.cpp_type;
                ht["$INDEX$"] = Convert.ToString(index);
                if (pmm.store == 3)
                {
                    if (pmm.cpp_type == "::std::string")
                        print((ArrayList)template_hash_table["CPP-LOAD-REPEATED-STRING-MEMBER-FILL"], ht, ref cpp_sw);
                    else if (isMessageType(pmm.cpp_type))
                        print((ArrayList)template_hash_table["CPP-LOAD-REPEATED-MESSAGE-MEMBER-FILL"], ht, ref cpp_sw);
                    else
                        print((ArrayList)template_hash_table["CPP-LOAD-REPEATED-NONSTRING-MEMBER-FILL"], ht, ref cpp_sw);
                }
                else if (pmm.cpp_type == "::std::string")
                    print((ArrayList) template_hash_table["CPP-LOAD-STRING-MEMBER-FILL"], ht, ref cpp_sw);
                else
                    print((ArrayList) template_hash_table["CPP-LOAD-NONSTRING-MEMBER-FILL"], ht, ref cpp_sw);
                index++;
            }
            /// Write buttom
            print((ArrayList) template_hash_table["CPP-LOAD-DEFINE-BUTTOM"], ht, ref cpp_sw);

            return true;
        }