uce/site/doc/pages/StringMap.txt

35 lines
806 B
Plaintext

:sig
StringMap
:see
>types
0_Request
parse_query
encode_query
array_merge
:content
Associative container mapping `String` keys to `String` values.
`StringMap` is an alias for `std::map<String, String>`.
## Common Uses
`StringMap` commonly appears in:
- `context.params`
- `context.get`
- `context.post`
- `context.cookies`
- `context.session`
- `context.header`
Because it uses `std::map`, `map["key"]` will create an empty entry when that key does not already exist.
Helpers such as `parse_query()` and `encode_query()` convert between query strings and `StringMap` values.
## Related Concepts
- PHP: associative arrays keyed by string, especially request bags like `$_GET` and `$_SERVER`
- JavaScript / Node.js: plain objects, dictionaries, `Map`, and header or query objects in web frameworks