#include "Utility.h" #include std::string clangmm::to_string(CXString cx_string) { std::string string; if(cx_string.data!=NULL) { string=clang_getCString(cx_string); clang_disposeString(cx_string); } return string; } clangmm::CString::CString(const CXString &cx_string) : cx_string(cx_string) { if(cx_string.data!=NULL) data=clang_getCString(cx_string); else data=""; } clangmm::CString::~CString() { if(cx_string.data!=NULL) clang_disposeString(cx_string); } void clangmm::remove_include_guard(std::string &buffer) { static std::regex ifndef_regex1("^[ \t]*#[ \t]*ifndef[ \t]+([A-Za-z0-9_]+).*$"); static std::regex ifndef_regex2("^[ \t]*#[ \t]*if[ \t]+![ \t]*defined[ \t]*\\([ \t]*([A-Za-z0-9_]+).*$"); static std::regex define_regex("^[ \t]*#[ \t]*define[ \t]+([A-Za-z0-9_]+).*$"); static std::regex endif_regex("^[ \t]*#[ \t]*endif.*$"); std::vector> ranges; bool found_ifndef=false, found_define=false; bool line_comment=false, multiline_comment=false; size_t start_of_line=0; std::string line; std::string preprocessor_identifier; for(size_t c=0;c