feisty meow concerns codebase
2.140
|
Holds a file's version identifier. More...
#include <version_record.h>
Public Types | |
enum | version_places { MAJOR , MINOR , REVISION , BUILD } |
enum | version_style { DOTS , COMMAS , DETAILED } |
Public Member Functions | |
version () | |
constructs a blank version. More... | |
version (const structures::string_array &version_info) | |
constructs a version from a list of strings that form the components. More... | |
version (const basis::astring &formatted_string) | |
the version components will be parsed from the "formatted_string". More... | |
version (int major, int minor, int rev=0, int build=0) | |
constructs a win32 style version structure from the information. More... | |
version (const version &to_copy) | |
constructs a copy of "to_copy". More... | |
virtual | ~version () |
version & | operator= (const version &to_copy) |
assigns this to the "to_copy". More... | |
DEFINE_CLASS_NAME ("version") | |
virtual basis::astring | text_form () const |
bool | equal_to (const equalizable &to_test) const |
compares two versions for exact equality. More... | |
bool | less_than (const orderable &to_test) const |
reports if this version is less than "to_test". More... | |
int | components () const |
reports the number of components that make up this version. More... | |
basis::astring | get_component (int index) const |
returns the component at the specified index. More... | |
void | set_component (int index, const basis::astring &to_set) |
sets the component at "index" to "to_set". More... | |
basis::astring | flex_text_form (version_style style=DOTS, int including=-1) const |
returns a textual form of the version number. More... | |
virtual int | packed_size () const |
Estimates the space needed for the packed structure. More... | |
virtual void | pack (basis::byte_array &target) const |
Creates a packed form of the packable object in "packed_form". More... | |
virtual bool | unpack (basis::byte_array &source) |
Restores the packable from the "packed_form". More... | |
int | v_major () const |
major version number. More... | |
int | v_minor () const |
minor version number. More... | |
int | v_revision () const |
revision level. More... | |
int | v_build () const |
build number. More... | |
bool | compatible (const version &that) const |
returns true if this is compatible with "that" version on win32. More... | |
bool | bogus () const |
returns true if the version held here is clearly bogus. More... | |
Public Member Functions inherited from basis::orderable | |
virtual bool | less_than (const orderable &s2) const =0 |
virtual bool | operator< (const orderable &s2) const |
the virtual method for object ordering. More... | |
Public Member Functions inherited from basis::equalizable | |
virtual bool | equal_to (const equalizable &s2) const =0 |
virtual bool | operator== (const equalizable &s2) const |
the virtual method for object equality. More... | |
Static Public Member Functions | |
static version | from_text (const basis::astring &to_convert) |
returns a version structure parsed from "to_convert". More... | |
static void * | __global_module_handle () |
a static resource required to identify the actual win32 module that this lives in. More... | |
Holds a file's version identifier.
The version structures can be used in any of our components because they're not platform specific. They maintain information about a file that is part of the released product.
Definition at line 38 of file version_record.h.
Enumerator | |
---|---|
MAJOR | |
MINOR | |
REVISION | |
BUILD |
Definition at line 91 of file version_record.h.
Enumerator | |
---|---|
DOTS | |
COMMAS | |
DETAILED |
Definition at line 95 of file version_record.h.
structures::version::version | ( | ) |
constructs a blank version.
Definition at line 32 of file version_record.cpp.
References BUILD, MAJOR, MINOR, REVISION, and set_component().
Referenced by from_text(), and version().
structures::version::version | ( | const structures::string_array & | version_info | ) |
constructs a version from a list of strings that form the components.
note that if a component is an empty string, it is changed to be a zero ("0").
Definition at line 41 of file version_record.cpp.
References basis::array< contents >::length().
structures::version::version | ( | const basis::astring & | formatted_string | ) |
the version components will be parsed from the "formatted_string".
the version component separator is the period ('.') or the comma (',') character.
Definition at line 52 of file version_record.cpp.
References basis::astring::end(), basis::astring::find(), basis::astring::length(), basis::negative(), and basis::astring::substring().
structures::version::version | ( | int | major, |
int | minor, | ||
int | rev = 0 , |
||
int | build = 0 |
||
) |
constructs a win32 style version structure from the information.
Definition at line 79 of file version_record.cpp.
References version().
structures::version::version | ( | const version & | to_copy | ) |
constructs a copy of "to_copy".
Definition at line 86 of file version_record.cpp.
|
virtual |
Definition at line 90 of file version_record.cpp.
References basis::WHACK().
|
static |
a static resource required to identify the actual win32 module that this lives in.
this handle is stored statically when the libraries are started up. it records the handle of the module they belong to for later use in checking versions.
Definition at line 26 of file version_record.cpp.
bool structures::version::bogus | ( | ) | const |
returns true if the version held here is clearly bogus.
this means that all four numbers are zero.
Definition at line 157 of file version_record.cpp.
References v_build(), v_major(), v_minor(), and v_revision().
bool structures::version::compatible | ( | const version & | that | ) | const |
returns true if this is compatible with "that" version on win32.
that means that all version components are the same except for the last one, the build number. we allow the build numbers to fluctuate so that patched components can be installed without causing version complaints.
Definition at line 149 of file version_record.cpp.
References v_major(), v_minor(), and v_revision().
Referenced by versions::version_checker::good_version().
int structures::version::components | ( | ) | const |
reports the number of components that make up this version.
Definition at line 100 of file version_record.cpp.
References basis::array< contents >::length().
structures::version::DEFINE_CLASS_NAME | ( | "version" | ) |
bool structures::version::equal_to | ( | const equalizable & | to_test | ) | const |
compares two versions for exact equality.
to perform a check of win32 build compatibility, use the compatible() method.
Definition at line 130 of file version_record.cpp.
References basis::cast_or_throw().
astring structures::version::flex_text_form | ( | version_style | style = DOTS , |
int | including = -1 |
||
) | const |
returns a textual form of the version number.
the place passed in "including" specifies how much of the version to print, where a negative number means all components. for example, if "including" is MINOR, then only the first two components (major and minor components) are printed.
Definition at line 164 of file version_record.cpp.
References BUILD, DETAILED, get_component(), MAJOR, MINOR, REVISION, and SEPARATE.
Referenced by versions::version_checker::complain_wrong_version(), write_build_config::execute(), text_form(), versions::version_ini::write_assembly(), and versions::version_ini::write_rc().
|
static |
returns a version structure parsed from "to_convert".
Definition at line 210 of file version_record.cpp.
References version().
astring structures::version::get_component | ( | int | index | ) | const |
returns the component at the specified index.
note that if an entry is an empty string, then a string with zero in it is returned ("0").
Definition at line 114 of file version_record.cpp.
References bounds_return, and basis::array< contents >::length().
Referenced by flex_text_form(), versions::version_ini::set_version(), v_build(), v_major(), v_minor(), and v_revision().
bool structures::version::less_than | ( | const orderable & | to_test | ) | const |
reports if this version is less than "to_test".
supplies the other operator needed for the full set of comparisons (besides equality). the basis namespace provides templates for the rest of the comparison operators in <basis/functions.h>.
Definition at line 136 of file version_record.cpp.
References basis::cast_or_throw(), v_build(), v_major(), v_minor(), and v_revision().
assigns this to the "to_copy".
Definition at line 92 of file version_record.cpp.
|
virtual |
Creates a packed form of the packable object in "packed_form".
This must append to the data in "packed_form" rather than clearing prior contents.
Implements basis::packable.
Definition at line 218 of file version_record.cpp.
References structures::string_array::pack().
|
virtual |
Estimates the space needed for the packed structure.
Implements basis::packable.
Definition at line 213 of file version_record.cpp.
References structures::string_array::packed_size().
void structures::version::set_component | ( | int | index, |
const basis::astring & | to_set | ||
) |
sets the component at "index" to "to_set".
an empty string for "to_set" is turned into a zero.
Definition at line 120 of file version_record.cpp.
References basis::array< contents >::length(), basis::array< contents >::resize(), and basis::astring::t().
Referenced by write_build_config::execute(), versions::version_ini::get_record(), write_build_config::process_version_parts(), versions::version_ini::set_version(), and version().
|
virtual |
Definition at line 98 of file version_record.cpp.
References flex_text_form().
Referenced by versions::version_ini::one_stop_version_stamp(), structures::version_record::text_form(), and versions::version_checker::text_form().
|
virtual |
Restores the packable from the "packed_form".
This object becomes the unpacked form, and therefore must lose any of its prior contents that depend on the data in "packed_form". This is up to the derived unpack function to figure out. The "packed_form" is modified by extracting all of the pieces that are used for this object; the remainder stays in "packed_form". true is returned if the unpacking was successful.
Implements basis::packable.
Definition at line 221 of file version_record.cpp.
References structures::string_array::unpack().
int structures::version::v_build | ( | ) | const |
build number.
this number is not considered important when comparing file compatibility. the compatible() method always returns true if two files differ only in the "build" number (rather than major, minor or revision). this allows patches to be created with a newer (larger) build number, but still link fine with existing dlls. since the file is distinguished by more than just its time stamp, it allows changes to an installation to be tracked very precisely. some folks keep a catalog of patched components for each software release and index the patch details by the different build numbers.
Definition at line 111 of file version_record.cpp.
References BUILD, timely::convert(), and get_component().
Referenced by bogus(), and less_than().
int structures::version::v_major | ( | ) | const |
major version number.
major & minor are the most significant values for a numerical version. these are the familiar numbers often quoted for software products, like "jubware version 8.2".
Definition at line 102 of file version_record.cpp.
References timely::convert(), get_component(), and MAJOR.
Referenced by bogus(), compatible(), processes::process_control::find_process_in_list(), less_than(), and processes::process_control::process_control().
int structures::version::v_minor | ( | ) | const |
minor version number.
Definition at line 105 of file version_record.cpp.
References timely::convert(), get_component(), and MINOR.
Referenced by bogus(), compatible(), processes::process_control::find_process_in_list(), and less_than().
int structures::version::v_revision | ( | ) | const |
revision level.
in the hoople code and the clam system, this number is changed for every new build. when two versions of a file are the same in major, minor and revision numbers, then they are said to be compatible. for those using this version scheme, it asserts that dll compatibility has not been broken if one swaps those two files in an installation. after the swap, any components that are dependent on the dll must all link properly against the replacement file. when in doubt, increment the version number. some folks automatically increment the revision level every week.
Definition at line 108 of file version_record.cpp.
References timely::convert(), get_component(), and REVISION.
Referenced by bogus(), compatible(), less_than(), and processes::process_control::process_control().