Pass pugi xml_mode by value; refine coding style.

This commit is contained in:
Adam Gu
2018-05-23 13:07:17 +08:00
parent b41dfcebd9
commit 79665c75ba
16 changed files with 51 additions and 61 deletions
+8 -6
View File
@@ -2,10 +2,11 @@
#include <list>
#include <iostream>
#include "boost/lexical_cast.hpp"
#include "json/json.h" // jsoncpp
////////////////////////////////////////////////////////////////////////////////
#include "boost/lexical_cast.hpp"
#include "json/json.h"
// -----------------------------------------------------------------------------
// In-memory test data.
// There should be some database in a real product.
@@ -97,7 +98,7 @@ private:
static BookStore g_book_store;
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
static bool BookFromJson(const std::string& json, Book* book) {
Json::Value root;
@@ -142,7 +143,7 @@ bool BookListService::Post(const std::string& request_content,
return false;
}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
bool BookDetailService::Get(const std::vector<std::string>& url_sub_matches,
const webcc::UrlQuery& query,
@@ -182,7 +183,8 @@ bool BookDetailService::Put(const std::vector<std::string>& url_sub_matches,
return false;
}
bool BookDetailService::Delete(const std::vector<std::string>& url_sub_matches) {
bool BookDetailService::Delete(
const std::vector<std::string>& url_sub_matches) {
if (url_sub_matches.size() != 1) {
return false;
}
+2 -2
View File
@@ -3,7 +3,7 @@
#include "webcc/rest_service.h"
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// BookListService handles the HTTP GET and returns the book list based on
// query parameters specified in the URL.
@@ -25,7 +25,7 @@ class BookListService : public webcc::RestListService {
std::string* response_content) final;
};
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// The URL is like '/books/{BookID}', and the 'url_sub_matches' parameter
// contains the matched book ID.