mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-29 11:01:57 +00:00
HasValue -> HasValueForMaybe_
This commit is contained in:
parent
b71cf25186
commit
95f6460e6e
@ -63,7 +63,7 @@ struct Id {
|
|||||||
// Needed for google::dense_hash_map.
|
// Needed for google::dense_hash_map.
|
||||||
explicit operator RawId() const { return id; }
|
explicit operator RawId() const { return id; }
|
||||||
|
|
||||||
bool HasValue() const { return id != RawId(-1); }
|
bool HasValueForMaybe_() const { return id != RawId(-1); }
|
||||||
|
|
||||||
bool operator==(const Id& o) const { return id == o.id; }
|
bool operator==(const Id& o) const { return id == o.id; }
|
||||||
bool operator!=(const Id& o) const { return id != o.id; }
|
bool operator!=(const Id& o) const { return id != o.id; }
|
||||||
@ -112,7 +112,7 @@ struct Reference {
|
|||||||
SymbolKind kind;
|
SymbolKind kind;
|
||||||
Role role;
|
Role role;
|
||||||
|
|
||||||
bool HasValue() const { return range.HasValue(); }
|
bool HasValueForMaybe_() const { return range.HasValueForMaybe_(); }
|
||||||
operator SymbolIdx() const { return {id, kind}; }
|
operator SymbolIdx() const { return {id, kind}; }
|
||||||
std::tuple<Range, Id<void>, SymbolKind, Role> ToTuple() const {
|
std::tuple<Range, Id<void>, SymbolKind, Role> ToTuple() const {
|
||||||
return std::make_tuple(range, id, kind, role);
|
return std::make_tuple(range, id, kind, role);
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
// Like optional, but the stored data is responsible for containing the empty
|
||||||
|
// state. T should define a function `bool T::HasValueForMaybe_()`.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class Maybe {
|
class Maybe {
|
||||||
T storage;
|
T storage;
|
||||||
@ -27,7 +29,7 @@ public:
|
|||||||
T& operator*() { return storage; }
|
T& operator*() { return storage; }
|
||||||
|
|
||||||
bool has_value() const {
|
bool has_value() const {
|
||||||
return storage.HasValue();
|
return storage.HasValueForMaybe_();
|
||||||
}
|
}
|
||||||
explicit operator bool() const { return has_value(); }
|
explicit operator bool() const { return has_value(); }
|
||||||
operator optional<T>() const {
|
operator optional<T>() const {
|
||||||
|
@ -15,7 +15,7 @@ struct Position {
|
|||||||
Position(int16_t line, int16_t column);
|
Position(int16_t line, int16_t column);
|
||||||
explicit Position(const char* encoded);
|
explicit Position(const char* encoded);
|
||||||
|
|
||||||
bool HasValue() const { return line >= 0; }
|
bool HasValueForMaybe_() const { return line >= 0; }
|
||||||
std::string ToString();
|
std::string ToString();
|
||||||
std::string ToPrettyString(const std::string& filename);
|
std::string ToPrettyString(const std::string& filename);
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ struct Range {
|
|||||||
Range(Position start, Position end);
|
Range(Position start, Position end);
|
||||||
explicit Range(const char* encoded);
|
explicit Range(const char* encoded);
|
||||||
|
|
||||||
bool HasValue() const { return start.HasValue(); }
|
bool HasValueForMaybe_() const { return start.HasValueForMaybe_(); }
|
||||||
bool Contains(int line, int column) const;
|
bool Contains(int line, int column) const;
|
||||||
Range RemovePrefix(Position position) const;
|
Range RemovePrefix(Position position) const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user