converters.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright 2019 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef FIRESTORE_SOURCE_API_CONVERTERS_H_
  17. #define FIRESTORE_SOURCE_API_CONVERTERS_H_
  18. #if !defined(__OBJC__)
  19. #error "This header only supports Objective-C++"
  20. #endif // !defined(__OBJC__)
  21. #import <Foundation/Foundation.h>
  22. #include <memory>
  23. @class FIRGeoPoint;
  24. @class FIRTimestamp;
  25. @class FIRDocumentReference;
  26. NS_ASSUME_NONNULL_BEGIN
  27. namespace firebase {
  28. class Timestamp;
  29. namespace firestore {
  30. class GeoPoint;
  31. namespace model {
  32. class DocumentKey;
  33. }
  34. namespace api {
  35. class Firestore;
  36. /** Converts a user-supplied FIRGeoPoint to the equivalent C++ GeoPoint. */
  37. GeoPoint MakeGeoPoint(FIRGeoPoint* geo_point);
  38. /** Converts a C++ GeoPoint to the equivalent Objective-C FIRGeoPoint. */
  39. FIRGeoPoint* MakeFIRGeoPoint(const GeoPoint& geo_point);
  40. /** Converts a user-supplied FIRTimestamp to the equivalent C++ Timestamp. */
  41. Timestamp MakeTimestamp(FIRTimestamp* timestamp);
  42. Timestamp MakeTimestamp(NSDate* date);
  43. FIRTimestamp* MakeFIRTimestamp(const Timestamp& timestamp);
  44. FIRDocumentReference* MakeFIRDocumentReference(const model::DocumentKey& document_key,
  45. std::shared_ptr<Firestore> firestore);
  46. } // namespace api
  47. } // namespace firestore
  48. } // namespace firebase
  49. NS_ASSUME_NONNULL_END
  50. #endif // FIRESTORE_SOURCE_API_CONVERTERS_H_