diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/json.h | 32 | ||||
-rw-r--r-- | include/query_string.h | 33 |
2 files changed, 57 insertions, 8 deletions
diff --git a/include/json.h b/include/json.h index 3fc0911..68f06a2 100644 --- a/include/json.h +++ b/include/json.h @@ -833,9 +833,9 @@ namespace crow return {};*/ break; case '.': - state = (NumberParsingState)"\7\7\7\4\7\7\7"[state]; + state = (NumberParsingState)"\7\7\4\4\7\7\7"[state]; /* - if (state == NumberParsingState::Digits) + if (state == NumberParsingState::Digits || state == NumberParsingState::ZeroFirst) { state = NumberParsingState::DigitsAfterPoints; } @@ -1143,7 +1143,7 @@ namespace crow return *this; } - wvalue& operator = (uint16_t value) + wvalue& operator = (unsigned short value) { reset(); t_ = type::Number; @@ -1151,7 +1151,7 @@ namespace crow return *this; } - wvalue& operator = (int16_t value) + wvalue& operator = (short value) { reset(); t_ = type::Number; @@ -1159,7 +1159,7 @@ namespace crow return *this; } - wvalue& operator = (uint32_t value) + wvalue& operator = (long long value) { reset(); t_ = type::Number; @@ -1167,7 +1167,7 @@ namespace crow return *this; } - wvalue& operator = (int32_t value) + wvalue& operator = (long value) { reset(); t_ = type::Number; @@ -1175,7 +1175,7 @@ namespace crow return *this; } - wvalue& operator = (uint64_t value) + wvalue& operator = (int value) { reset(); t_ = type::Number; @@ -1183,7 +1183,23 @@ namespace crow return *this; } - wvalue& operator = (int64_t value) + wvalue& operator = (unsigned long long value) + { + reset(); + t_ = type::Number; + d = (double)value; + return *this; + } + + wvalue& operator = (unsigned long value) + { + reset(); + t_ = type::Number; + d = (double)value; + return *this; + } + + wvalue& operator = (unsigned int value) { reset(); t_ = type::Number; diff --git a/include/query_string.h b/include/query_string.h index d0a93ea..86c99cc 100644 --- a/include/query_string.h +++ b/include/query_string.h @@ -245,6 +245,39 @@ namespace crow } + query_string(const query_string& qs) + : url_(qs.url_) + { + for(auto p:qs.key_value_pairs_) + { + key_value_pairs_.push_back((char*)(p-qs.url_.c_str()+url_.c_str())); + } + } + + query_string& operator = (const query_string& qs) + { + url_ = qs.url_; + key_value_pairs_.clear(); + for(auto p:qs.key_value_pairs_) + { + key_value_pairs_.push_back((char*)(p-qs.url_.c_str()+url_.c_str())); + } + return *this; + } + + query_string& operator = (query_string&& qs) + { + key_value_pairs_ = std::move(qs.key_value_pairs_); + char* old_data = (char*)qs.url_.c_str(); + url_ = std::move(qs.url_); + for(auto& p:key_value_pairs_) + { + p += (char*)url_.c_str() - old_data; + } + return *this; + } + + query_string(std::string url) : url_(std::move(url)) { |