DataVisualization.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. //===-- DataVisualization.h -------------------------------------*- C++ -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #ifndef LLDB_DATAFORMATTERS_DATAVISUALIZATION_H
  9. #define LLDB_DATAFORMATTERS_DATAVISUALIZATION_H
  10. #include "lldb/DataFormatters/FormatClasses.h"
  11. #include "lldb/DataFormatters/FormatManager.h"
  12. #include "lldb/Utility/ConstString.h"
  13. namespace lldb_private {
  14. // this class is the high-level front-end of LLDB Data Visualization code in
  15. // FormatManager.h/cpp is the low-level implementation of this feature clients
  16. // should refer to this class as the entry-point into the data formatters
  17. // unless they have a good reason to bypass this and go to the backend
  18. class DataVisualization {
  19. public:
  20. // use this call to force the FM to consider itself updated even when there
  21. // is no apparent reason for that
  22. static void ForceUpdate();
  23. static uint32_t GetCurrentRevision();
  24. static bool ShouldPrintAsOneLiner(ValueObject &valobj);
  25. static lldb::TypeFormatImplSP GetFormat(ValueObject &valobj,
  26. lldb::DynamicValueType use_dynamic);
  27. static lldb::TypeFormatImplSP
  28. GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp);
  29. static lldb::TypeSummaryImplSP
  30. GetSummaryFormat(ValueObject &valobj, lldb::DynamicValueType use_dynamic);
  31. static lldb::TypeSummaryImplSP
  32. GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp);
  33. static lldb::TypeFilterImplSP
  34. GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp);
  35. static lldb::ScriptedSyntheticChildrenSP
  36. GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp);
  37. static lldb::SyntheticChildrenSP
  38. GetSyntheticChildren(ValueObject &valobj, lldb::DynamicValueType use_dynamic);
  39. static bool
  40. AnyMatches(ConstString type_name,
  41. TypeCategoryImpl::FormatCategoryItems items =
  42. TypeCategoryImpl::ALL_ITEM_TYPES,
  43. bool only_enabled = true, const char **matching_category = nullptr,
  44. TypeCategoryImpl::FormatCategoryItems *matching_type = nullptr);
  45. class NamedSummaryFormats {
  46. public:
  47. static bool GetSummaryFormat(ConstString type,
  48. lldb::TypeSummaryImplSP &entry);
  49. static void Add(ConstString type,
  50. const lldb::TypeSummaryImplSP &entry);
  51. static bool Delete(ConstString type);
  52. static void Clear();
  53. static void ForEach(std::function<bool(const TypeMatcher &,
  54. const lldb::TypeSummaryImplSP &)>
  55. callback);
  56. static uint32_t GetCount();
  57. };
  58. class Categories {
  59. public:
  60. static bool GetCategory(ConstString category,
  61. lldb::TypeCategoryImplSP &entry,
  62. bool allow_create = true);
  63. static bool GetCategory(lldb::LanguageType language,
  64. lldb::TypeCategoryImplSP &entry);
  65. static void Add(ConstString category);
  66. static bool Delete(ConstString category);
  67. static void Clear();
  68. static void Clear(ConstString category);
  69. static void Enable(ConstString category,
  70. TypeCategoryMap::Position = TypeCategoryMap::Default);
  71. static void Enable(lldb::LanguageType lang_type);
  72. static void Disable(ConstString category);
  73. static void Disable(lldb::LanguageType lang_type);
  74. static void Enable(const lldb::TypeCategoryImplSP &category,
  75. TypeCategoryMap::Position = TypeCategoryMap::Default);
  76. static void Disable(const lldb::TypeCategoryImplSP &category);
  77. static void EnableStar();
  78. static void DisableStar();
  79. static void ForEach(TypeCategoryMap::ForEachCallback callback);
  80. static uint32_t GetCount();
  81. static lldb::TypeCategoryImplSP GetCategoryAtIndex(size_t);
  82. };
  83. };
  84. } // namespace lldb_private
  85. #endif // LLDB_DATAFORMATTERS_DATAVISUALIZATION_H