Advanced Strategic Command
strtmesg.cpp
Go to the documentation of this file.
1 /*
2  This file is part of Advanced Strategic Command; http://www.asc-hq.de
3  Copyright (C) 1994-2010 Martin Bickel and Marc Schellenberger
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; see the file COPYING. If not, write to the
17  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  Boston, MA 02111-1307 USA
19 */
20 
21 
22 // These strings should be the same as the release tags in CVS !
23 // don't alter the format of this string, as quite a lot of tools evaluate it!
24 const char* asc_release="ASC2.8.0.2";
25 
26 #include <stdio.h>
27 #include "strtmesg.h"
28 #include "stringtokenizer.h"
29 #include "misc.h"
30 
31 
32 const char* getVersionString()
33 {
34  return &asc_release[3];
35 }
36 
38 {
39  int vers = 0;
40  const char* d = asc_release+3;
41  for ( int i = 0; i < 4; i++ ) {
42  vers *= 256;
43  if ( *d ) {
44  const char* start = d;
45  do
46  d++;
47  while ( *d != '.' && *d != 0 );
48 
49  ASCString s ( start, d-start );
50  vers += atoi ( s.c_str() );
51  if ( *d )
52  d++;
53  }
54  }
55  return vers;
56 }
57 
58 const char* getFullVersionString ( )
59 {
60  return asc_release;
61 }
62 
64 {
65  char startupmessagebuffer[1000];
66  sprintf( startupmessagebuffer, "Version: %s", asc_release);
67  return ASCString(startupmessagebuffer);
68 }
69 
71 {
72  ASCString s = "\nAdvanced Strategic Command\n" + getVersionAndCompilation();
73  return s;
74 }
75 
77 {
78  char startupmessagebuffer[1000];
79  sprintf( startupmessagebuffer, "Advanced Strategic Command : %s ", asc_release);
80  return ASCString(startupmessagebuffer);
81 }
82 
84 {
85  char startupmessagebuffer[1000];
86  sprintf( startupmessagebuffer, "\n Mapeditor for\nAdvanced Strategic Command \n%s\n", asc_release);
87  return ASCString(startupmessagebuffer);
88 }
89 
91 {
92  char startupmessagebuffer[1000];
93  sprintf( startupmessagebuffer, "Mapeditor for Advanced Strategic Command : %s ", asc_release);
94  return ASCString(startupmessagebuffer);
95 }
96 
97 ASCString getVersionString ( int version )
98 {
99  ASCString s = strrr(version>>24);
100  s += ".";
101  s += strrr((version>>16) & 0xff);
102  s += ".";
103  s += strrr((version>>8) & 0xff);
104  s += ".";
105  s += strrr(version & 0xff);
106  return s;
107 }
108 
const char * getFullVersionString()
Definition: strtmesg.cpp:58
int getNumericVersion()
Definition: strtmesg.cpp:37
miscellaneous functions which are used by ASC and all its tools
ASCString getaboutmessage()
Definition: strtmesg.cpp:76
ASCString getVersionAndCompilation()
Version: 1.2.3 ; compiled : ...
Definition: strtmesg.cpp:63
The ASCString class provides an abstract way to manipulate strings.
Definition: ascstring.h:14
char * strrr(int a)
converts a to a string.
Definition: misc.cpp:66
A simple string tokenizer.
ASCString kgetstartupmessage()
Definition: strtmesg.cpp:83
ASCString getstartupmessage()
Definition: strtmesg.cpp:70
int atoi(const std::string &s)
Definition: misc.cpp:152
ASCString kgetaboutmessage()
Definition: strtmesg.cpp:90
const char * asc_release
Definition: strtmesg.cpp:24
const char * getVersionString()
Definition: strtmesg.cpp:32