| 198 | } |
| 199 | |
| 200 | bool json_node::set_text(const char* text) |
| 201 | { |
| 202 | if (text == NULL || *text == 0) { |
| 203 | return false; |
| 204 | } |
| 205 | if (node_me_->text == NULL) { |
| 206 | return false; |
| 207 | } |
| 208 | switch ((node_me_->type & ~ACL_JSON_T_LEAF)) { |
| 209 | case ACL_JSON_T_NULL: |
| 210 | case ACL_JSON_T_BOOL: |
| 211 | case ACL_JSON_T_NUMBER: |
| 212 | case ACL_JSON_T_DOUBLE: |
| 213 | case ACL_JSON_T_STRING: |
| 214 | break; |
| 215 | default: |
| 216 | return false; |
| 217 | } |
| 218 | acl_vstring_strcpy(node_me_->text, text); |
| 219 | return true; |
| 220 | } |
| 221 | |
| 222 | const string& json_node::to_string(string* out /* = NULL */) const |
| 223 | { |