FIRPerformanceAttributable.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2020 Google LLC
  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. #import <Foundation/Foundation.h>
  15. /** Defines the interface that allows adding/removing attributes to any object.
  16. */
  17. NS_SWIFT_NAME(PerformanceAttributable)
  18. @protocol FIRPerformanceAttributable <NSObject>
  19. /** List of attributes. */
  20. @property(nonatomic, nonnull, readonly) NSDictionary<NSString *, NSString *> *attributes;
  21. /**
  22. * Sets a value as a string for the specified attribute. Updates the value of the attribute if a
  23. * value had already existed.
  24. *
  25. * @param value The value that needs to be set/updated for an attribute. If the length of the value
  26. * exceeds the maximum allowed, the value will be truncated to the maximum allowed.
  27. * @param attribute The name of the attribute. If the length of the value exceeds the maximum
  28. * allowed, the value will be truncated to the maximum allowed.
  29. */
  30. - (void)setValue:(nonnull NSString *)value forAttribute:(nonnull NSString *)attribute;
  31. /**
  32. * Reads the value for the specified attribute. If the attribute does not exist, returns nil.
  33. *
  34. * @param attribute The name of the attribute.
  35. * @return The value for the attribute. Returns nil if the attribute does not exist.
  36. */
  37. - (nullable NSString *)valueForAttribute:(nonnull NSString *)attribute;
  38. /**
  39. * Removes an attribute from the list. Does nothing if the attribute does not exist.
  40. *
  41. * @param attribute The name of the attribute.
  42. */
  43. - (void)removeAttribute:(nonnull NSString *)attribute;
  44. @end