Example #1
0
TiXmlElement* PlugIn::to_XML(void) const   
{
   std::ostringstream buffer;

   TiXmlElement* plug_in_element = new TiXmlElement("PlugIn");
   plug_in_element->SetAttribute("Version", 4);

   // Independent variables number 

   {
      TiXmlElement* independent_variables_number_element = new TiXmlElement("IndependentVariablesNumber");
      plug_in_element->LinkEndChild(independent_variables_number_element);

      buffer.str("");
      buffer << independent_variables_number;

      TiXmlText* independent_variables_number_text = new TiXmlText(buffer.str().c_str());
      independent_variables_number_element->LinkEndChild(independent_variables_number_text);
   }

   // Dependent variables number 

   {
      TiXmlElement* dependent_variables_number_element = new TiXmlElement("DependentVariablesNumber");
      plug_in_element->LinkEndChild(dependent_variables_number_element);

      buffer.str("");
      buffer << dependent_variables_number;

      TiXmlText* dependent_variables_number_text = new TiXmlText(buffer.str().c_str());
      dependent_variables_number_element->LinkEndChild(dependent_variables_number_text);
   }

   // Input method

   {
      TiXmlElement* input_method_element = new TiXmlElement("InputMethod");
      plug_in_element->LinkEndChild(input_method_element);

      std::string input_method_name = write_input_method();

      TiXmlText* input_method_text = new TiXmlText(input_method_name.c_str());
      input_method_element->LinkEndChild(input_method_text);
   }

   // Template filename

   {
      TiXmlElement* template_filename_element = new TiXmlElement("TemplateFilename");
      plug_in_element->LinkEndChild(template_filename_element);

      TiXmlText* template_filename_text = new TiXmlText(template_filename.c_str());
      template_filename_element->LinkEndChild(template_filename_text);
   }

   // Input filename 

   {
      TiXmlElement* input_filename_element = new TiXmlElement("InputFilename");
      plug_in_element->LinkEndChild(input_filename_element);

      TiXmlText* input_filename_text = new TiXmlText(input_filename.c_str());
      input_filename_element->LinkEndChild(input_filename_text);
   }

   // Batch filename 

   {
      TiXmlElement* script_filename_element = new TiXmlElement("BatchFilename");
      plug_in_element->LinkEndChild(script_filename_element);

      TiXmlText* script_filename_text = new TiXmlText(script_filename.c_str());
      script_filename_element->LinkEndChild(script_filename_text);
   }

   // Output filename 

   {
      TiXmlElement* output_filename_element = new TiXmlElement("OutputFilename");
      plug_in_element->LinkEndChild(output_filename_element);

      TiXmlText* output_filename_text = new TiXmlText(output_filename.c_str());
      output_filename_element->LinkEndChild(output_filename_text);
   }

   // Input flags

   {
      TiXmlElement* input_flags_element = new TiXmlElement("InputFlags");
      plug_in_element->LinkEndChild(input_flags_element);

      buffer.str("");
      buffer << input_flags;

      TiXmlText* input_flags_text = new TiXmlText(buffer.str().c_str());
      input_flags_element->LinkEndChild(input_flags_text);
   }

   // Output rows number

   {
      TiXmlElement* output_rows_number_element = new TiXmlElement("OutputRowsNumber");
      plug_in_element->LinkEndChild(output_rows_number_element);

      buffer.str("");
      buffer << output_rows_number;

      TiXmlText* output_rows_number_text = new TiXmlText(buffer.str().c_str());
      output_rows_number_element->LinkEndChild(output_rows_number_text);
   }

   // Output columns number

   {
      TiXmlElement* output_columns_number_element = new TiXmlElement("OutputColumnsNumber");
      plug_in_element->LinkEndChild(output_columns_number_element);

      buffer.str("");
      buffer << output_columns_number;

      TiXmlText* output_columns_number_text = new TiXmlText(buffer.str().c_str());
      output_columns_number_element->LinkEndChild(output_columns_number_text);
   }

   // Display

   {
      TiXmlElement* display_element = new TiXmlElement("Display");
      plug_in_element->LinkEndChild(display_element);

      buffer.str("");
      buffer << display;

      TiXmlText* display_text = new TiXmlText(buffer.str().c_str());
      display_element->LinkEndChild(display_text);
   }

   return(plug_in_element);   
}
Example #2
0
tinyxml2::XMLDocument* PlugIn::to_XML(void) const {
  tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument;

  std::ostringstream buffer;

  tinyxml2::XMLElement* plug_in_element = document->NewElement("PlugIn");

  document->InsertFirstChild(plug_in_element);

  // Independent variables number

  {
    tinyxml2::XMLElement* independent_variables_number_element =
        document->NewElement("IndependentVariablesNumber");
    plug_in_element->LinkEndChild(independent_variables_number_element);

    buffer.str("");
    buffer << independent_variables_number;

    tinyxml2::XMLText* independent_variables_number_text =
        document->NewText(buffer.str().c_str());
    independent_variables_number_element->LinkEndChild(
        independent_variables_number_text);
  }

  // Dependent variables number

  {
    tinyxml2::XMLElement* dependent_variables_number_element =
        document->NewElement("DependentVariablesNumber");
    plug_in_element->LinkEndChild(dependent_variables_number_element);

    buffer.str("");
    buffer << dependent_variables_number;

    tinyxml2::XMLText* dependent_variables_number_text =
        document->NewText(buffer.str().c_str());
    dependent_variables_number_element->LinkEndChild(
        dependent_variables_number_text);
  }

  // Input method

  {
    tinyxml2::XMLElement* input_method_element =
        document->NewElement("InputMethod");
    plug_in_element->LinkEndChild(input_method_element);

    std::string input_method_name = write_input_method();

    tinyxml2::XMLText* input_method_text =
        document->NewText(input_method_name.c_str());
    input_method_element->LinkEndChild(input_method_text);
  }

  // Template file_name

  {
    tinyxml2::XMLElement* template_file_name_element =
        document->NewElement("TemplateFileName");
    plug_in_element->LinkEndChild(template_file_name_element);

    tinyxml2::XMLText* template_file_name_text =
        document->NewText(template_file_name.c_str());
    template_file_name_element->LinkEndChild(template_file_name_text);
  }

  // Input file_name

  {
    tinyxml2::XMLElement* input_file_name_element =
        document->NewElement("InputFileName");
    plug_in_element->LinkEndChild(input_file_name_element);

    tinyxml2::XMLText* input_file_name_text =
        document->NewText(input_file_name.c_str());
    input_file_name_element->LinkEndChild(input_file_name_text);
  }

  // Batch file_name

  {
    tinyxml2::XMLElement* script_file_name_element =
        document->NewElement("BatchFileName");
    plug_in_element->LinkEndChild(script_file_name_element);

    tinyxml2::XMLText* script_file_name_text =
        document->NewText(script_file_name.c_str());
    script_file_name_element->LinkEndChild(script_file_name_text);
  }

  // Output file_name

  {
    tinyxml2::XMLElement* output_file_name_element =
        document->NewElement("OutputFileName");
    plug_in_element->LinkEndChild(output_file_name_element);

    tinyxml2::XMLText* output_file_name_text =
        document->NewText(output_file_name.c_str());
    output_file_name_element->LinkEndChild(output_file_name_text);
  }

  // Input flags

  {
    tinyxml2::XMLElement* input_flags_element =
        document->NewElement("InputFlags");
    plug_in_element->LinkEndChild(input_flags_element);

    buffer.str("");
    buffer << input_flags;

    tinyxml2::XMLText* input_flags_text =
        document->NewText(buffer.str().c_str());
    input_flags_element->LinkEndChild(input_flags_text);
  }

  // Output rows number

  {
    tinyxml2::XMLElement* output_rows_number_element =
        document->NewElement("OutputRowsNumber");
    plug_in_element->LinkEndChild(output_rows_number_element);

    buffer.str("");
    buffer << output_rows_number;

    tinyxml2::XMLText* output_rows_number_text =
        document->NewText(buffer.str().c_str());
    output_rows_number_element->LinkEndChild(output_rows_number_text);
  }

  // Output columns number

  {
    tinyxml2::XMLElement* output_columns_number_element =
        document->NewElement("OutputColumnsNumber");
    plug_in_element->LinkEndChild(output_columns_number_element);

    buffer.str("");
    buffer << output_columns_number;

    tinyxml2::XMLText* output_columns_number_text =
        document->NewText(buffer.str().c_str());
    output_columns_number_element->LinkEndChild(output_columns_number_text);
  }

  // Display

  {
    tinyxml2::XMLElement* display_element = document->NewElement("Display");
    plug_in_element->LinkEndChild(display_element);

    buffer.str("");
    buffer << display;

    tinyxml2::XMLText* display_text = document->NewText(buffer.str().c_str());
    display_element->LinkEndChild(display_text);
  }

  return (document);
}
Example #3
0
void PlugIn::write_XML(tinyxml2::XMLPrinter& file_stream) const
{
    std::ostringstream buffer;

    file_stream.OpenElement("PlugIn");

    // Independent variables number

    file_stream.OpenElement("IndependentVariablesNumber");

    buffer.str("");
    buffer << independent_variables_number;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Dependent variables number

    file_stream.OpenElement("DependentVariablesNumber");

    buffer.str("");
    buffer << dependent_variables_number;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Input method

    file_stream.OpenElement("InputMethod");

    file_stream.PushText(write_input_method().c_str());

    file_stream.CloseElement();

    // Template file_name

    file_stream.OpenElement("TemplateFileName");

    file_stream.PushText(template_file_name.c_str());

    file_stream.CloseElement();

    // Input file_name

    file_stream.OpenElement("InputFileName");

    file_stream.PushText(input_file_name.c_str());

    file_stream.CloseElement();

    // Batch file_name

    file_stream.OpenElement("BatchFileName");

    file_stream.PushText(script_file_name.c_str());

    file_stream.CloseElement();

    // Output file_name

    file_stream.OpenElement("OutputFileName");

    file_stream.PushText(output_file_name.c_str());

    file_stream.CloseElement();

    // Input flags

    file_stream.OpenElement("InputFlags");

    buffer.str("");
    buffer << input_flags;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Output rows number

    file_stream.OpenElement("OutputRowsNumber");

    buffer.str("");
    buffer << output_rows_number;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Output columns number

    file_stream.OpenElement("OutputColumnsNumber");

    buffer.str("");
    buffer << output_columns_number;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();

    // Display

    file_stream.OpenElement("Display");

    buffer.str("");
    buffer << display;

    file_stream.PushText(buffer.str().c_str());

    file_stream.CloseElement();


    file_stream.CloseElement();
}