Commit bf445005 authored by Ole Christian Eidheim's avatar Ole Christian Eidheim
Browse files

Added clangmm::CString

parent 0493150a
......@@ -10,6 +10,18 @@ std::string clangmm::to_string(CXString 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_]+).*$");
......
......@@ -2,10 +2,19 @@
#define UTILITY_H_
#include <clang-c/Index.h>
#include <string>
#include <memory>
namespace clangmm {
std::string to_string(CXString cx_string);
class CString {
public:
CString(const CXString &cx_string);
~CString();
CXString cx_string;
const char *data;
};
void remove_include_guard(std::string &buffer);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment