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 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 8 | #include "src/base/functional.h" |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 9 | #include "src/vector.h" |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 10 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 11 | namespace v8 { |
| 12 | namespace internal { |
| 13 | |
| 14 | class Version { |
| 15 | public: |
| 16 | // Return the various version components. |
| 17 | static int GetMajor() { return major_; } |
| 18 | static int GetMinor() { return minor_; } |
| 19 | static int GetBuild() { return build_; } |
| 20 | static int GetPatch() { return patch_; } |
| 21 | static bool IsCandidate() { return candidate_; } |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame] | 22 | static uint32_t Hash() { |
| 23 | return static_cast<uint32_t>( |
| 24 | base::hash_combine(major_, minor_, build_, patch_)); |
| 25 | } |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 26 | |
| 27 | // Calculate the V8 version string. |
| 28 | static void GetString(Vector<char> str); |
| 29 | |
| 30 | // Calculate the SONAME for the V8 shared library. |
| 31 | static void GetSONAME(Vector<char> str); |
| 32 | |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 33 | static const char* GetVersion() { return version_string_; } |
| 34 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 35 | private: |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 36 | // NOTE: can't make these really const because of test-version.cc. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 37 | static int major_; |
| 38 | static int minor_; |
| 39 | static int build_; |
| 40 | static int patch_; |
| 41 | static bool candidate_; |
| 42 | static const char* soname_; |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 43 | static const char* version_string_; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 44 | |
| 45 | // In test-version.cc. |
| 46 | friend void SetVersion(int major, int minor, int build, int patch, |
| 47 | bool candidate, const char* soname); |
| 48 | }; |
| 49 | |
Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 50 | } // namespace internal |
| 51 | } // namespace v8 |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 52 | |
| 53 | #endif // V8_VERSION_H_ |