1//===-- ExpressionSourceCode.h ----------------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef liblldb_ExpressionSourceCode_h 11#define liblldb_ExpressionSourceCode_h 12 13#include "lldb/lldb-enumerations.h" 14 15#include <string> 16 17namespace lldb_private 18{ 19 20class ExpressionSourceCode 21{ 22public: 23 static const char * g_expression_prefix; 24 25 static ExpressionSourceCode *CreateWrapped (const char *prefix, 26 const char *body) 27 { 28 return new ExpressionSourceCode ("$__lldb_expr", 29 prefix, 30 body, 31 true); 32 } 33 34 static ExpressionSourceCode *CreateUnwrapped (const char *name, 35 const char *body) 36 { 37 return new ExpressionSourceCode (name, 38 "", 39 body, 40 false); 41 } 42 43 bool NeedsWrapping () const 44 { 45 return m_wrap; 46 } 47 48 const char *GetName () const 49 { 50 return m_name.c_str(); 51 } 52 53 bool GetText (std::string &text, 54 lldb::LanguageType wrapping_language, 55 bool const_object, 56 bool static_method) const; 57 58private: 59 ExpressionSourceCode (const char *name, 60 const char *prefix, 61 const char *body, 62 bool wrap) : 63 m_name(name), 64 m_prefix(prefix), 65 m_body(body), 66 m_wrap(wrap) 67 { 68 } 69 70 std::string m_name; 71 std::string m_prefix; 72 std::string m_body; 73 bool m_wrap; 74}; 75 76} // namespace lldb_private 77 78#endif 79