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"

View file

@ -1,7 +1,3 @@
//
// Created by timoreo on 11/12/23.
//
#ifndef 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 {
void MemoryStore::setSyncToken(std::string token) {
syncToken = token;
syncToken = token;
}
std::string MemoryStore::getSyncToken() {
return syncToken;
return syncToken;
}
void MemoryStore::setFilterId(std::string fid) {
filterId = fid;
filterId = fid;
}
std::string MemoryStore::getFilterId() {
return filterId;
return filterId;
}
}; // namespace Matrix
}; // namespace Matrix

View file

@ -1,22 +1,23 @@
#ifndef _memorystore_h_
#define _memorystore_h_
#include "../include/matrixclient.h"
#include <string>
#include "../include/matrixclient.h"
namespace Matrix {
class MemoryStore : public Store {
private:
std::string syncToken = "";
std::string filterId = "";
public:
void setSyncToken(std::string token);
std::string getSyncToken();
void setFilterId(std::string fid);
std::string getFilterId();
private:
std::string syncToken = "";
std::string filterId = "";
public:
void setSyncToken(std::string token);
std::string getSyncToken();
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 <string>
#include <sstream>
#include <3ds.h>
#include <jansson.h>
#include <sstream>
#include <string>
// from http://www.zedwood.com/article/cpp-urlencode-function
std::string urlencode(std::string s) {
static const char lookup[]= "0123456789abcdef";
std::stringstream e;
for(int i = 0, ix = s.length(); i < ix; i++) {
const char& c = s[i];
if ( (48 <= c && c <= 57) ||//0-9
(65 <= c && c <= 90) ||//abc...xyz
(97 <= c && c <= 122) || //ABC...XYZ
(c=='-' || c=='_' || c=='.' || c=='~')
) {
e << c;
} else {
e << '%';
e << lookup[ (c&0xF0)>>4 ];
e << lookup[ (c&0x0F) ];
}
}
return e.str();
static const char lookup[] = "0123456789abcdef";
std::stringstream e;
for (int i = 0, ix = s.length(); i < ix; i++) {
const char& c = s[i];
if ((48 <= c && c <= 57) || // 0-9
(65 <= c && c <= 90) || // abc...xyz
(97 <= c && c <= 122) || // ABC...XYZ
(c == '-' || c == '_' || c == '.' || c == '~')) {
e << c;
} else {
e << '%';
e << lookup[(c & 0xF0) >> 4];
e << lookup[(c & 0x0F)];
}
}
return e.str();
}
char* json_object_get_string_value(json_t* obj, const char* key) {
if (!obj) {
return NULL;
}
json_t* keyObj = json_object_get(obj, key);
if (!keyObj) {
return NULL;
}
return (char*)json_string_value(keyObj);
if (!obj) {
return NULL;
}
json_t* keyObj = json_object_get(obj, key);
if (!keyObj) {
return NULL;
}
return (char*)json_string_value(keyObj);
}

View file

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