source: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/XML_generate_file.cpp @ 88

Last change on this file since 88 was 88, checked in by rosiere, 16 years ago

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 1.1 KB
RevLine 
[2]1/*
2 * $Id: XML_generate_file.cpp 88 2008-12-10 18:31:39Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/include/XML.h"
[88]9#include "Common/include/ErrorMorpheo.h"
[3]10#include <fstream>
[2]11
12namespace morpheo              {
13namespace behavioural          {
14
[43]15#undef  FUNCTION
16#define FUNCTION "XML::generate_file"
[88]17  void XML::generate_file (std::string dirname, std::string encoding)
[3]18  {
[43]19    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
20
[3]21    header (encoding);
22
[88]23    std::string filename = dirname + "/" + _name + _filename_extension;
[3]24
[88]25    msg_printf(INFORMATION,_("Generate file \"%s\"."),filename.c_str());
[3]26
[71]27    std::ofstream file;
[88]28    file.open(filename.c_str() ,std::ios::out | std::ios::trunc);
[3]29
[88]30    if (!file)
31      throw ERRORMORPHEO(FUNCTION,toString(_("Error opening \"%s\" file.\n"),filename.c_str()));
32
[3]33    file << get_body();
34
35    file.close();
[43]36
37    log_printf(FUNC,Behavioural,FUNCTION,"End");
[3]38  };
39
[88]40  void XML::generate_file (std::string dirname)
[2]41  {
[43]42    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
[88]43    generate_file(dirname,"UTF-8");
[43]44    log_printf(FUNC,Behavioural,FUNCTION,"End");
[2]45  };
46
47}; // end namespace behavioural         
48}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.