22 using namespace basis;
26 void *version::__global_module_handle()
28 static void *__mod_hand = 0;
44 for (
int i = 0; i < _components->
length(); i++) {
45 if (!(*_components)[i]) {
47 (*_components)[i] =
"0";
55 astring verstring = formatted_string;
57 for (
int j = 0; j < verstring.
length(); j++) {
58 if (verstring[j] ==
',') verstring[j] =
'.';
62 for (
int i = 0; i < verstring.
length(); i++) {
63 int perindy = verstring.
find(
'.', i);
65 if (verstring.
length() - i > 0) {
73 *_components += verstring.
substring(i, perindy - 1);
94 if (
this != &to_copy) *_components = *to_copy._components;
117 return (*_components)[index];
122 if (_components->
length() <= index)
123 _components->
resize(index + 1);
125 (*_components)[index] = to_set;
127 (*_components)[index] =
"0";
133 return *_components == *cast->_components;
161 if (style != DOTS) to_return += ", "; \
162 else to_return += "."
170 if (style ==
DETAILED) to_return +=
"major ";
172 if (!temp) temp =
"0";
174 if (where ==
MAJOR)
return to_return;
177 if (style ==
DETAILED) to_return +=
"minor ";
179 if (!temp) temp =
"0";
181 if (where ==
MINOR)
return to_return;
184 if (style ==
DETAILED) to_return +=
"revision ";
186 if (!temp) temp =
"0";
188 if (where ==
REVISION)
return to_return;
191 if (style ==
DETAILED) to_return +=
"build ";
193 if (!temp) temp =
"0";
198 for (
int i =
BUILD + 1; i < where; i++) {
202 if (!temp) temp =
"0";
211 {
return version(to_convert); }
219 { _components->
pack(target); }
223 if (!_components->
unpack(source))
return false;
229 #define VR_NEWLINE to_return += "\n"
237 to_return +=
"Description: ";
240 to_return +=
"File Version: ";
243 to_return +=
"Internal Name: ";
246 to_return +=
"Original Name: ";
249 to_return +=
"Product Name: ";
252 to_return +=
"Product Version: ";
255 to_return +=
"Company Name: ";
258 to_return +=
"Copyright: ";
261 to_return +=
"Trademarks: ";
a_sprintf is a specialization of astring that provides printf style support.
outcome resize(int new_size, how_to_copy way=NEW_AT_END)
Changes the size of the C array to "new_size".
int length() const
Returns the current reported length of the allocated C array.
Provides a dynamically resizable ASCII character string.
bool t() const
t() is a shortcut for the string being "true", as in non-empty.
bool substring(astring &target, int start, int end) const
a version that stores the substring in an existing "target" string.
int end() const
returns the index of the last (non-null) character in the string.
int length() const
Returns the current length of the string.
int find(char to_find, int position=0, bool reverse=false) const
Locates "to_find" in "this".
A very common template for a dynamic array of bytes.
Base class for object that can tell itself apart from other instances.
A base for objects that can be alphabetically (lexicographically) ordered.
An array of strings with some additional helpful methods.
virtual void pack(basis::byte_array &packed_form) const
Packs this string array into the "packed_form" byte array.
virtual bool unpack(basis::byte_array &packed_form)
Unpacks a string array from the "packed_form" byte array.
virtual int packed_size() const
Returns the number of bytes this string array would consume if packed.
basis::astring product_name
basis::astring text_form() const
basis::astring company_name
basis::astring description
basis::astring original_name
basis::astring trademarks
virtual ~version_record()
basis::astring internal_name
Holds a file's version identifier.
virtual basis::astring text_form() const
virtual void pack(basis::byte_array &target) const
Creates a packed form of the packable object in "packed_form".
static version from_text(const basis::astring &to_convert)
returns a version structure parsed from "to_convert".
basis::astring get_component(int index) const
returns the component at the specified index.
int components() const
reports the number of components that make up this version.
virtual int packed_size() const
Estimates the space needed for the packed structure.
void set_component(int index, const basis::astring &to_set)
sets the component at "index" to "to_set".
bool bogus() const
returns true if the version held here is clearly bogus.
bool equal_to(const equalizable &to_test) const
compares two versions for exact equality.
bool less_than(const orderable &to_test) const
reports if this version is less than "to_test".
int v_minor() const
minor version number.
int v_major() const
major version number.
int v_build() const
build number.
int v_revision() const
revision level.
bool compatible(const version &that) const
returns true if this is compatible with "that" version on win32.
version()
constructs a blank version.
version & operator=(const version &to_copy)
assigns this to the "to_copy".
virtual bool unpack(basis::byte_array &source)
Restores the packable from the "packed_form".
basis::astring flex_text_form(version_style style=DOTS, int including=-1) const
returns a textual form of the version number.
#define bounds_return(value, low, high, to_return)
Verifies that "value" is between "low" and "high", inclusive.
The guards collection helps in testing preconditions and reporting errors.
void WHACK(contents *&ptr)
deletion with clearing of the pointer.
target_type * cast_or_throw(source_type &to_cast, const target_type &ignored)
dynamically converts a type to a target type, or throws an exception if it cannot.
unsigned int un_int
Abbreviated name for unsigned integers.
bool negative(const type &a)
negative returns true if "a" is less than zero.
A dynamic container class that holds any kind of object via pointers.
time_locus convert(time_number seconds, time_number useconds, const tm &cal_values)