Пример #1
0
        internal void EmitFCSToForeign(CodeFormatter cppFile, MemberSpec foreignDestObject)
        {
            cppFile.BeginCase(FCSType.Name + "::" +  enumValue);
            cppFile.FormatLine("{0}{2}{1} = true;", foreignDestObject.Name, boolMemberName, foreignDestObject.Type.GetDereferencingOperator());

            cppFile.EndCase();
        }
Пример #2
0
        private void HandleSingleNode(CodeFormatter cf, string item, bool bSuppressParentEmit)
        {
            if (!GenerationContext.CanHandle(item))
            {
                cf.FormatLine("// case \"{0}\": Unhandled", item);
            }
            else
            {
                cf.BeginCase("\"" + item + "\"");
                cf.FormatLine("SubConsumer = new {0}_Handler(Context);", item);
                if (!bSuppressParentEmit && !StartIsMarkerOnly)
                {
                    if (HasType)
                    {
                        cf.WriteLine("AddCompletedObject(m_dataObject);");
                        cf.WriteLine("m_dataObject = null;");
                    }
                }
                cf.EndCase();

                AddHandledSubNode(item);
            }
        }
Пример #3
0
        private void EmitContentNodeHandlers(CodeFormatter cf)
        {
            foreach (string nodeName in listContentNodes)
            {
                if (string.IsNullOrEmpty(nodeName))
                    continue;

                if (GenerationContext.CanHandle(nodeName))
                {
                    throw new Exception("Unexpected : we have a handler for a content type node (" + nodeName + ")");
                }
                else
                {
                    cf.BeginCase("\"" + nodeName + "\"");
                    if (HasType)
                        cf.WriteLine("AddCompletedObject(m_dataObject);");
                    cf.WriteLine("AddCompletedObject(new TextContent(reader.ReadString()));");
                    cf.EndCase();
                    AddHandledSubNode(nodeName);
                }

            }
        }