Home | History | Annotate | Download | only in libclang
      1 //===- CXString.h - Routines for manipulating CXStrings -------------------===//
      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 // This file defines routines for manipulating CXStrings.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #ifndef LLVM_CLANG_CXSTRING_H
     15 #define LLVM_CLANG_CXSTRING_H
     16 
     17 #include "clang-c/Index.h"
     18 #include "llvm/ADT/StringRef.h"
     19 #include "llvm/ADT/SmallString.h"
     20 
     21 namespace clang {
     22 namespace cxstring {
     23 
     24 struct CXStringBuf {
     25   llvm::SmallString<128> Data;
     26   CXTranslationUnit TU;
     27   CXStringBuf(CXTranslationUnit tu) : TU(tu) {}
     28 };
     29 
     30 /// \brief Create a CXString object from a C string.
     31 CXString createCXString(const char *String, bool DupString = false);
     32 
     33 /// \brief Create a CXString object from a StringRef.
     34 CXString createCXString(llvm::StringRef String, bool DupString = true);
     35 
     36 /// \brief Create a CXString object that is backed by a string buffer.
     37 CXString createCXString(CXStringBuf *buf);
     38 
     39 /// \brief Create an opaque string pool used for fast geneneration of strings.
     40 void *createCXStringPool();
     41 
     42 /// \brief Dispose of a string pool.
     43 void disposeCXStringPool(void *pool);
     44 
     45 CXStringBuf *getCXStringBuf(CXTranslationUnit TU);
     46 
     47 void disposeCXStringBuf(CXStringBuf *buf);
     48 
     49 }
     50 }
     51 
     52 #endif
     53 
     54