delete.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright 2014 MongoDB Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma once
  15. #include <cstdint>
  16. #include <mongocxx/result/bulk_write.hpp>
  17. #include <mongocxx/config/prelude.hpp>
  18. namespace mongocxx {
  19. MONGOCXX_INLINE_NAMESPACE_BEGIN
  20. namespace result {
  21. ///
  22. /// Class representing the result of a MongoDB delete operation.
  23. ///
  24. class MONGOCXX_API delete_result {
  25. public:
  26. // This constructor is public for testing purposes only
  27. explicit delete_result(result::bulk_write result);
  28. ///
  29. /// Returns the bulk write result.
  30. ///
  31. /// @return The raw bulk write result.
  32. ///
  33. const result::bulk_write& result() const;
  34. ///
  35. /// Gets the number of documents that were deleted during this operation.
  36. ///
  37. /// @return The number of documents that were deleted.
  38. ///
  39. std::int32_t deleted_count() const;
  40. private:
  41. result::bulk_write _result;
  42. friend MONGOCXX_API bool MONGOCXX_CALL operator==(const delete_result&, const delete_result&);
  43. friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const delete_result&, const delete_result&);
  44. };
  45. } // namespace result
  46. MONGOCXX_INLINE_NAMESPACE_END
  47. } // namespace mongocxx
  48. #include <mongocxx/config/postlude.hpp>