1 //===-- TypeValidator.cpp ---------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
14 // Other libraries and framework includes
17 #include "lldb/DataFormatters/TypeValidator.h"
18 #include "lldb/Core/StreamString.h"
21 using namespace lldb_private;
23 TypeValidatorImpl::TypeValidatorImpl(const Flags &flags) :
29 TypeValidatorImpl::~TypeValidatorImpl()
33 TypeValidatorImpl::ValidationResult
34 TypeValidatorImpl::Success ()
36 return ValidationResult { TypeValidatorResult::Success, "" };
39 TypeValidatorImpl::ValidationResult
40 TypeValidatorImpl::Failure (std::string message)
42 return ValidationResult { TypeValidatorResult::Failure, message };
45 TypeValidatorImpl_CXX::TypeValidatorImpl_CXX (ValidatorFunction f, std::string d, const TypeValidatorImpl::Flags& flags) :
46 TypeValidatorImpl(flags),
48 m_validator_function(f)
52 TypeValidatorImpl_CXX::~TypeValidatorImpl_CXX()
56 TypeValidatorImpl::ValidationResult
57 TypeValidatorImpl_CXX::FormatObject (ValueObject *valobj) const
60 return Success(); // I guess there's nothing wrong with a null valueobject..
62 return m_validator_function(valobj);
66 TypeValidatorImpl_CXX::GetDescription()
69 sstr.Printf ("%s%s%s%s",
70 m_description.c_str(),
71 Cascades() ? "" : " (not cascading)",
72 SkipsPointers() ? " (skip pointers)" : "",
73 SkipsReferences() ? " (skip references)" : "");
74 return sstr.GetString();