ExpressionSourceCode.h revision e6ea5fe8e76b028a0565bc01543bc15f8c120e8a
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 ExpressionSourceCode *CreateWrapped (const char *prefix, 24 const char *body) 25 { 26 return new ExpressionSourceCode ("$__lldb_expr", 27 prefix, 28 body, 29 true); 30 } 31 32 static ExpressionSourceCode *CreateUnwrapped (const char *name, 33 const char *body) 34 { 35 return new ExpressionSourceCode (name, 36 "", 37 body, 38 false); 39 } 40 41 bool NeedsWrapping () const 42 { 43 return m_wrap; 44 } 45 46 const char *GetName () const 47 { 48 return m_name.c_str(); 49 } 50 51 bool GetText (std::string &text, 52 lldb::LanguageType wrapping_language, 53 bool const_object, 54 bool static_method) const; 55 56private: 57 ExpressionSourceCode (const char *name, 58 const char *prefix, 59 const char *body, 60 bool wrap) : 61 m_name(name), 62 m_prefix(prefix), 63 m_body(body), 64 m_wrap(wrap) 65 { 66 } 67 68 std::string m_name; 69 std::string m_prefix; 70 std::string m_body; 71 bool m_wrap; 72}; 73 74} // namespace lldb_private 75 76#endif 77