Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 1 | // Copyright 2009 the V8 project authors. All rights reserved. |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 4 | |
| 5 | #ifndef V8_VERSION_H_ |
| 6 | #define V8_VERSION_H_ |
| 7 | |
| 8 | namespace v8 { |
| 9 | namespace internal { |
| 10 | |
| 11 | class Version { |
| 12 | public: |
| 13 | // Return the various version components. |
| 14 | static int GetMajor() { return major_; } |
| 15 | static int GetMinor() { return minor_; } |
| 16 | static int GetBuild() { return build_; } |
| 17 | static int GetPatch() { return patch_; } |
| 18 | static bool IsCandidate() { return candidate_; } |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 19 | static int Hash() { return (major_ << 20) ^ (minor_ << 10) ^ patch_; } |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 20 | |
| 21 | // Calculate the V8 version string. |
| 22 | static void GetString(Vector<char> str); |
| 23 | |
| 24 | // Calculate the SONAME for the V8 shared library. |
| 25 | static void GetSONAME(Vector<char> str); |
| 26 | |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 27 | static const char* GetVersion() { return version_string_; } |
| 28 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 29 | private: |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 30 | // NOTE: can't make these really const because of test-version.cc. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 31 | static int major_; |
| 32 | static int minor_; |
| 33 | static int build_; |
| 34 | static int patch_; |
| 35 | static bool candidate_; |
| 36 | static const char* soname_; |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 37 | static const char* version_string_; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 38 | |
| 39 | // In test-version.cc. |
| 40 | friend void SetVersion(int major, int minor, int build, int patch, |
| 41 | bool candidate, const char* soname); |
| 42 | }; |
| 43 | |
| 44 | } } // namespace v8::internal |
| 45 | |
| 46 | #endif // V8_VERSION_H_ |