blob: 3395d7f4fe5589ff2afee64c0f7c353bb414e05d [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"
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00009#include "src/vector.h"
Emily Bernierd0a1eb72015-03-24 16:35:39 -040010
Steve Blocka7e24c12009-10-30 11:49:00 +000011namespace v8 {
12namespace internal {
13
14class 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 Bernierd0a1eb72015-03-24 16:35:39 -040022 static uint32_t Hash() {
23 return static_cast<uint32_t>(
24 base::hash_combine(major_, minor_, build_, patch_));
25 }
Steve Blocka7e24c12009-10-30 11:49:00 +000026
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 Block44f0eee2011-05-26 01:26:41 +010033 static const char* GetVersion() { return version_string_; }
34
Steve Blocka7e24c12009-10-30 11:49:00 +000035 private:
Steve Block44f0eee2011-05-26 01:26:41 +010036 // NOTE: can't make these really const because of test-version.cc.
Steve Blocka7e24c12009-10-30 11:49:00 +000037 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 Block44f0eee2011-05-26 01:26:41 +010043 static const char* version_string_;
Steve Blocka7e24c12009-10-30 11:49:00 +000044
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 Murdoch4a90d5f2016-03-22 12:00:34 +000050} // namespace internal
51} // namespace v8
Steve Blocka7e24c12009-10-30 11:49:00 +000052
53#endif // V8_VERSION_H_