src
Public Member Functions | List of all members
re2c::HeaderFile Struct Reference

#include <output.h>

Public Member Functions

 HeaderFile (const char *fn)
 
 ~HeaderFile ()
 
bool open ()
 
void emit (const std::vector< std::string > &types)
 

Detailed Description

Definition at line 119 of file output.h.

Constructor & Destructor Documentation

re2c::HeaderFile::HeaderFile ( const char *  fn)

Definition at line 338 of file output.cc.

339  : stream ()
340  // header is always generated, but not always dumped to file
341  // NULL filename crashes 'operator <<' on some platforms
342  // TODO: generate header only if necessary
343  , file_name (fn ? fn : "<stdout>.h")
344  , file (NULL)
345 {}
re2c::HeaderFile::~HeaderFile ( )

Definition at line 361 of file output.cc.

362 {
363  if (file != NULL)
364  {
365  std::string content = stream.str ();
366  fwrite (content.c_str (), 1, content.size (), file);
367  fclose (file);
368  }
369 }

Member Function Documentation

void re2c::HeaderFile::emit ( const std::vector< std::string > &  types)

Definition at line 353 of file output.cc.

354 {
355  output_version_time (stream);
356  output_line_info (stream, 3, file_name);
357  stream << "\n";
358  output_types (stream, 0, types);
359 }
void output_line_info(std::ostream &o, uint32_t line_number, const char *file_name)
Definition: output.cc:424
void output_types(std::ostream &o, uint32_t ind, const std::vector< std::string > &types)
Definition: output.cc:432
void output_version_time(std::ostream &o)
Definition: output.cc:442

Here is the call graph for this function:

Here is the caller graph for this function:

bool re2c::HeaderFile::open ( )

Definition at line 347 of file output.cc.

348 {
349  file = fopen (file_name, "wb");
350  return file != NULL;
351 }

Here is the caller graph for this function:


The documentation for this struct was generated from the following files: