1// Copyright 2009 the V8 project authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef V8_UTILS_VERSION_H_ 6#define V8_UTILS_VERSION_H_ 7 8#include <cstdint> 9 10#include "src/base/functional.h" 11 12namespace v8 { 13 14namespace base { 15template <typename T> 16class Vector; 17} // namespace base 18 19namespace internal { 20 21class V8_EXPORT Version { 22 public: 23 // Return the various version components. 24 static int GetMajor() { return major_; } 25 static int GetMinor() { return minor_; } 26 static int GetBuild() { return build_; } 27 static int GetPatch() { return patch_; } 28 static const char* GetEmbedder() { return embedder_; } 29 static bool IsCandidate() { return candidate_; } 30 static uint32_t Hash() { 31 return static_cast<uint32_t>( 32 base::hash_combine(major_, minor_, build_, patch_)); 33 } 34 35 // Calculate the V8 version string. 36 static void GetString(base::Vector<char> str); 37 38 // Calculate the SONAME for the V8 shared library. 39 static void GetSONAME(base::Vector<char> str); 40 41 static const char* GetVersion() { return version_string_; } 42 43 private: 44 // NOTE: can't make these really const because of test-version.cc. 45 static int major_; 46 static int minor_; 47 static int build_; 48 static int patch_; 49 static const char* embedder_; 50 static bool candidate_; 51 static const char* soname_; 52 static const char* version_string_; 53 54 // In test-version.cc. 55 friend void SetVersion(int major, int minor, int build, int patch, 56 const char* embedder, bool candidate, 57 const char* soname); 58}; 59 60} // namespace internal 61} // namespace v8 62 63#endif // V8_UTILS_VERSION_H_ 64