feisty meow concerns codebase  2.140
versions::version_ini Class Reference

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

#include <version_ini.h>

Inheritance diagram for versions::version_ini:
Collaboration diagram for versions::version_ini:

Public Member Functions

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

Static Public Member Functions

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

Static Public Attributes

static const char * VERSION_SECTION = "version"
 
static const char * COMPANY_KEY ="company"
 
static const char * COPYRIGHT_KEY ="copyright"
 
static const char * LEGAL_INFO_KEY ="legal_info"
 
static const char * PRODUCT_KEY ="product_name"
 
static const char * WEB_SITE_KEY ="web_site"
 
static const char * MAJOR = "major"
 
static const char * MINOR = "minor"
 
static const char * REVISION = "revision"
 
static const char * BUILD = "build"
 
static const char * DESCRIPTION = "description"
 
static const char * ROOT = "root"
 
static const char * NAME = "name"
 
static const char * EXTENSION = "extension"
 
static const char * OLE_AUTO = "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 32 of file version_ini.h.

Constructor & Destructor Documentation

◆ version_ini()

versions::version_ini::version_ini ( const basis::astring 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 70 of file version_ini.cpp.

References configuration::ini_configurator::name().

◆ ~version_ini()

versions::version_ini::~version_ini ( )

Definition at line 80 of file version_ini.cpp.

References basis::WHACK().

Member Function Documentation

◆ access_record()

version_record & versions::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 167 of file version_ini.cpp.

Referenced by one_stop_version_stamp().

◆ DEFINE_CLASS_NAME()

versions::version_ini::DEFINE_CLASS_NAME ( "version_ini"  )

◆ executable() [1/2]

bool versions::version_ini::executable ( )

returns true if this version file is for an executable.

Definition at line 93 of file version_ini.cpp.

References EXTENSION, configuration::configurator::load(), basis::astring::lower(), and VERSION_SECTION.

Referenced by library().

◆ executable() [2/2]

bool versions::version_ini::executable ( const basis::astring path_name)
static

returns true if "path_name" is for an executable.

Definition at line 120 of file version_ini.cpp.

References EXTENSION, configuration::configurator::load(), basis::astring::to_lower(), and VERSION_SECTION.

◆ get_record()

◆ get_version()

version versions::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 134 of file version_ini.cpp.

References structures::version_record::file_version, and get_record().

Referenced by one_stop_version_stamp().

◆ library() [1/2]

bool versions::version_ini::library ( )

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

Definition at line 100 of file version_ini.cpp.

References executable().

Referenced by one_stop_version_stamp().

◆ library() [2/2]

bool versions::version_ini::library ( const basis::astring path_name)
static

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

Definition at line 131 of file version_ini.cpp.

References executable().

◆ ole_auto_registering()

bool versions::version_ini::ole_auto_registering ( )

returns true if this version file specifies ole auto registration.

Definition at line 87 of file version_ini.cpp.

References configuration::configurator::load(), basis::astring::lower(), OLE_AUTO, basis::astring::t(), and VERSION_SECTION.

Referenced by write_rc().

◆ one_stop_version_stamp()

bool versions::version_ini::one_stop_version_stamp ( const basis::astring path,
const basis::astring header_store,
const basis::astring source_version,
bool  do_logging 
)
static

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

the created version files will be written to the "header_store". "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 538 of file version_ini.cpp.

References access_record(), structures::version_record::company_name, structures::version_record::copyright, basis::astring::equal_to(), FUNCDEF, get_record(), get_version(), structures::version_record::internal_name, library(), LOG, one_line_cert_to_pem::main(), eml_to_txt::path, structures::version_record::product_name, basis::astring::replace(), basis::astring::s(), set_record(), set_version(), basis::astring::t(), structures::version::text_form(), structures::version_record::text_form(), structures::version_record::trademarks, structures::version_record::web_address, write_assembly(), write_code(), and write_rc().

◆ read_version_from_ini()

version versions::version_ini::read_version_from_ini ( )

specialized version ignores cache and gets version directly from file.

Definition at line 157 of file version_ini.cpp.

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

Referenced by get_record().

◆ set_record()

void versions::version_ini::set_record ( const structures::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 204 of file version_ini.cpp.

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

Referenced by one_stop_version_stamp().

◆ set_version()

void versions::version_ini::set_version ( const structures::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 141 of file version_ini.cpp.

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

Referenced by one_stop_version_stamp(), and set_record().

◆ writable()

bool versions::version_ini::writable ( )

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

Definition at line 102 of file version_ini.cpp.

References filesystem::filename::is_writable().

◆ write_assembly()

◆ write_code()

bool versions::version_ini::write_code ( const basis::astring header_store,
const structures::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 FUNCDEF, configuration::configurator::load(), ROOT, and VERSION_SECTION.

Referenced by one_stop_version_stamp().

◆ write_rc()

Member Data Documentation

◆ BUILD

const char * versions::version_ini::BUILD = "build"
static

Definition at line 125 of file version_ini.h.

Referenced by read_version_from_ini(), and set_version().

◆ COMPANY_KEY

const char * versions::version_ini::COMPANY_KEY ="company"
static

Definition at line 117 of file version_ini.h.

Referenced by get_record().

◆ COPYRIGHT_KEY

const char * versions::version_ini::COPYRIGHT_KEY ="copyright"
static

Definition at line 118 of file version_ini.h.

Referenced by get_record().

◆ DESCRIPTION

const char * versions::version_ini::DESCRIPTION = "description"
static

Definition at line 126 of file version_ini.h.

Referenced by get_record(), and set_record().

◆ EXTENSION

const char * versions::version_ini::EXTENSION = "extension"
static

Definition at line 129 of file version_ini.h.

Referenced by executable(), and get_record().

◆ LEGAL_INFO_KEY

const char * versions::version_ini::LEGAL_INFO_KEY ="legal_info"
static

Definition at line 119 of file version_ini.h.

Referenced by get_record().

◆ MAJOR

const char * versions::version_ini::MAJOR = "major"
static

Definition at line 122 of file version_ini.h.

Referenced by read_version_from_ini(), and set_version().

◆ MINOR

const char * versions::version_ini::MINOR = "minor"
static

Definition at line 123 of file version_ini.h.

Referenced by read_version_from_ini(), and set_version().

◆ NAME

const char * versions::version_ini::NAME = "name"
static

Definition at line 128 of file version_ini.h.

Referenced by get_record(), and set_record().

◆ OLE_AUTO

const char * versions::version_ini::OLE_AUTO = "ole_auto"
static

Definition at line 130 of file version_ini.h.

Referenced by ole_auto_registering().

◆ PRODUCT_KEY

const char * versions::version_ini::PRODUCT_KEY ="product_name"
static

Definition at line 120 of file version_ini.h.

Referenced by get_record().

◆ REVISION

const char * versions::version_ini::REVISION = "revision"
static

Definition at line 124 of file version_ini.h.

Referenced by read_version_from_ini(), and set_version().

◆ ROOT

const char * versions::version_ini::ROOT = "root"
static

Definition at line 127 of file version_ini.h.

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

◆ VERSION_SECTION

const char * versions::version_ini::VERSION_SECTION = "version"
static

◆ WEB_SITE_KEY

const char * versions::version_ini::WEB_SITE_KEY ="web_site"
static

Definition at line 121 of file version_ini.h.

Referenced by get_record().


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