clang-format : format sdk

This commit is contained in:
timoreo 2023-12-11 21:21:45 +01:00
parent edd1a90dec
commit 95deba1139
Signed by: timoreo
GPG key ID: 121A72C3512BA288
7 changed files with 765 additions and 755 deletions

View file

@ -1,5 +1 @@
//
// Created by timoreo on 11/12/23.
//
#include "devicestore.h" #include "devicestore.h"

View file

@ -1,7 +1,3 @@
//
// Created by timoreo on 11/12/23.
//
#ifndef MATRIX_3DS_CLIENT_DEVICESTORE_H #ifndef MATRIX_3DS_CLIENT_DEVICESTORE_H
#define MATRIX_3DS_CLIENT_DEVICESTORE_H #define MATRIX_3DS_CLIENT_DEVICESTORE_H

File diff suppressed because it is too large Load diff

View file

@ -4,19 +4,19 @@
namespace Matrix { namespace Matrix {
void MemoryStore::setSyncToken(std::string token) { void MemoryStore::setSyncToken(std::string token) {
syncToken = token; syncToken = token;
} }
std::string MemoryStore::getSyncToken() { std::string MemoryStore::getSyncToken() {
return syncToken; return syncToken;
} }
void MemoryStore::setFilterId(std::string fid) { void MemoryStore::setFilterId(std::string fid) {
filterId = fid; filterId = fid;
} }
std::string MemoryStore::getFilterId() { std::string MemoryStore::getFilterId() {
return filterId; return filterId;
} }
}; // namespace Matrix }; // namespace Matrix

View file

@ -1,22 +1,23 @@
#ifndef _memorystore_h_ #ifndef _memorystore_h_
#define _memorystore_h_ #define _memorystore_h_
#include "../include/matrixclient.h"
#include <string> #include <string>
#include "../include/matrixclient.h"
namespace Matrix { namespace Matrix {
class MemoryStore : public Store { class MemoryStore : public Store {
private: private:
std::string syncToken = ""; std::string syncToken = "";
std::string filterId = ""; std::string filterId = "";
public:
void setSyncToken(std::string token); public:
std::string getSyncToken(); void setSyncToken(std::string token);
void setFilterId(std::string fid); std::string getSyncToken();
std::string getFilterId(); void setFilterId(std::string fid);
std::string getFilterId();
}; };
}; // namespace Matrix }; // namespace Matrix
#endif // _memorystore_h_ #endif // _memorystore_h_

View file

@ -1,37 +1,36 @@
#include "util.h" #include "util.h"
#include <string>
#include <sstream>
#include <3ds.h> #include <3ds.h>
#include <jansson.h> #include <jansson.h>
#include <sstream>
#include <string>
// from http://www.zedwood.com/article/cpp-urlencode-function // from http://www.zedwood.com/article/cpp-urlencode-function
std::string urlencode(std::string s) { std::string urlencode(std::string s) {
static const char lookup[]= "0123456789abcdef"; static const char lookup[] = "0123456789abcdef";
std::stringstream e; std::stringstream e;
for(int i = 0, ix = s.length(); i < ix; i++) { for (int i = 0, ix = s.length(); i < ix; i++) {
const char& c = s[i]; const char& c = s[i];
if ( (48 <= c && c <= 57) ||//0-9 if ((48 <= c && c <= 57) || // 0-9
(65 <= c && c <= 90) ||//abc...xyz (65 <= c && c <= 90) || // abc...xyz
(97 <= c && c <= 122) || //ABC...XYZ (97 <= c && c <= 122) || // ABC...XYZ
(c=='-' || c=='_' || c=='.' || c=='~') (c == '-' || c == '_' || c == '.' || c == '~')) {
) { e << c;
e << c; } else {
} else { e << '%';
e << '%'; e << lookup[(c & 0xF0) >> 4];
e << lookup[ (c&0xF0)>>4 ]; e << lookup[(c & 0x0F)];
e << lookup[ (c&0x0F) ]; }
} }
} return e.str();
return e.str();
} }
char* json_object_get_string_value(json_t* obj, const char* key) { char* json_object_get_string_value(json_t* obj, const char* key) {
if (!obj) { if (!obj) {
return NULL; return NULL;
} }
json_t* keyObj = json_object_get(obj, key); json_t* keyObj = json_object_get(obj, key);
if (!keyObj) { if (!keyObj) {
return NULL; return NULL;
} }
return (char*)json_string_value(keyObj); return (char*)json_string_value(keyObj);
} }

View file

@ -1,12 +1,12 @@
#ifndef _UTIL_H_ #ifndef _UTIL_H_
#define _UTIL_H_ #define _UTIL_H_
#include <string>
#include <3ds.h> #include <3ds.h>
#include <jansson.h> #include <jansson.h>
#include <string>
std::string urlencode(std::string str); std::string urlencode(std::string str);
char* json_object_get_string_value(json_t* obj, const char* key); char* json_object_get_string_value(json_t* obj, const char* key);
#endif // _UTIL_H_ #endif // _UTIL_H_