| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_INSTALLER_UTIL_VERSION_H__ | 5 #ifndef CHROME_INSTALLER_UTIL_VERSION_H_ |
| 6 #define CHROME_INSTALLER_UTIL_VERSION_H__ | 6 #define CHROME_INSTALLER_UTIL_VERSION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 | 11 |
| 12 namespace installer { | 12 namespace installer { |
| 13 | 13 |
| 14 class Version { | 14 class Version { |
| 15 public: | 15 public: |
| 16 virtual ~Version(); | 16 virtual ~Version(); |
| 17 | 17 |
| 18 // Check if the current version is higher than the version object passed | 18 // Check if the current version is higher than the version object passed |
| 19 // as parameter | 19 // as parameter |
| 20 bool IsHigherThan(const Version* other) const; | 20 bool IsHigherThan(const Version* other) const; |
| 21 | 21 |
| 22 // Return the string representation of this version | 22 // Return the string representation of this version |
| 23 const std::wstring& GetString() const { | 23 const std::wstring& GetString() const { |
| 24 return version_str_; | 24 return version_str_; |
| 25 } | 25 } |
| 26 | 26 |
| 27 // Assume that the version string is specified by four integers separated | 27 // Assume that the version string is specified by four integers separated |
| 28 // by character '.'. Return NULL if string is not of this format. | 28 // by character '.'. Return NULL if string is not of this format. |
| 29 // Caller is responsible for freeing the Version object once done. | 29 // Caller is responsible for freeing the Version object once done. |
| 30 static Version* GetVersionFromString(std::wstring version_str); | 30 static Version* GetVersionFromString(const std::wstring& version_str); |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 int64 major_; | 33 int64 major_; |
| 34 int64 minor_; | 34 int64 minor_; |
| 35 int64 build_; | 35 int64 build_; |
| 36 int64 patch_; | 36 int64 patch_; |
| 37 std::wstring version_str_; | 37 std::wstring version_str_; |
| 38 | 38 |
| 39 // Classes outside this file do not have any need to create objects of | 39 // Classes outside this file do not have any need to create objects of |
| 40 // this type so declare constructor as private. | 40 // this type so declare constructor as private. |
| 41 Version(int64 major, int64 minor, int64 build, int64 patch); | 41 Version(int64 major, int64 minor, int64 build, int64 patch); |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 } // namespace installer | 44 } // namespace installer |
| 45 | 45 |
| 46 #endif | 46 #endif |
| OLD | NEW |