Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: base/version.h

Issue 19667: Add a Version class and matching unit tests, roughly based on chrome/installe... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/build/base_unittests.vcproj ('k') | base/version.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef BASE_VERSION_H_
6 #define BASE_VERSION_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/basictypes.h"
12
13 class Version {
14 public:
15
16 // The version string must be made up of 1 or more uint16's separated
17 // by '.'. Returns NULL if string is not in this format.
18 // Caller is responsible for freeing the Version object once done.
19 static Version* GetVersionFromString(const std::wstring& version_str);
20 static Version* GetVersionFromString(const std::string& version_str);
21
22 ~Version() {}
23
24 bool Equals(const Version& other) const;
25
26 // Returns -1, 0, 1 for <, ==, >.
27 int CompareTo(const Version& other) const;
28
29 // Return the string representation of this version.
30 const std::string GetString() const;
31
32 const std::vector<uint16>& components() const { return components_; }
33
34 private:
35 Version() {}
36 bool InitFromString(const std::string& version_str);
37
38 std::vector<uint16> components_;
39
40 DISALLOW_COPY_AND_ASSIGN(Version);
41 };
42
43 #endif // BASE_VERSION_H_
44
OLDNEW
« no previous file with comments | « base/build/base_unittests.vcproj ('k') | base/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698