Fix some lines that exceed 80 characters.
[wvstreams.git] / include / wvverstring.h
bloba5f43297f8bf271393140f87c873970f298c7b4f
1 /* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2004 Net Integration Technologies, Inc.
5 * Version number and string manipulations.
7 * The old version number was a 32-bit hexadecimal number, split into a 16-bit
8 * major version and a 16-bit minor version. For example, the old-style string
9 * equivalent of 0x00012a00 would be "1.2a".
11 * The new-style version number is a 32-bit hexadecimal number, split into
12 * an 8-bit major version, an 8-bit minor version, and a 16-bit revision
13 * number. The new-style string equivalent of 0x01020150 would be "1.02.0150".
15 #ifndef __WVVERSTRING_H
16 #define __WVVERSTRING_H
18 /** Converts a version number to a C string.
19 * This uses is_new_ver() to determine which style to use for the resulting
20 * string.
22 const char *ver_to_string(unsigned int ver);
24 /// Converts a version number to a C string using the old style.
25 const char *old_ver_to_string(unsigned int ver);
27 /// Converts a version number to a C string using the new sytle.
28 const char *new_ver_to_string(unsigned int ver);
30 /** Converts a C string to a version number.
31 * This uses is_new_verstr() to determine which style to use for the resulting
32 * version integer.
34 unsigned int string_to_ver(const char *str);
36 /// Converts a C string to a version number using the old style.
37 unsigned int string_to_old_ver(const char *str);
39 /// Converts a C string to a version number using the new style.
40 unsigned int string_to_new_ver(const char *str);
42 /** Returns true if 'ver' is in the new style.
43 * If the first two hex digits are non-zero, it is the old style; otherwise,
44 * it's the new style. This somewhat arbitrary distinction was made to ease
45 * migration of some WvStreams projects. Use the specific new and old
46 * functions if you don't like this.
48 bool is_new_ver(unsigned int ver);
50 /** Returns true if 'str' is in the new style.
51 * If there are 2 periods ('.') in the string, it is the new style; otherwise,
52 * it's the old style.
54 bool is_new_verstr(const char *str);
56 /** Trims zeroes off the end of a version string.
57 * Used by old-style functions only.
59 char *trim_verstr(char *verstr);
61 #endif // __WVVERSTRING_H