Main Page ? Class Hierarchy ? Compound List ? File List ? Compound Members ? File Members ?

ReadmeGenerator Class Reference

#include <cmt_generators.h>

Inheritance diagram for ReadmeGenerator:

[legend]
Collaboration diagram for ReadmeGenerator:

[legend]
List of all members.

Public Methods

? ReadmeGenerator ()
void? build (const CmtSystem::cmt_string_vector &arguments)

Private Methods

void? reset ()

Private Attributes

FragmentHandle? readme_header_fragment
FragmentHandle? readme_fragment
FragmentHandle? readme_doc_fragment
FragmentHandle? readme_use_fragment
FragmentHandle? readme_trailer_fragment

Constructor & Destructor Documentation

ReadmeGenerator::ReadmeGenerator (? ? )?
?

Definition at line 1097 of file cmt_generators.cxx.

References readme_doc_fragment, readme_fragment, readme_header_fragment, readme_trailer_fragment, readme_use_fragment, and FragmentHandle::set().

01098 {
01099   readme_header_fragment.set ("readme_header");
01100   readme_fragment.set ("readme");
01101   readme_doc_fragment.set ("readme_doc");
01102   readme_use_fragment.set ("readme_use");
01103   readme_trailer_fragment.set ("readme_trailer");
01104 }

Member Function Documentation

void ReadmeGenerator::build (? const CmtSystem::cmt_string_vector &? ? arguments )?
?

Definition at line 1118 of file cmt_generators.cxx.

References cmt_string::c_str(), CmtGenerator::cmtdir, FragmentHandle::copy(), Use::discarded, CmtGenerator::doc, cmt_string::erase(), CmtSystem::file_separator(), cmt_string::find_last_of(), Cmt::get_current_package(), Cmt::get_current_version(), Use::get_ordered_uses(), Use::get_package(), Use::get_package_name(), Package::is_cmt(), CmtGenerator::m_DATE, CmtGenerator::m_DOCPATH, CmtGenerator::m_MGRSTYLE, CmtGenerator::m_output_file, CmtGenerator::m_output_file_name, CmtGenerator::m_PACKAGE, CmtGenerator::m_PACKAGEPATH, CmtGenerator::m_PACKAGEPREFIX, CmtGenerator::m_USER, CmtGenerator::m_VERSION, mgr_style, CmtSystem::now(), cmt_string::npos, readme_doc_fragment, readme_fragment, readme_header_fragment, readme_trailer_fragment, readme_use_fragment, Use::real_path, reset(), cmt_vector< Use * >::size(), cmt_vector< cmt_string >::size(), Use::specified_path, Use::style, cmt_string::substr(), CmtGenerator::terminate(), CmtSystem::user(), and Use::version.

Referenced by Generator::build_readme().

01119 {
01120   reset ();
01121 
01122   m_PACKAGE = Cmt::get_current_package ();
01123   m_VERSION = Cmt::get_current_version ();
01124   m_DATE = CmtSystem::now ();
01125   m_USER = CmtSystem::user ();
01126 
01127   cmt_string url;
01128   cmt_string doc;
01129 
01130   for (int i = 0; i < arguments.size (); i++)
01131     {
01132       cmt_string arg = arguments[i];
01133 
01134       if (arg.substr (0, 5) == "-url=")
01135         {
01136           arg.substr (5, url);
01137         }
01138       else if (arg.substr (0, 5) == "-doc=")
01139         {
01140           arg.substr (5, doc);
01141         }
01142     }
01143 
01144   m_output_file_name = cmtdir + "README.html";
01145 
01146   m_output_file = fopen (m_output_file_name.c_str (), "wb");
01147   if (m_output_file != NULL)
01148     {
01149       readme_header_fragment.copy (m_output_file, 2, 
01150                                    &m_PACKAGE, &m_VERSION);
01151 
01152       if (doc != "")
01153         {
01154           m_DOCPATH = doc;
01155           readme_doc_fragment.copy (m_output_file, 3,
01156                                     &m_PACKAGE,
01157                                     &m_VERSION,
01158                                     &m_DOCPATH);
01159         }
01160 
01161       readme_fragment.copy (m_output_file, 2,
01162                             &m_PACKAGE,
01163                             &m_VERSION);
01164 
01165       int number;
01166       const Use::UsePtrVector& uses = Use::get_ordered_uses ();
01167 
01168       for (number = 0; number < uses.size (); number++)
01169         {
01170           const Use* use = uses[number];
01171 
01172           if (use == 0) continue;
01173           if (use->discarded) continue;
01174 
01175           Package* p = use->get_package ();
01176           if (p->is_cmt ()) continue;
01177 
01178           cmt_string selected_path;
01179 
01180           if (url == "")
01181             {
01182               selected_path = use->real_path;
01183               
01184               if (use->specified_path != "")
01185                 {
01186                   int pos = selected_path.find_last_of (use->specified_path);
01187                   if (pos != cmt_string::npos)
01188                     {
01189                       selected_path.erase (pos);
01190                     }
01191                 }
01192             }
01193           else
01194             {
01195               selected_path = url;
01196               
01197               if (use->specified_path != "")
01198                 {
01199                   selected_path += CmtSystem::file_separator ();
01200                 }
01201             }
01202           
01203           m_PACKAGEPATH = selected_path;
01204           m_PACKAGEPREFIX = use->specified_path;
01205           m_PACKAGE = use->get_package_name ();
01206           m_VERSION = use->version;
01207           m_MGRSTYLE = (use->style == mgr_style) ? "mgr" : "cmt";
01208           readme_use_fragment.copy (m_output_file, 5,
01209                                     &m_PACKAGEPATH,
01210                                     &m_PACKAGEPREFIX,
01211                                     &m_PACKAGE,
01212                                     &m_VERSION,
01213                                     &m_MGRSTYLE);
01214         }
01215 
01216       m_PACKAGE = Cmt::get_current_package ();
01217       m_VERSION = Cmt::get_current_version ();
01218       readme_trailer_fragment.copy (m_output_file, 4, 
01219                                     &m_PACKAGE, 
01220                                     &m_VERSION, 
01221                                     &m_DATE, 
01222                                     &m_USER);
01223 
01224       terminate ();
01225     }
01226 }

void ReadmeGenerator::reset (? ? )? [private]
?

Reimplemented from CmtGenerator.

Definition at line 1106 of file cmt_generators.cxx.

References readme_doc_fragment, readme_fragment, readme_header_fragment, readme_trailer_fragment, readme_use_fragment, FragmentHandle::reset(), and CmtGenerator::reset().

Referenced by build().


Member Data Documentation

FragmentHandle ReadmeGenerator::readme_doc_fragment [private]
?

Definition at line 93 of file cmt_generators.h.

Referenced by build(), ReadmeGenerator(), and reset().

FragmentHandle ReadmeGenerator::readme_fragment [private]
?

Definition at line 92 of file cmt_generators.h.

Referenced by build(), ReadmeGenerator(), and reset().

FragmentHandle ReadmeGenerator::readme_header_fragment [private]
?

Definition at line 91 of file cmt_generators.h.

Referenced by build(), ReadmeGenerator(), and reset().

FragmentHandle ReadmeGenerator::readme_trailer_fragment [private]
?

Definition at line 95 of file cmt_generators.h.

Referenced by build(), ReadmeGenerator(), and reset().

FragmentHandle ReadmeGenerator::readme_use_fragment [private]
?

Definition at line 94 of file cmt_generators.h.

Referenced by build(), ReadmeGenerator(), and reset().


The documentation for this class was generated from the following files:
Generated on Thu Jul 1 15:27:34 2004 for CMT by 1.2.18