C++: fix remaining doxygen warnings in image.h and string.h

This commit is contained in:
Simon Hausmann 2021-06-25 21:07:01 +02:00
parent 7e3e6faa31
commit 25820b57d4
2 changed files with 13 additions and 0 deletions

View file

@ -54,7 +54,9 @@ public:
/// Returns the size of the Image in pixels. /// Returns the size of the Image in pixels.
Size size() const { return cbindgen_private::types::sixtyfps_image_size(&data); } Size size() const { return cbindgen_private::types::sixtyfps_image_size(&data); }
/// Returns true if \a a refers to the same image as \a b; false otherwise.
friend bool operator==(const Image &a, const Image &b) { return a.data == b.data; } friend bool operator==(const Image &a, const Image &b) { return a.data == b.data; }
/// Returns false if \a a refers to the same image as \a b; true otherwise.
friend bool operator!=(const Image &a, const Image &b) { return a.data != b.data; } friend bool operator!=(const Image &a, const Image &b) { return a.data != b.data; }
private: private:

View file

@ -87,7 +87,11 @@ struct SharedString
return cbindgen_private::sixtyfps_shared_string_bytes(this); return cbindgen_private::sixtyfps_shared_string_bytes(this);
} }
/// Returns a pointer to the first character. It is only safe to dereference the pointer if the
/// string contains at least one character.
const char *begin() const { return data(); } const char *begin() const { return data(); }
/// Returns a point past the last character of the string. It is not safe to dereference the
/// pointer, but it is suitable for comparison.
const char *end() const { return &*std::string_view(*this).end(); } const char *end() const { return &*std::string_view(*this).end(); }
/// \return true if the string contains no characters; false otherwise. /// \return true if the string contains no characters; false otherwise.
@ -131,18 +135,22 @@ struct SharedString
return std::string_view(a) != std::string_view(b); return std::string_view(a) != std::string_view(b);
} }
/// Returns true if \a a is lexicographically less than \a b; false otherwise.
friend bool operator<(const SharedString &a, const SharedString &b) friend bool operator<(const SharedString &a, const SharedString &b)
{ {
return std::string_view(a) < std::string_view(b); return std::string_view(a) < std::string_view(b);
} }
/// Returns true if \a a is lexicographically less or equal than \a b; false otherwise.
friend bool operator<=(const SharedString &a, const SharedString &b) friend bool operator<=(const SharedString &a, const SharedString &b)
{ {
return std::string_view(a) <= std::string_view(b); return std::string_view(a) <= std::string_view(b);
} }
/// Returns true if \a a is lexicographically greater than \a b; false otherwise.
friend bool operator>(const SharedString &a, const SharedString &b) friend bool operator>(const SharedString &a, const SharedString &b)
{ {
return std::string_view(a) > std::string_view(b); return std::string_view(a) > std::string_view(b);
} }
/// Returns true if \a a is lexicographically greater or equal than \a b; false otherwise.
friend bool operator>=(const SharedString &a, const SharedString &b) friend bool operator>=(const SharedString &a, const SharedString &b)
{ {
return std::string_view(a) >= std::string_view(b); return std::string_view(a) >= std::string_view(b);
@ -155,16 +163,19 @@ struct SharedString
return stream << std::string_view(shared_string); return stream << std::string_view(shared_string);
} }
/// Concatenates \a a and \a and returns the result as a new SharedString.
friend SharedString operator+(const SharedString &a, std::string_view b) friend SharedString operator+(const SharedString &a, std::string_view b)
{ {
SharedString a2 = a; SharedString a2 = a;
return a2 += b; return a2 += b;
} }
/// Move-concatenates \a b to \a and returns a reference to \a a.
friend SharedString operator+(SharedString &&a, std::string_view b) friend SharedString operator+(SharedString &&a, std::string_view b)
{ {
a += b; a += b;
return a; return a;
} }
/// Appends \a other to this string and returns a reference to this.
SharedString &operator+=(std::string_view other) SharedString &operator+=(std::string_view other)
{ {
cbindgen_private::sixtyfps_shared_string_append(this, other.data(), other.size()); cbindgen_private::sixtyfps_shared_string_append(this, other.data(), other.size());