version_ini Class Reference

This provides support for writing windows version files. More...

#include <version_ini.h>

Inheritance diagram for version_ini:

Inheritance graph
[legend]
Collaboration diagram for version_ini:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 version_ini (const istring &path_name)
 the "path_name" is where the version INI file is located.
 ~version_ini ()
 IMPLEMENT_CLASS_NAME ("version_ini")
bool writable ()
 returns true if the INI file specified in the constructor is writable.
version get_version ()
 observes or modifies the version number structure held here.
void set_version (const version &to_write, bool write_to_ini)
 sets the version held here.
version_record get_record ()
 observes the entire version record.
version_recordaccess_record ()
 provides access to change the version_record held here.
void set_record (const version_record &to_write, bool write_to_ini)
 modifies the entire version record.
bool executable ()
 returns true if this version file is for an executable.
bool library ()
 returns true if this version file is for a dynamic library.
bool ole_auto_registering ()
 returns true if this version file specifies ole auto registration.
bool write_rc (const version_record &to_write)
 writes out the file 'X_version.rc' for the X library or application.
bool write_code (const version_record &to_write)
 writes out the header ('X_version.h') with the version information.
bool write_assembly (const version_record &to_write, bool do_logging)
 fixes any assemblies with the info in "to_write".
version read_version_from_ini ()
 specialized version ignores cache and gets version directly from file.

Static Public Member Functions

static bool executable (const istring &path_name)
 returns true if "path_name" is for an executable.
static bool library (const istring &path_name)
 returns true if "path_name" is for a dynamic library.
static bool one_stop_version_stamp (const istring &path, const istring &source_version, bool do_logging)
 performs version stamping using the ini file in "path".

Static Public Attributes

static const char * VERSION_SECTION
static const char * COMPANY_KEY
static const char * COPYRIGHT_KEY
static const char * LEGAL_INFO_KEY
static const char * PRODUCT_KEY
static const char * WEB_SITE_KEY
static const char * MAJOR
static const char * MINOR
static const char * REVISION
static const char * BUILD
static const char * DESCRIPTION
static const char * ROOT
static const char * NAME
static const char * EXTENSION
static const char * OLE_AUTO

Detailed Description

This provides support for writing windows version files.

The class loads version information out of an initialization file and writes it into a standard windows VERSION_INFO RC file entry. It also creates the headers we use with our version control support.

Definition at line 35 of file version_ini.h.


Constructor & Destructor Documentation

version_ini::version_ini ( const istring path_name  ) 

the "path_name" is where the version INI file is located.

this file will be read for the key fields that will be used to name the version RC file and generate information in the resource.

Definition at line 64 of file version_ini.cpp.

References ini_configurator::name().

version_ini::~version_ini (  ) 

Definition at line 74 of file version_ini.cpp.

References WHACK().


Member Function Documentation

version_ini::IMPLEMENT_CLASS_NAME ( "version_ini"   ) 

bool version_ini::writable (  ) 

returns true if the INI file specified in the constructor is writable.

Definition at line 96 of file version_ini.cpp.

References filename::is_writable().

version version_ini::get_version (  ) 

observes or modifies the version number structure held here.

if the record had not been previously loaded, it is loaded.

Definition at line 128 of file version_ini.cpp.

References version_record::file_version, and get_record().

Referenced by one_stop_version_stamp().

void version_ini::set_version ( const version to_write,
bool  write_to_ini 
)

sets the version held here.

if "write_ini" is true, then the ini file is written to also. note that if get_record() had not previously been done and "write_ini" is not true, then the next get_record() or get_version() will wipe out the version that is set in the interim.

Definition at line 135 of file version_ini.cpp.

References BUILD, version::BUILD, version_record::file_version, version::get_component(), version::MAJOR, MAJOR, version::MINOR, MINOR, version_record::product_version, REVISION, version::REVISION, version::set_component(), configurator::store(), and VERSION_SECTION.

Referenced by one_stop_version_stamp(), and set_record().

version_record version_ini::get_record (  ) 

observes the entire version record.

The information is assembled from any cached record, the ini file and other sources. if the record has been loaded before, the last loaded version is returned plus any changes that have been made to the held record since then. otherwise, the record is read from the ini file.

// fix any incoming macros from the version record. LOG(istring("replacing prodname with ") + to_return.product_name); to_return.internal_name.replace("$product_name", to_return.product_name);

Definition at line 163 of file version_ini.cpp.

References version::BUILD, COMPANY_KEY, version_record::company_name, version_record::copyright, COPYRIGHT_KEY, DESCRIPTION, version_record::description, EXTENSION, version_record::file_version, FUNCDEF, version_record::internal_name, LEGAL_INFO_KEY, configurator::load(), NAME, version_record::original_name, PRODUCT_KEY, version_record::product_name, version_record::product_version, read_version_from_ini(), version::REVISION, ROOT, version::set_component(), istring::to_lower(), version_record::trademarks, VERSION_SECTION, version_record::web_address, and WEB_SITE_KEY.

Referenced by get_version(), and one_stop_version_stamp().

version_record & version_ini::access_record (  ) 

provides access to change the version_record held here.

this does not read from the INI file, unlike get_record().

Definition at line 161 of file version_ini.cpp.

Referenced by one_stop_version_stamp().

void version_ini::set_record ( const version_record to_write,
bool  write_to_ini 
)

modifies the entire version record.

if "write_to_ini" is true, then the new information is actually written to our configuration file. otherwise the information just replaces the source record here.

Definition at line 205 of file version_ini.cpp.

References version_record::description, DESCRIPTION, version_record::file_version, version_record::internal_name, NAME, version_record::original_name, ROOT, set_version(), configurator::store(), and VERSION_SECTION.

Referenced by one_stop_version_stamp().

bool version_ini::executable (  ) 

returns true if this version file is for an executable.

Definition at line 87 of file version_ini.cpp.

References EXTENSION, configurator::load(), istring::lower(), and VERSION_SECTION.

Referenced by library().

bool version_ini::library (  ) 

returns true if this version file is for a dynamic library.

Definition at line 94 of file version_ini.cpp.

References executable().

Referenced by one_stop_version_stamp().

bool version_ini::ole_auto_registering (  ) 

returns true if this version file specifies ole auto registration.

Definition at line 81 of file version_ini.cpp.

References configurator::load(), istring::lower(), OLE_AUTO, and VERSION_SECTION.

Referenced by write_rc().

bool version_ini::write_rc ( const version_record to_write  ) 

writes out the file 'X_version.rc' for the X library or application.

the contents will include the information specified in "to_write", where X is the library name from that record.

Definition at line 273 of file version_ini.cpp.

References filename::ALLOW_BOTH, byte_filer::close(), version::COMMAS, version_record::company_name, version_record::copyright, version_record::description, filename::dirname(), version::DOTS, version_record::file_version, version::flex_text_form(), byte_filer::good(), version_record::internal_name, istring::length(), configurator::load(), version::MINOR, ole_auto_registering(), version_record::original_name, version_record::product_name, version_record::product_version, REPLACE, ROOT, istring::s(), version_record::trademarks, filename::USER_RIGHTS, version_rc_template, VERSION_SECTION, and byte_filer::write().

Referenced by one_stop_version_stamp().

bool version_ini::write_code ( const version_record to_write  ) 

writes out the header ('X_version.h') with the version information.

this file is needed for other libraries or application to know this project's version number. the users can make sure that the header info agrees with the actual version seen on the file.

Definition at line 378 of file version_ini.cpp.

References filename::ALLOW_BOTH, byte_filer::close(), version::COMMAS, version_record::company_name, filename::dirname(), version_record::file_version, version::flex_text_form(), byte_filer::good(), istring::length(), configurator::load(), NAME, version_record::product_name, filename::raw(), REPLACE, istring::replace_all(), ROOT, istring::s(), istring::upper(), filename::USER_RIGHTS, version_header_template, VERSION_SECTION, version_record::web_address, and byte_filer::write().

Referenced by one_stop_version_stamp().

bool version_ini::write_assembly ( const version_record to_write,
bool  do_logging 
)

fixes any assemblies with the info in "to_write".

Definition at line 426 of file version_ini.cpp.

References filename::ALLOW_BOTH, filename::dirname(), version::DOTS, istring::end(), version_record::file_version, byte_filer::filename(), directory::files(), istring::find(), string_array::find(), version::flex_text_form(), FUNCDEF, istring::insert(), log_base::log(), non_negative(), program_wide_logger(), filename::raw(), byte_filer::read(), byte_filer::seek(), istring::t(), byte_filer::truncate(), filename::USER_RIGHTS, byte_filer::write(), and istring::zap().

Referenced by one_stop_version_stamp().

bool version_ini::executable ( const istring path_name  )  [static]

returns true if "path_name" is for an executable.

Definition at line 114 of file version_ini.cpp.

References EXTENSION, configurator::load(), configurator::RETURN_ONLY, istring::to_lower(), and VERSION_SECTION.

bool version_ini::library ( const istring path_name  )  [static]

returns true if "path_name" is for a dynamic library.

Definition at line 125 of file version_ini.cpp.

References executable().

version version_ini::read_version_from_ini (  ) 

specialized version ignores cache and gets version directly from file.

Definition at line 151 of file version_ini.cpp.

References BUILD, configurator::load(), MAJOR, MINOR, REVISION, and VERSION_SECTION.

Referenced by get_record().

bool version_ini::one_stop_version_stamp ( const istring path,
const istring source_version,
bool  do_logging 
) [static]

performs version stamping using the ini file in "path".

"source_version" supplies the name of the main version file where we retrieve the current version numbers. if that is not specified, then only the version header and RC file are created. if "do_logging" is true, then version info will be sent to the program-wide logger.

Definition at line 482 of file version_ini.cpp.

References access_record(), guards::alert_message(), version_record::company_name, version_record::copyright, portable::current_directory(), get_record(), get_version(), version_record::internal_name, library(), log_base::log(), main(), version_record::product_name, program_wide_logger(), istring::replace(), set_record(), set_version(), istring::t(), version::text_form(), version_record::trademarks, version_record::web_address, write_assembly(), write_code(), and write_rc().

Referenced by version_stamper::execute(), and stamping_spider().


Member Data Documentation

const char * version_ini::VERSION_SECTION [static]

Definition at line 117 of file version_ini.h.

Referenced by executable(), get_record(), ole_auto_registering(), read_version_from_ini(), set_record(), set_version(), write_code(), and write_rc().

const char * version_ini::COMPANY_KEY [static]

Definition at line 118 of file version_ini.h.

Referenced by get_record().

const char * version_ini::COPYRIGHT_KEY [static]

Definition at line 119 of file version_ini.h.

Referenced by get_record().

const char * version_ini::LEGAL_INFO_KEY [static]

Definition at line 120 of file version_ini.h.

Referenced by get_record().

const char * version_ini::PRODUCT_KEY [static]

Definition at line 121 of file version_ini.h.

Referenced by get_record().

const char * version_ini::WEB_SITE_KEY [static]

Definition at line 122 of file version_ini.h.

Referenced by get_record().

const char * version_ini::MAJOR [static]

Definition at line 123 of file version_ini.h.

Referenced by read_version_from_ini(), and set_version().

const char * version_ini::MINOR [static]

Definition at line 124 of file version_ini.h.

Referenced by read_version_from_ini(), and set_version().

const char * version_ini::REVISION [static]

Definition at line 125 of file version_ini.h.

Referenced by read_version_from_ini(), and set_version().

const char * version_ini::BUILD [static]

Definition at line 126 of file version_ini.h.

Referenced by read_version_from_ini(), and set_version().

const char * version_ini::DESCRIPTION [static]

Definition at line 127 of file version_ini.h.

Referenced by get_record(), and set_record().

const char * version_ini::ROOT [static]

Definition at line 128 of file version_ini.h.

Referenced by get_record(), set_record(), write_code(), and write_rc().

const char * version_ini::NAME [static]

Definition at line 129 of file version_ini.h.

Referenced by get_record(), set_record(), and write_code().

const char * version_ini::EXTENSION [static]

Definition at line 130 of file version_ini.h.

Referenced by executable(), and get_record().

const char * version_ini::OLE_AUTO [static]

Definition at line 131 of file version_ini.h.

Referenced by ole_auto_registering().


The documentation for this class was generated from the following files:
Generated on Sat Oct 11 04:30:42 2008 for HOOPLE Libraries by  doxygen 1.5.1