#include <version_record.h>
Inheritance diagram for version:


Public Types | |
| enum | version_places { MAJOR, MINOR, REVISION, BUILD } |
| enum | version_style { DOTS, COMMAS, DETAILED } |
Public Member Functions | |
| version () | |
| constructs a blank version. | |
| version (const string_array &version_info) | |
| constructs a version from a list of strings that form the components. | |
| version (const istring &formatted_string) | |
| the version components will be parsed from the "formatted_string". | |
| version (int major, int minor, int rev=0, int build=0) | |
| constructs a win32 style version structure from the information. | |
| version (const version &to_copy) | |
| constructs a copy of "to_copy". | |
| virtual | ~version () |
| version & | operator= (const version &to_copy) |
| assigns this to the "to_copy". | |
| IMPLEMENT_CLASS_NAME ("version") | |
| virtual istring | text_form () const |
| Provides a text view of all the important info owned by this object. | |
| bool | operator== (const version &to_test) const |
| compares two versions for exact equality. | |
| bool | operator< (const version &to_test) const |
| reports if this version is less than "to_test". | |
| bool | operator!= (const version &to_test) const |
| returns true when this does not exactly equal "to_test". | |
| int | components () const |
| reports the number of components that make up this version. | |
| istring | get_component (int index) const |
| returns the component at the specified index. | |
| void | set_component (int index, const istring &to_set) |
| sets the component at "index" to "to_set". | |
| istring | flex_text_form (version_style style=DOTS, int including=-1) const |
| returns a textual form of the version number. | |
| void | pack (byte_array &target) const |
| Creates a packed form of the packable object in "packed_form". | |
| bool | unpack (byte_array &source) |
| Restores the packable from the "packed_form". | |
| int | v_major () const |
| major version number. | |
| int | v_minor () const |
| minor version number. | |
| int | v_revision () const |
| revision level. | |
| int | v_build () const |
| build number. | |
| bool | compatible (const version &that) const |
| returns true if this is compatible with "that" version on win32. | |
| bool | bogus () const |
| returns true if the version held here is clearly bogus. | |
Static Public Member Functions | |
| static version | from_text (const istring &to_convert) |
| returns a version structure parsed from "to_convert". | |
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 35 of file version_record.h.
| version::version | ( | ) |
constructs a blank version.
Definition at line 24 of file version_record.cpp.
References BUILD, MAJOR, MINOR, REVISION, and set_component().
Referenced by from_text(), and version().
| version::version | ( | const 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 33 of file version_record.cpp.
References array< contents >::length().
| version::version | ( | const istring & | 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 44 of file version_record.cpp.
References istring::end(), istring::find(), istring::length(), negative(), and istring::substring().
| version::version | ( | int | major, | |
| int | minor, | |||
| int | rev = 0, |
|||
| int | build = 0 | |||
| ) |
constructs a win32 style version structure from the information.
Definition at line 71 of file version_record.cpp.
References version().
| version::version | ( | const version & | to_copy | ) |
| version::~version | ( | ) | [virtual] |
assigns this to the "to_copy".
Definition at line 86 of file version_record.cpp.
References _components.
| version::IMPLEMENT_CLASS_NAME | ( | "version" | ) |
| istring version::text_form | ( | ) | const [virtual] |
Provides a text view of all the important info owned by this object.
It is understood that there could be a large amount of information and that this function might take a relatively long time to complete. The information can be provided in multiple lines if desired (it is good to use log_base::platform_ending() for the line breaks to help to ensure that the text is formatted appropriately). the default is quite lame and should be overridden.
Reimplemented from object_base.
Definition at line 92 of file version_record.cpp.
References flex_text_form().
Referenced by main(), version_ini::one_stop_version_stamp(), version_record::text_form(), and version_checker::text_form().
| bool version::operator== | ( | const version & | to_test | ) | const |
compares two versions for exact equality.
to perform a check of win32 build compatibility, use the compatible() method.
Definition at line 124 of file version_record.cpp.
References _components.
| bool version::operator< | ( | const version & | 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/function.h>.
Definition at line 127 of file version_record.cpp.
References v_build(), v_major(), v_minor(), and v_revision().
| bool version::operator!= | ( | const version & | to_test | ) | const [inline] |
returns true when this does not exactly equal "to_test".
handy shortcut for inequality operation despite comment above.
Definition at line 76 of file version_record.h.
| int version::components | ( | ) | const |
reports the number of components that make up this version.
Definition at line 94 of file version_record.cpp.
References array< contents >::length().
| istring 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 108 of file version_record.cpp.
References bounds_return, and array< contents >::length().
Referenced by flex_text_form(), version_ini::set_version(), v_build(), v_major(), v_minor(), and v_revision().
| void version::set_component | ( | int | index, | |
| const istring & | to_set | |||
| ) |
sets the component at "index" to "to_set".
an empty string for "to_set" is turned into a zero.
Definition at line 114 of file version_record.cpp.
References array< contents >::length(), array< contents >::resize(), and istring::t().
Referenced by write_build_config::execute(), version_ini::get_record(), write_build_config::process_version_parts(), version_ini::set_version(), and version().
| istring 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 151 of file version_record.cpp.
References BUILD, DETAILED, get_component(), MAJOR, MINOR, REVISION, and SEPARATE.
Referenced by version_checker::complain_wrong_version(), write_build_config::execute(), main(), text_form(), version_ini::write_assembly(), version_ini::write_code(), and version_ini::write_rc().
returns a version structure parsed from "to_convert".
Definition at line 197 of file version_record.cpp.
References version().
Referenced by version_checker::get_record(), version_checker::get_version(), and main().
| void version::pack | ( | byte_array & | target | ) | const [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 packable.
Definition at line 200 of file version_record.cpp.
References string_array::pack().
| bool version::unpack | ( | byte_array & | source | ) | [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 packable.
Definition at line 203 of file version_record.cpp.
References string_array::unpack().
| int 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 96 of file version_record.cpp.
References earth_time::convert(), get_component(), and MAJOR.
Referenced by bogus(), compatible(), portable::determine_OS(), process_control::find_process_in_list(), operator<(), and process_control::process_control().
| int version::v_minor | ( | ) | const |
minor version number.
Definition at line 99 of file version_record.cpp.
References earth_time::convert(), get_component(), and MINOR.
Referenced by bogus(), compatible(), portable::determine_OS(), process_control::find_process_in_list(), and operator<().
| int 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 102 of file version_record.cpp.
References earth_time::convert(), get_component(), and REVISION.
Referenced by bogus(), compatible(), portable::determine_OS(), operator<(), and process_control::process_control().
| int 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 105 of file version_record.cpp.
References BUILD, earth_time::convert(), and get_component().
Referenced by bogus(), and operator<().
| bool 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 136 of file version_record.cpp.
References v_major(), v_minor(), and v_revision().
Referenced by version_checker::good_version().
| bool version::bogus | ( | ) | const |
returns true if the version held here is clearly bogus.
this means that all four numbers are zero.
Definition at line 144 of file version_record.cpp.
References v_build(), v_major(), v_minor(), and v_revision().
Referenced by main().
1.5.1