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

Unified Diff: base/version.h

Issue 7105008: Clean up base/Version (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/version.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/version.h
===================================================================
--- base/version.h (revision 86383)
+++ base/version.h (working copy)
@@ -15,22 +15,27 @@
// Version represents a dotted version number, like "1.2.3.4", supporting
// parsing and comparison.
-// Each component is limited to a uint16.
class BASE_API Version {
public:
- // Exposed only so that a Version can be stored in STL containers;
- // any call to the methods below on a default-constructed Version
- // will DCHECK.
+ // The only thing you can legally do to a default constructed
+ // Version object is assign to it.
Version();
- ~Version();
+ // Initializes from a decimal dotted version number, like "0.1.1".
+ // Each component is limited to a uint16. Call IsValid() to learn
+ // the outcome.
+ explicit Version(const std::string& version_str);
- // The version string must be made up of 1 or more uint16's separated
- // by '.'. Returns NULL if string is not in this format.
+ // Returns true if the object contains a valid version number.
+ bool IsValid() const;
+
+ // Returns NULL if the string is not in the proper format.
// Caller is responsible for freeing the Version object once done.
+ // DO NOT USE FOR NEWER CODE.
static Version* GetVersionFromString(const std::string& version_str);
- // Creates a copy of this version. Caller takes ownership.
+ // Creates a copy of this version object. Caller takes ownership.
+ // DO NOT USE FOR NEWER CODE.
Version* Clone() const;
bool Equals(const Version& other) const;
@@ -44,14 +49,7 @@
const std::vector<uint16>& components() const { return components_; }
private:
- bool InitFromString(const std::string& version_str);
-
- bool is_valid_;
std::vector<uint16> components_;
-
- FRIEND_TEST_ALL_PREFIXES(VersionTest, DefaultConstructor);
- FRIEND_TEST_ALL_PREFIXES(VersionTest, GetVersionFromString);
- FRIEND_TEST_ALL_PREFIXES(VersionTest, Compare);
};
#endif // BASE_VERSION_H_
« no previous file with comments | « no previous file | base/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698