Update to latest version of "native"

This commit is contained in:
Henrik Rydgard committed 2013-05-31 23:10:58 +02:00
1 parent f2c316a64a
commit ab4987bc20
7 files changed
+13 -105

No files matched your search

+3
View File
@@ -506,6 +506,7 @@ add_library(native STATIC
native/base/error_context.h
native/base/fastlist.h
native/base/fastlist_test.cpp
native/base/functional.h
native/base/linked_ptr.h
native/base/logging.h
native/base/mutex.h
@@ -586,6 +587,8 @@ add_library(native STATIC
native/net/http_client.h
native/net/resolve.cpp
native/net/resolve.h
native/net/url.cpp
native/net/url.h
native/profiler/profiler.cpp
native/profiler/profiler.h
native/thread/prioritizedworkqueue.cpp
+2 -93
View File
@@ -29,6 +29,8 @@
#include "net/http_client.h"
#include "net/resolve.h"
#include "net/url.h"
#include "base/buffer.h"
#include <stdlib.h>
@@ -46,99 +48,6 @@ namespace Reporting
// Temporarily stores a reference to the hostname.
static std::string lastHostname;
struct UrlEncoder
{
UrlEncoder() : paramCount(0)
{
data.reserve(256);
};
void Add(const std::string &key, const std::string &value)
{
if (++paramCount > 1)
data += '&';
AppendEscaped(key);
data += '=';
AppendEscaped(value);
}
void Add(const std::string &key, const char *value)
{
Add(key, std::string(value));
}
template <typename T>
void AddT(const std::string &key, const char *fmt, const T value)
{
char temp[64];
snprintf(temp, sizeof(temp), fmt, value);
temp[sizeof(temp) - 1] = '\0';
Add(key, temp);
}
void Add(const std::string &key, const int value)
{
AddT(key, "%d", value);
}
void Add(const std::string &key, const u32 value)
{
AddT(key, "%u", value);
}
void Add(const std::string &key, const u64 value)
{
AddT(key, "%llu", value);
}
void Add(const std::string &key, const double value)
{
AddT(key, "%f", value);
}
void Add(const std::string &key, const bool value)
{
Add(key, value ? "true" : "false");
}
// Percent encoding, aka application/x-www-form-urlencoded.
void AppendEscaped(const std::string &value)
{
for (size_t lastEnd = 0; lastEnd < value.length(); )
{
size_t pos = value.find_first_not_of(unreservedChars, lastEnd);
if (pos == value.npos)
{
data += value.substr(lastEnd);
break;
}
if (pos != lastEnd)
data += value.substr(lastEnd, pos - lastEnd);
lastEnd = pos;
// Encode the reserved character.
char c = value[pos];
data += '%';
data += hexChars[(c >> 4) & 15];
data += hexChars[(c >> 0) & 15];
++lastEnd;
}
}
std::string &ToString()
{
return data;
}
std::string data;
int paramCount;
static const char *unreservedChars;
static const char *hexChars;
};
const char *UrlEncoder::unreservedChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~";
const char *UrlEncoder::hexChars = "0123456789ABCDEF";
enum RequestType
{
MESSAGE,
-1
View File
@@ -21,7 +21,6 @@
#include "../Globals.h"
#include "gfx/gl_common.h"
#include <functional>
#include <vector>
+3
View File
@@ -179,6 +179,9 @@ void LogoScreen::render() {
// Menu Screen
// ==================
MenuScreen::MenuScreen() : frames_(0) {
}
void MenuScreen::update(InputState &input_state) {
globalUIState = UISTATE_MENU;
frames_++;
+2 -1
View File
@@ -24,6 +24,7 @@
#include "ui/screen.h"
#include "ui/ui.h"
#include "file/file_util.h"
#include "net/http_client.h"
class LogoScreen : public Screen
{
@@ -43,7 +44,7 @@ private:
class MenuScreen : public Screen
{
public:
MenuScreen() : frames_(0) {}
MenuScreen();
void update(InputState &input);
void render();
void sendMessage(const char *message, const char *value);
+2 -9
View File
@@ -445,16 +445,9 @@ bool NativeIsAtTopLevel()
return false;
}
void NativeTouch(int finger, float x, float y, double time, TouchEvent event)
void NativeTouch(const TouchInput &touch)
{
switch (event) {
case TOUCH_DOWN:
break;
case TOUCH_MOVE:
break;
case TOUCH_UP:
break;
}
screenManager->touch(touch);
}
void NativeMessageReceived(const char *message, const char *value)
+1 -1
Submodule native updated: ceefd214c4...21a9fa2645.