trunk/branch integration: isNil() / isNull() / tryParse()

This commit is contained in:
Marian Krivos
2011-08-22 18:08:59 +00:00
parent 663a5ecc96
commit dc7d9a88b3

View File

@@ -96,6 +96,12 @@ public:
void parse(const std::string& uuid); void parse(const std::string& uuid);
/// Parses the UUID from its string representation. /// Parses the UUID from its string representation.
bool tryParse(const std::string& uuid);
/// Tries to interpret the given string as an UUID.
/// If the UUID is syntactically valid, assigns the
/// members and returns true. Otherwise leaves the
/// object unchanged and returns false.
std::string toString() const; std::string toString() const;
/// Returns a string representation of the UUID consisting /// Returns a string representation of the UUID consisting
/// of groups of hexadecimal digits separated by hyphens. /// of groups of hexadecimal digits separated by hyphens.
@@ -129,12 +135,12 @@ public:
bool operator > (const UUID& uuid) const; bool operator > (const UUID& uuid) const;
bool operator >= (const UUID& uuid) const; bool operator >= (const UUID& uuid) const;
bool isNil() const; bool isNull() const;
/// Returns true iff the UUID is nil (in other words, /// Returns true iff the UUID is nil (in other words,
/// consists of all zeros). /// consists of all zeros).
static const UUID& nil(); static const UUID& null();
/// Returns a nil UUID. /// Returns a null/nil UUID.
static const UUID& dns(); static const UUID& dns();
/// Returns the namespace identifier for the DNS namespace. /// Returns the namespace identifier for the DNS namespace.
@@ -215,9 +221,9 @@ inline UUID::Version UUID::version() const
} }
inline bool UUID::isNil() const inline bool UUID::isNull() const
{ {
return compare(nil()) == 0; return compare(null()) == 0;
} }