c9s / r3

libr3 is a high-performance path dispatching library. It compiles your route paths into a prefix tree (trie). By using the constructed prefix trie in the start-up time, you may dispatch your routes with efficiency
http://c9s.github.com/r3/bench.html
MIT License
814 stars 83 forks source link

Export slug related functions #40

Open c9s opened 10 years ago

c9s commented 10 years ago
  1. int r3_parse_slugs( char * path, char ** slugs ) this function parses the slug names from the path. this function returns the length of the slugs. each slug is a null-terminated strings.
int list_len = r3_parse_slugs("/user/{id}", token_list);
  1. r3_apply_slugs( char * path, ...)

    this function applies the variables into the slugs by the ordering. so an URL generator could be implemented.

        r3_apply_slugs("/user/{id}", 1, "123");
        r3_apply_slugs("/user/{id}/{title}", 2, "123", "title");