converters.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #import "FIRSnapshotListenOptions.h"
  24. #import "Firestore/core/src/api/listen_source.h"
  25. @class FIRGeoPoint;
  26. @class FIRTimestamp;
  27. @class FIRDocumentReference;
  28. NS_ASSUME_NONNULL_BEGIN
  29. namespace firebase {
  30. class Timestamp;
  31. namespace firestore {
  32. class GeoPoint;
  33. namespace model {
  34. class DocumentKey;
  35. }
  36. namespace api {
  37. class Firestore;
  38. /** Converts a user-supplied FIRGeoPoint to the equivalent C++ GeoPoint. */
  39. GeoPoint MakeGeoPoint(FIRGeoPoint* geo_point);
  40. /** Converts a C++ GeoPoint to the equivalent Objective-C FIRGeoPoint. */
  41. FIRGeoPoint* MakeFIRGeoPoint(const GeoPoint& geo_point);
  42. /** Converts a user-supplied FIRTimestamp to the equivalent C++ Timestamp. */
  43. Timestamp MakeTimestamp(FIRTimestamp* timestamp);
  44. Timestamp MakeTimestamp(NSDate* date);
  45. FIRTimestamp* MakeFIRTimestamp(const Timestamp& timestamp);
  46. FIRDocumentReference* MakeFIRDocumentReference(const model::DocumentKey& document_key,
  47. std::shared_ptr<Firestore> firestore);
  48. ListenSource MakeListenSource(const FIRListenSource& source);
  49. } // namespace api
  50. } // namespace firestore
  51. } // namespace firebase
  52. NS_ASSUME_NONNULL_END
  53. #endif // FIRESTORE_SOURCE_API_CONVERTERS_H_