summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util/version.h
blob: 980fe056d14b1c53a916d762e170c75d940d70bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_INSTALLER_UTIL_VERSION_H_
#define CHROME_INSTALLER_UTIL_VERSION_H_

#include "base/basictypes.h"
#include "base/string16.h"

namespace installer {

class Version {
 public:
  virtual ~Version();

  // Check if the current version is higher than the version object passed
  // as parameter
  bool IsHigherThan(const Version* other) const;

  // Return the string representation of this version
  const string16& GetString() const {
    return version_str_;
  }

  // Assume that the version string is specified by four integers separated
  // by character '.'. Return NULL if string is not of this format.
  // Caller is responsible for freeing the Version object once done.
  static Version* GetVersionFromString(const string16& version_str);

 private:
  int64 major_;
  int64 minor_;
  int64 build_;
  int64 patch_;
  string16 version_str_;

  // Classes outside this file do not have any need to create objects of
  // this type so declare constructor as private.
  Version(int64 major, int64 minor, int64 build, int64 patch);
};

}  // namespace installer

#endif  // CHROME_INSTALLER_UTIL_VERSION_H_