skiff_schema-inl.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #pragma once
  2. #ifndef SKIFF_SCHEMA_H
  3. #error "Direct inclusion of this file is not allowed, include skiff_schema.h"
  4. // For the sake of sane code completion.
  5. #include "skiff_schema.h"
  6. #endif
  7. #undef SKIFF_SCHEMA_H
  8. namespace NSkiff {
  9. ////////////////////////////////////////////////////////////////////////////////
  10. inline bool IsSimpleType(EWireType type)
  11. {
  12. switch (type) {
  13. case EWireType::Int8:
  14. case EWireType::Int16:
  15. case EWireType::Int32:
  16. case EWireType::Int64:
  17. case EWireType::Int128:
  18. case EWireType::Uint8:
  19. case EWireType::Uint16:
  20. case EWireType::Uint32:
  21. case EWireType::Uint64:
  22. case EWireType::Uint128:
  23. case EWireType::Double:
  24. case EWireType::Boolean:
  25. case EWireType::String32:
  26. case EWireType::Yson32:
  27. case EWireType::Nothing:
  28. return true;
  29. case EWireType::Tuple:
  30. case EWireType::Variant8:
  31. case EWireType::Variant16:
  32. case EWireType::RepeatedVariant8:
  33. case EWireType::RepeatedVariant16:
  34. return false;
  35. }
  36. Y_ABORT();
  37. }
  38. ////////////////////////////////////////////////////////////////////////////////
  39. template <EWireType WireType>
  40. TComplexSchema<WireType>::TComplexSchema(TSkiffSchemaList elements)
  41. : TSkiffSchema(WireType)
  42. , Elements_(std::move(elements))
  43. { }
  44. template <EWireType WireType>
  45. const TSkiffSchemaList& TComplexSchema<WireType>::GetChildren() const
  46. {
  47. return Elements_;
  48. }
  49. ////////////////////////////////////////////////////////////////////////////////
  50. } // namespace NSkiff