1435933ddSDimitry Andric //===-- FormatClasses.cpp ----------------------------------------*- C++
2435933ddSDimitry Andric //-*-===//
3ac7ddfbfSEd Maste //
4ac7ddfbfSEd Maste //                     The LLVM Compiler Infrastructure
5ac7ddfbfSEd Maste //
6ac7ddfbfSEd Maste // This file is distributed under the University of Illinois Open Source
7ac7ddfbfSEd Maste // License. See LICENSE.TXT for details.
8ac7ddfbfSEd Maste //
9ac7ddfbfSEd Maste //===----------------------------------------------------------------------===//
10ac7ddfbfSEd Maste 
11b952cd58SEd Maste #include "lldb/DataFormatters/FormatClasses.h"
12ac7ddfbfSEd Maste 
139f2f44ceSEd Maste #include "lldb/DataFormatters/FormatManager.h"
149f2f44ceSEd Maste 
15ac7ddfbfSEd Maste 
16ac7ddfbfSEd Maste 
17ac7ddfbfSEd Maste 
18ac7ddfbfSEd Maste 
19ac7ddfbfSEd Maste using namespace lldb;
20ac7ddfbfSEd Maste using namespace lldb_private;
21ac7ddfbfSEd Maste 
FormattersMatchData(ValueObject & valobj,lldb::DynamicValueType use_dynamic)22435933ddSDimitry Andric FormattersMatchData::FormattersMatchData(ValueObject &valobj,
23435933ddSDimitry Andric                                          lldb::DynamicValueType use_dynamic)
24435933ddSDimitry Andric     : m_valobj(valobj), m_dynamic_value_type(use_dynamic),
25435933ddSDimitry Andric       m_formatters_match_vector({}, false), m_type_for_cache(),
26435933ddSDimitry Andric       m_candidate_languages() {
279f2f44ceSEd Maste   m_type_for_cache = FormatManager::GetTypeForCache(valobj, use_dynamic);
289f2f44ceSEd Maste   m_candidate_languages = FormatManager::GetCandidateLanguages(valobj);
299f2f44ceSEd Maste }
309f2f44ceSEd Maste 
GetMatchesVector()31435933ddSDimitry Andric FormattersMatchVector FormattersMatchData::GetMatchesVector() {
32435933ddSDimitry Andric   if (!m_formatters_match_vector.second) {
339f2f44ceSEd Maste     m_formatters_match_vector.second = true;
34435933ddSDimitry Andric     m_formatters_match_vector.first =
35435933ddSDimitry Andric         FormatManager::GetPossibleMatches(m_valobj, m_dynamic_value_type);
369f2f44ceSEd Maste   }
379f2f44ceSEd Maste   return m_formatters_match_vector.first;
389f2f44ceSEd Maste }
399f2f44ceSEd Maste 
GetTypeForCache()40435933ddSDimitry Andric ConstString FormattersMatchData::GetTypeForCache() { return m_type_for_cache; }
419f2f44ceSEd Maste 
GetCandidateLanguages()42435933ddSDimitry Andric CandidateLanguagesVector FormattersMatchData::GetCandidateLanguages() {
439f2f44ceSEd Maste   return m_candidate_languages;
449f2f44ceSEd Maste }
459f2f44ceSEd Maste 
GetValueObject()46435933ddSDimitry Andric ValueObject &FormattersMatchData::GetValueObject() { return m_valobj; }
479f2f44ceSEd Maste 
GetDynamicValueType()48435933ddSDimitry Andric lldb::DynamicValueType FormattersMatchData::GetDynamicValueType() {
499f2f44ceSEd Maste   return m_dynamic_value_type;
509f2f44ceSEd Maste }
51