converters.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. @class FIRGeoPoint;
  23. @class FIRTimestamp;
  24. NS_ASSUME_NONNULL_BEGIN
  25. namespace firebase {
  26. class Timestamp;
  27. namespace firestore {
  28. class GeoPoint;
  29. namespace api {
  30. /** Converts a user-supplied FIRGeoPoint to the equivalent C++ GeoPoint. */
  31. GeoPoint MakeGeoPoint(FIRGeoPoint* geo_point);
  32. /** Converts a C++ GeoPoint to the equivalent Objective-C FIRGeoPoint. */
  33. FIRGeoPoint* MakeFIRGeoPoint(const GeoPoint& geo_point);
  34. /** Converts a user-supplied FIRTimestamp to the equivalent C++ Timestamp. */
  35. Timestamp MakeTimestamp(FIRTimestamp* timestamp);
  36. Timestamp MakeTimestamp(NSDate* date);
  37. FIRTimestamp* MakeFIRTimestamp(const Timestamp& timestamp);
  38. } // namespace api
  39. } // namespace firestore
  40. } // namespace firebase
  41. NS_ASSUME_NONNULL_END
  42. #endif // FIRESTORE_SOURCE_API_CONVERTERS_H_