upload.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2017 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 <bsoncxx/array/value.hpp>
  16. #include <bsoncxx/types/bson_value/view.hpp>
  17. #include <mongocxx/config/prelude.hpp>
  18. namespace mongocxx {
  19. MONGOCXX_INLINE_NAMESPACE_BEGIN
  20. namespace result {
  21. namespace gridfs {
  22. /// Class representing the result of a GridFS upload operation.
  23. class MONGOCXX_API upload {
  24. public:
  25. upload(bsoncxx::types::bson_value::view id);
  26. ///
  27. /// Gets the id of the uploaded GridFS file.
  28. ///
  29. /// @return The id of the uploaded file.
  30. ///
  31. const bsoncxx::types::bson_value::view& id() const;
  32. private:
  33. // Array with a single element, containing the value of the _id field for the inserted files
  34. // collection document.
  35. bsoncxx::array::value _id_owned;
  36. // Points into _id_owned.
  37. bsoncxx::types::bson_value::view _id;
  38. friend MONGOCXX_API bool MONGOCXX_CALL operator==(const upload&, const upload&);
  39. friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const upload&, const upload&);
  40. };
  41. } // namespace gridfs
  42. } // namespace result
  43. MONGOCXX_INLINE_NAMESPACE_END
  44. } // namespace mongocxx
  45. #include <mongocxx/config/postlude.hpp>