diff options
Diffstat (limited to 'upb/pb/glue.h')
-rw-r--r-- | upb/pb/glue.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/upb/pb/glue.h b/upb/pb/glue.h index 6179d8d..4bbc975 100644 --- a/upb/pb/glue.h +++ b/upb/pb/glue.h @@ -27,8 +27,7 @@ #define UPB_GLUE_H #include <stdbool.h> -#include "upb/upb.h" -#include "upb/def.h" +#include "upb/symtab.h" #ifdef __cplusplus extern "C" { @@ -55,6 +54,29 @@ char *upb_readfile(const char *filename, size_t *len); #ifdef __cplusplus } /* extern "C" */ + +namespace upb { + +// All routines that load descriptors expect the descriptor to be a +// FileDescriptorSet. +inline bool LoadDescriptorFileIntoSymtab(SymbolTable* s, const char *fname, + Status* status) { + return upb_load_descriptor_file_into_symtab(s, fname, status); +} + +inline bool LoadDescriptorIntoSymtab(SymbolTable* s, const char* str, + size_t len, Status* status) { + return upb_load_descriptor_into_symtab(s, str, len, status); +} + +// Templated so it can accept both string and std::string. +template <typename T> +bool LoadDescriptorIntoSymtab(SymbolTable* s, const T& desc, Status* status) { + return upb_load_descriptor_into_symtab(s, desc.c_str(), desc.size(), status); +} + +} // namespace upb + #endif #endif |