blob: dbcec1b27d427b565affd25e773ff6bf57eb3047 [file] [log] [blame]
Steve Blocka7e24c12009-10-30 11:49:00 +00001// Copyright 2009 the V8 project authors. All rights reserved.
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
Steve Blocka7e24c12009-10-30 11:49:00 +00004
5#ifndef V8_VERSION_H_
6#define V8_VERSION_H_
7
Emily Bernierd0a1eb72015-03-24 16:35:39 -04008#include "src/base/functional.h"
9
Steve Blocka7e24c12009-10-30 11:49:00 +000010namespace v8 {
11namespace internal {
12
13class Version {
14 public:
15 // Return the various version components.
16 static int GetMajor() { return major_; }
17 static int GetMinor() { return minor_; }
18 static int GetBuild() { return build_; }
19 static int GetPatch() { return patch_; }
20 static bool IsCandidate() { return candidate_; }
Emily Bernierd0a1eb72015-03-24 16:35:39 -040021 static uint32_t Hash() {
22 return static_cast<uint32_t>(
23 base::hash_combine(major_, minor_, build_, patch_));
24 }
Steve Blocka7e24c12009-10-30 11:49:00 +000025
26 // Calculate the V8 version string.
27 static void GetString(Vector<char> str);
28
29 // Calculate the SONAME for the V8 shared library.
30 static void GetSONAME(Vector<char> str);
31
Steve Block44f0eee2011-05-26 01:26:41 +010032 static const char* GetVersion() { return version_string_; }
33
Steve Blocka7e24c12009-10-30 11:49:00 +000034 private:
Steve Block44f0eee2011-05-26 01:26:41 +010035 // NOTE: can't make these really const because of test-version.cc.
Steve Blocka7e24c12009-10-30 11:49:00 +000036 static int major_;
37 static int minor_;
38 static int build_;
39 static int patch_;
40 static bool candidate_;
41 static const char* soname_;
Steve Block44f0eee2011-05-26 01:26:41 +010042 static const char* version_string_;
Steve Blocka7e24c12009-10-30 11:49:00 +000043
44 // In test-version.cc.
45 friend void SetVersion(int major, int minor, int build, int patch,
46 bool candidate, const char* soname);
47};
48
49} } // namespace v8::internal
50
51#endif // V8_VERSION_H_