mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Add submodules, namespace json to prepare for the addition of rapidjson (sigh)
This commit is contained in:
parent
42f4d7b40f
commit
eddaf97938
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -19,3 +19,9 @@
|
||||
[submodule "ext/SPIRV-Cross"]
|
||||
path = ext/SPIRV-Cross
|
||||
url = https://github.com/KhronosGroup/SPIRV-Cross.git
|
||||
[submodule "ext/discord-rpc"]
|
||||
path = ext/discord-rpc
|
||||
url = https://github.com/discordapp/discord-rpc.git
|
||||
[submodule "ext/rapidjson"]
|
||||
path = ext/rapidjson
|
||||
url = https://github.com/Tencent/rapidjson.git
|
||||
|
@ -1162,8 +1162,8 @@ void Config::DownloadCompletedCallback(http::Download &download) {
|
||||
return;
|
||||
}
|
||||
|
||||
JsonReader reader(data.c_str(), data.size());
|
||||
const JsonGet root = reader.root();
|
||||
json::JsonReader reader(data.c_str(), data.size());
|
||||
const json::JsonGet root = reader.root();
|
||||
if (!root) {
|
||||
ERROR_LOG(LOADER, "Failed to parse json");
|
||||
return;
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include "net/websocket_server.h"
|
||||
#include "Common/Log.h"
|
||||
|
||||
using namespace json;
|
||||
|
||||
static inline void DebuggerJsonAddTicket(JsonWriter &writer, const JsonGet &data) {
|
||||
const JsonNode *value = data.get("ticket");
|
||||
if (value)
|
||||
|
@ -82,6 +82,8 @@ static bool FindServer(std::string &resultHost, int &resultPort) {
|
||||
std::string json;
|
||||
result.TakeAll(&json);
|
||||
|
||||
using namespace json;
|
||||
|
||||
JsonReader reader(json.c_str(), json.size());
|
||||
if (!reader.ok()) {
|
||||
return false;
|
||||
|
@ -391,6 +391,7 @@ void StoreScreen::update() {
|
||||
}
|
||||
|
||||
void StoreScreen::ParseListing(std::string json) {
|
||||
using namespace json;
|
||||
JsonReader reader(json.c_str(), json.size());
|
||||
if (!reader.ok() || !reader.root()) {
|
||||
ELOG("Error parsing JSON from store");
|
||||
@ -540,8 +541,8 @@ std::string StoreScreen::GetStoreJsonURL(std::string storePath) const {
|
||||
return path;
|
||||
}
|
||||
|
||||
std::string StoreScreen::GetTranslatedString(const JsonGet json, std::string key, const char *fallback) const {
|
||||
JsonGet dict = json.getDict("en_US");
|
||||
std::string StoreScreen::GetTranslatedString(const json::JsonGet json, std::string key, const char *fallback) const {
|
||||
json::JsonGet dict = json.getDict("en_US");
|
||||
if (dict && json.hasChild(lang_.c_str(), JSON_OBJECT)) {
|
||||
if (json.getDict(lang_.c_str()).hasChild(key.c_str(), JSON_STRING)) {
|
||||
dict = json.getDict(lang_.c_str());
|
||||
|
@ -29,7 +29,10 @@
|
||||
// set game specific settings, etc.
|
||||
// Uses GameInfoCache heavily to implement the functionality.
|
||||
|
||||
struct JsonGet;
|
||||
namespace json {
|
||||
struct JsonGet;
|
||||
}
|
||||
|
||||
class ProductItemView;
|
||||
|
||||
enum EntryType {
|
||||
@ -79,7 +82,7 @@ private:
|
||||
std::vector<StoreEntry> FilterEntries();
|
||||
|
||||
std::string GetStoreJsonURL(std::string storePath) const;
|
||||
std::string GetTranslatedString(const JsonGet json, std::string key, const char *fallback = nullptr) const;
|
||||
std::string GetTranslatedString(const json::JsonGet json, std::string key, const char *fallback = nullptr) const;
|
||||
|
||||
std::shared_ptr<http::Download> listing_;
|
||||
std::shared_ptr<http::Download> image_;
|
||||
|
1
ext/discord-rpc
Submodule
1
ext/discord-rpc
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 3d3ae7129d17643bc706da0a2eea85aafd10ab3a
|
@ -2,6 +2,8 @@
|
||||
#include "file/vfs.h"
|
||||
#include "json/json_reader.h"
|
||||
|
||||
namespace json {
|
||||
|
||||
JsonReader::JsonReader(const std::string &filename) {
|
||||
size_t buf_size;
|
||||
buffer_ = (char *)VFSReadFile(filename.c_str(), &buf_size);
|
||||
@ -117,3 +119,5 @@ bool JsonGet::getBool(const char *child_name, bool default_value) const {
|
||||
}
|
||||
return default_value;
|
||||
}
|
||||
|
||||
} // namespace json
|
||||
|
@ -1,9 +1,12 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/logging.h"
|
||||
#include "ext/gason/gason.h"
|
||||
|
||||
namespace json {
|
||||
|
||||
struct JsonGet {
|
||||
JsonGet(const JsonValue &value) : value_(value) {
|
||||
}
|
||||
@ -83,3 +86,5 @@ private:
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(JsonReader);
|
||||
};
|
||||
|
||||
} // namespace json
|
||||
|
@ -1,9 +1,12 @@
|
||||
#include <iomanip>
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
#include "json/json_reader.h"
|
||||
#include "json/json_writer.h"
|
||||
|
||||
namespace json {
|
||||
|
||||
JsonWriter::JsonWriter(int flags) {
|
||||
pretty_ = (flags & PRETTY) != 0;
|
||||
str_.imbue(std::locale::classic());
|
||||
@ -383,3 +386,5 @@ static void json_stringify_array(JsonWriter &writer, const JsonNode *node) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace json
|
||||
|
@ -13,6 +13,10 @@
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
|
||||
struct JsonNode;
|
||||
|
||||
namespace json {
|
||||
|
||||
class JsonWriter {
|
||||
public:
|
||||
JsonWriter(int flags = NORMAL);
|
||||
@ -79,5 +83,6 @@ private:
|
||||
bool pretty_;
|
||||
};
|
||||
|
||||
struct JsonNode;
|
||||
std::string json_stringify(const JsonNode *json);
|
||||
|
||||
} // namespace json
|
||||
|
1
ext/rapidjson
Submodule
1
ext/rapidjson
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 73063f5002612c6bf64fe24f851cd5cc0d83eef9
|
Loading…
Reference in New Issue
Block a user