mirror of
https://github.com/Karaka-Management/cOMS.git
synced 2026-02-17 18:58:39 +00:00
change to namespaces
This commit is contained in:
parent
04ab177b23
commit
9c0859daff
|
|
@ -14,11 +14,8 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
namespace Utils {
|
||||
class ArraySort {
|
||||
private:
|
||||
|
||||
public:
|
||||
static inline
|
||||
namespace ArraySort {
|
||||
inline
|
||||
void reverse_int(int *arr, int size)
|
||||
{
|
||||
for (int low = 0, high = size - 1; low < high; ++low, --high) {
|
||||
|
|
@ -28,7 +25,7 @@ namespace Utils {
|
|||
}
|
||||
}
|
||||
|
||||
static inline
|
||||
inline
|
||||
void reverse_float(float *arr, int size)
|
||||
{
|
||||
for (int low = 0, high = size - 1; low < high; ++low, --high) {
|
||||
|
|
@ -38,7 +35,7 @@ namespace Utils {
|
|||
}
|
||||
}
|
||||
|
||||
static inline
|
||||
inline
|
||||
void reverse_double(double *arr, int size)
|
||||
{
|
||||
for (int low = 0, high = size - 1; low < high; ++low, --high) {
|
||||
|
|
@ -48,7 +45,7 @@ namespace Utils {
|
|||
}
|
||||
}
|
||||
|
||||
static inline
|
||||
inline
|
||||
void reverse_char(char *arr, int size)
|
||||
{
|
||||
for (int low = 0, high = size - 1; low < high; ++low, --high) {
|
||||
|
|
@ -57,7 +54,7 @@ namespace Utils {
|
|||
arr[high] = tmp;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -46,5 +46,6 @@ namespace Utils {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -114,5 +114,6 @@ namespace Utils {
|
|||
return file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -137,5 +137,6 @@ namespace Utils {
|
|||
return text_diff { diffValues, diffMasks, diffIndex };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -13,6 +13,27 @@
|
|||
#include <stdio.h>
|
||||
#include "MathUtils.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define ASSERT_EQUALS(a, b, t1, t2) (\
|
||||
if (a == b) { \
|
||||
printf("."); \
|
||||
} else { \
|
||||
printf("[F]"); \
|
||||
printf("\n\n%s - %i: ", __FILE__, __LINE__); \
|
||||
printf(t1, a); printf(" != "); printf(t2, b); printf("\n"); \
|
||||
return 0; } \
|
||||
)
|
||||
|
||||
#define ASSERT_EQUALS_WITH_DELTA(a, b, delta, t1, t2) (\
|
||||
if (oms_abs(a - b) <= _delta) { \
|
||||
printf("."); \
|
||||
} else { \
|
||||
printf("[F]"); \
|
||||
printf("\n\n%s - %i: ", __FILE__, __LINE__); \
|
||||
printf(t1, a); printf(" != "); printf(t2, b); printf("\n"); \
|
||||
return 0; } \
|
||||
)
|
||||
#else
|
||||
#define ASSERT_EQUALS(a, b, t1, t2) \
|
||||
({ __typeof__ (a) _a = (a); \
|
||||
__typeof__ (b) _b = (b); \
|
||||
|
|
@ -21,7 +42,7 @@
|
|||
} else { \
|
||||
printf("[F]"); \
|
||||
printf("\n\n%s - %i: ", __FILE__, __LINE__); \
|
||||
printf(t1, a); printf(" != "); printf(t2, b); printf("\n"); \
|
||||
printf(t1, _a); printf(" != "); printf(t2, _b); printf("\n"); \
|
||||
return 0; } \
|
||||
})
|
||||
|
||||
|
|
@ -35,8 +56,9 @@
|
|||
} else { \
|
||||
printf("[F]"); \
|
||||
printf("\n\n%s - %i: ", __FILE__, __LINE__); \
|
||||
printf(t1, a); printf(" != "); printf(t2, b); printf("\n"); \
|
||||
printf(t1, _a); printf(" != "); printf(t2, _b); printf("\n"); \
|
||||
return 0; } \
|
||||
})
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,8 +18,7 @@
|
|||
#include "FileUtils.h"
|
||||
|
||||
namespace Utils {
|
||||
class WebUtils {
|
||||
private:
|
||||
namespace WebUtils {
|
||||
static
|
||||
int write_download_data (void *ptr, size_t size, size_t nmeb, void *stream)
|
||||
{
|
||||
|
|
@ -41,7 +40,6 @@ namespace Utils {
|
|||
return out->size;
|
||||
}
|
||||
|
||||
public:
|
||||
static
|
||||
Utils::FileUtils::file_body download (char *url)
|
||||
{
|
||||
|
|
@ -57,7 +55,7 @@ namespace Utils {
|
|||
|
||||
return page;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue
Block a user