summaryrefslogtreecommitdiff
path: root/upb_context.h
blob: f2bb1dfe9881bc25340d3e5100366382b1d86b71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * upb - a minimalist implementation of protocol buffers.
 *
 * A context represents a namespace of proto definitions, sort of like
 * an interpreter's symbol table.  It is empty when first constructed.
 * Clients add definitions to the context by supplying serialized
 * descriptors (as defined in descriptor.proto).
 *
 * Copyright (c) 2008 Joshua Haberman.  See LICENSE for details.
 */

#ifndef UPB_PARSE_H_
#define UPB_PARSE_H_

#include "upb.h"
#include "upb_table.h"

#ifdef __cplusplus
extern "C" {
#endif

/* High-level parsing interface. **********************************************/

enum upb_symbol_type {
  UPB_SYM_MESSAGE,
  UPB_SYM_ENUM,
  UPB_SYM_SERVICE,
  UPB_SYM_EXTENSION
};

struct upb_symtab_entry {
  struct upb_strtable_entry e;
  enum upb_symbol_type type;
  union {
    struct upb_msg *msg;
    struct upb_enum *_enum;
    struct upb_svc *svc;
  } p;
}

struct upb_context {
  upb_strtable *symtab;
};

struct upb_symtab_entry *upb_context_findsym(struct upb_context *c, struct upb_string *s);

#ifdef __cplusplus
}  /* extern "C" */
#endif

#endif  /* UPB_PARSE_H_ */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback