BQuery: Make SetFlags() behave like other Set..() methods & add documentation.

This commit is contained in:
Augustin Cavalier
2025-05-01 12:36:43 -04:00
parent 77bb094872
commit e702bf57be
3 changed files with 28 additions and 3 deletions
+21
View File
@@ -330,6 +330,27 @@
*/ */
/*!
\fn status_t BQuery::SetFlags(uint32 flags)
\brief Sets the flags the query will be opened with.
The possible flags to set are defined in \file fs_query.h.
This methods fails if called after Fetch(). To reuse the BQuery object it
must first be reset via Clear().
\note The \c B_LIVE_QUERY flag will be ignored; BQuery always sets it automatically if necessary.
\param flags The flags to set.
\return A status code.
\retval B_OK Everything went fine.
\retval B_NOT_ALLOWED SetFlags() was called after Fetch().
\since Haiku R1
*/
//! @} //! @}
+1 -1
View File
@@ -63,7 +63,7 @@ public:
status_t SetVolume(const BVolume* volume); status_t SetVolume(const BVolume* volume);
status_t SetPredicate(const char* expression); status_t SetPredicate(const char* expression);
status_t SetTarget(BMessenger messenger); status_t SetTarget(BMessenger messenger);
void SetFlags(uint32 flags); status_t SetFlags(uint32 flags);
bool IsLive() const; bool IsLive() const;
+6 -2
View File
@@ -231,10 +231,14 @@ BQuery::SetTarget(BMessenger messenger)
} }
void status_t
BQuery::SetFlags(uint32 flags) BQuery::SetFlags(uint32 flags)
{ {
fFlags = flags; if (_HasFetched())
return B_NOT_ALLOWED;
fFlags = (flags & ~B_LIVE_QUERY);
return B_OK;
} }