refactor(Core/Common): restyle common lib with astyle (#3461)
This commit is contained in:
@@ -121,13 +121,15 @@ void BIH::subdivide(int left, int right, std::vector<uint32> &tempTree, buildDat
|
|||||||
if (right == rightOrig)
|
if (right == rightOrig)
|
||||||
{
|
{
|
||||||
// all left
|
// all left
|
||||||
if (prevAxis == axis && G3D::fuzzyEq(prevSplit, split)) {
|
if (prevAxis == axis && G3D::fuzzyEq(prevSplit, split))
|
||||||
|
{
|
||||||
// we are stuck here - create a leaf
|
// we are stuck here - create a leaf
|
||||||
stats.updateLeaf(depth, right - left + 1);
|
stats.updateLeaf(depth, right - left + 1);
|
||||||
createNode(tempTree, nodeIndex, left, right);
|
createNode(tempTree, nodeIndex, left, right);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (clipL <= split) {
|
if (clipL <= split)
|
||||||
|
{
|
||||||
// keep looping on left half
|
// keep looping on left half
|
||||||
gridBox.hi[axis] = split;
|
gridBox.hi[axis] = split;
|
||||||
prevClip = clipL;
|
prevClip = clipL;
|
||||||
@@ -140,14 +142,16 @@ void BIH::subdivide(int left, int right, std::vector<uint32> &tempTree, buildDat
|
|||||||
else if (left > right)
|
else if (left > right)
|
||||||
{
|
{
|
||||||
// all right
|
// all right
|
||||||
if (prevAxis == axis && G3D::fuzzyEq(prevSplit, split)) {
|
if (prevAxis == axis && G3D::fuzzyEq(prevSplit, split))
|
||||||
|
{
|
||||||
// we are stuck here - create a leaf
|
// we are stuck here - create a leaf
|
||||||
stats.updateLeaf(depth, right - left + 1);
|
stats.updateLeaf(depth, right - left + 1);
|
||||||
createNode(tempTree, nodeIndex, left, right);
|
createNode(tempTree, nodeIndex, left, right);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
right = rightOrig;
|
right = rightOrig;
|
||||||
if (clipR >= split) {
|
if (clipR >= split)
|
||||||
|
{
|
||||||
// keep looping on right half
|
// keep looping on right half
|
||||||
gridBox.lo[axis] = split;
|
gridBox.lo[axis] = split;
|
||||||
prevClip = clipR;
|
prevClip = clipR;
|
||||||
@@ -169,14 +173,17 @@ void BIH::subdivide(int left, int right, std::vector<uint32> &tempTree, buildDat
|
|||||||
tempTree.push_back(0);
|
tempTree.push_back(0);
|
||||||
tempTree.push_back(0);
|
tempTree.push_back(0);
|
||||||
tempTree.push_back(0);
|
tempTree.push_back(0);
|
||||||
if (wasLeft) {
|
if (wasLeft)
|
||||||
|
{
|
||||||
// create a node with a left child
|
// create a node with a left child
|
||||||
// write leaf node
|
// write leaf node
|
||||||
stats.updateInner();
|
stats.updateInner();
|
||||||
tempTree[nodeIndex + 0] = (prevAxis << 30) | nextIndex;
|
tempTree[nodeIndex + 0] = (prevAxis << 30) | nextIndex;
|
||||||
tempTree[nodeIndex + 1] = floatToRawIntBits(prevClip);
|
tempTree[nodeIndex + 1] = floatToRawIntBits(prevClip);
|
||||||
tempTree[nodeIndex + 2] = floatToRawIntBits(G3D::inf());
|
tempTree[nodeIndex + 2] = floatToRawIntBits(G3D::inf());
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// create a node with a right child
|
// create a node with a right child
|
||||||
// write leaf node
|
// write leaf node
|
||||||
stats.updateInner();
|
stats.updateInner();
|
||||||
@@ -198,14 +205,17 @@ void BIH::subdivide(int left, int right, std::vector<uint32> &tempTree, buildDat
|
|||||||
// allocate left node
|
// allocate left node
|
||||||
int nl = right - left + 1;
|
int nl = right - left + 1;
|
||||||
int nr = rightOrig - (right + 1) + 1;
|
int nr = rightOrig - (right + 1) + 1;
|
||||||
if (nl > 0) {
|
if (nl > 0)
|
||||||
|
{
|
||||||
tempTree.push_back(0);
|
tempTree.push_back(0);
|
||||||
tempTree.push_back(0);
|
tempTree.push_back(0);
|
||||||
tempTree.push_back(0);
|
tempTree.push_back(0);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
nextIndex -= 3;
|
nextIndex -= 3;
|
||||||
// allocate right node
|
// allocate right node
|
||||||
if (nr > 0) {
|
if (nr > 0)
|
||||||
|
{
|
||||||
tempTree.push_back(0);
|
tempTree.push_back(0);
|
||||||
tempTree.push_back(0);
|
tempTree.push_back(0);
|
||||||
tempTree.push_back(0);
|
tempTree.push_back(0);
|
||||||
|
|||||||
@@ -157,7 +157,8 @@ class BIH
|
|||||||
int stackPos = 0;
|
int stackPos = 0;
|
||||||
int node = 0;
|
int node = 0;
|
||||||
|
|
||||||
while (true) {
|
while (true)
|
||||||
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
uint32 tn = tree[node];
|
uint32 tn = tree[node];
|
||||||
@@ -177,13 +178,15 @@ class BIH
|
|||||||
int back = offset + offsetBack3[axis];
|
int back = offset + offsetBack3[axis];
|
||||||
node = back;
|
node = back;
|
||||||
// ray passes through far node only
|
// ray passes through far node only
|
||||||
if (tf < intervalMin) {
|
if (tf < intervalMin)
|
||||||
|
{
|
||||||
intervalMin = (tb >= intervalMin) ? tb : intervalMin;
|
intervalMin = (tb >= intervalMin) ? tb : intervalMin;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
node = offset + offsetFront3[axis]; // front
|
node = offset + offsetFront3[axis]; // front
|
||||||
// ray passes through near node only
|
// ray passes through near node only
|
||||||
if (tb > intervalMax) {
|
if (tb > intervalMax)
|
||||||
|
{
|
||||||
intervalMax = (tf <= intervalMax) ? tf : intervalMax;
|
intervalMax = (tf <= intervalMax) ? tf : intervalMax;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -201,7 +204,8 @@ class BIH
|
|||||||
{
|
{
|
||||||
// leaf - test some objects
|
// leaf - test some objects
|
||||||
int n = tree[node + 1];
|
int n = tree[node + 1];
|
||||||
while (n > 0) {
|
while (n > 0)
|
||||||
|
{
|
||||||
bool hit = intersectCallback(r, objects[offset], maxDist, stopAtFirstHit);
|
bool hit = intersectCallback(r, objects[offset], maxDist, stopAtFirstHit);
|
||||||
if (stopAtFirstHit && hit) return;
|
if (stopAtFirstHit && hit) return;
|
||||||
--n;
|
--n;
|
||||||
@@ -251,7 +255,8 @@ class BIH
|
|||||||
int stackPos = 0;
|
int stackPos = 0;
|
||||||
int node = 0;
|
int node = 0;
|
||||||
|
|
||||||
while (true) {
|
while (true)
|
||||||
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
uint32 tn = tree[node];
|
uint32 tn = tree[node];
|
||||||
@@ -271,12 +276,14 @@ class BIH
|
|||||||
int right = offset + 3;
|
int right = offset + 3;
|
||||||
node = right;
|
node = right;
|
||||||
// point is in right node only
|
// point is in right node only
|
||||||
if (tl < p[axis]) {
|
if (tl < p[axis])
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
node = offset; // left
|
node = offset; // left
|
||||||
// point is in left node only
|
// point is in left node only
|
||||||
if (tr > p[axis]) {
|
if (tr > p[axis])
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// point is in both nodes
|
// point is in both nodes
|
||||||
@@ -289,7 +296,8 @@ class BIH
|
|||||||
{
|
{
|
||||||
// leaf - test some objects
|
// leaf - test some objects
|
||||||
int n = tree[node + 1];
|
int n = tree[node + 1];
|
||||||
while (n > 0) {
|
while (n > 0)
|
||||||
|
{
|
||||||
intersectCallback(p, objects[offset]); // !!!
|
intersectCallback(p, objects[offset]); // !!!
|
||||||
--n;
|
--n;
|
||||||
++offset;
|
++offset;
|
||||||
|
|||||||
@@ -21,21 +21,25 @@
|
|||||||
|
|
||||||
using VMAP::ModelInstance;
|
using VMAP::ModelInstance;
|
||||||
|
|
||||||
namespace {
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
int CHECK_TREE_PERIOD = 200;
|
int CHECK_TREE_PERIOD = 200;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
template<> struct HashTrait< GameObjectModel>{
|
template<> struct HashTrait< GameObjectModel>
|
||||||
|
{
|
||||||
static size_t hashCode(const GameObjectModel& g) { return (size_t)(void*)&g; }
|
static size_t hashCode(const GameObjectModel& g) { return (size_t)(void*)&g; }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> struct PositionTrait< GameObjectModel> {
|
template<> struct PositionTrait< GameObjectModel>
|
||||||
|
{
|
||||||
static void getPosition(const GameObjectModel& g, G3D::Vector3& p) { p = g.getPosition(); }
|
static void getPosition(const GameObjectModel& g, G3D::Vector3& p) { p = g.getPosition(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> struct BoundsTrait< GameObjectModel> {
|
template<> struct BoundsTrait< GameObjectModel>
|
||||||
|
{
|
||||||
static void getBounds(const GameObjectModel& g, G3D::AABox& out) { out = g.getBounds();}
|
static void getBounds(const GameObjectModel& g, G3D::AABox& out) { out = g.getBounds();}
|
||||||
static void getBounds2(const GameObjectModel* g, G3D::AABox& out) { out = g->getBounds();}
|
static void getBounds2(const GameObjectModel* g, G3D::AABox& out) { out = g->getBounds();}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ namespace VMAP
|
|||||||
const Vector3 p(ray.direction().cross(e2));
|
const Vector3 p(ray.direction().cross(e2));
|
||||||
const float a = e1.dot(p);
|
const float a = e1.dot(p);
|
||||||
|
|
||||||
if (fabs(a) < EPS) {
|
if (fabs(a) < EPS)
|
||||||
|
{
|
||||||
// Determinant is ill-conditioned; abort early
|
// Determinant is ill-conditioned; abort early
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -39,7 +40,8 @@ namespace VMAP
|
|||||||
const Vector3 s(ray.origin() - points[tri.idx0]);
|
const Vector3 s(ray.origin() - points[tri.idx0]);
|
||||||
const float u = f * s.dot(p);
|
const float u = f * s.dot(p);
|
||||||
|
|
||||||
if ((u < 0.0f) || (u > 1.0f)) {
|
if ((u < 0.0f) || (u > 1.0f))
|
||||||
|
{
|
||||||
// We hit the plane of the m_geometry, but outside the m_geometry
|
// We hit the plane of the m_geometry, but outside the m_geometry
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -47,7 +49,8 @@ namespace VMAP
|
|||||||
const Vector3 q(s.cross(e1));
|
const Vector3 q(s.cross(e1));
|
||||||
const float v = f * ray.direction().dot(q);
|
const float v = f * ray.direction().dot(q);
|
||||||
|
|
||||||
if ((v < 0.0f) || ((u + v) > 1.0f)) {
|
if ((v < 0.0f) || ((u + v) > 1.0f))
|
||||||
|
{
|
||||||
// We hit the plane of the triangle, but outside the triangle
|
// We hit the plane of the triangle, but outside the triangle
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -431,7 +434,8 @@ namespace VMAP
|
|||||||
return isc.hit;
|
return isc.hit;
|
||||||
}
|
}
|
||||||
|
|
||||||
class WModelAreaCallback {
|
class WModelAreaCallback
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
WModelAreaCallback(const std::vector<GroupModel>& vals, const Vector3& down):
|
WModelAreaCallback(const std::vector<GroupModel>& vals, const Vector3& down):
|
||||||
prims(vals.begin()), hit(vals.end()), minVol(G3D::inf()), zDist(G3D::inf()), zVec(down) { }
|
prims(vals.begin()), hit(vals.end()), minVol(G3D::inf()), zDist(G3D::inf()), zVec(down) { }
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<class Node>
|
template<class Node>
|
||||||
struct NodeCreator{
|
struct NodeCreator
|
||||||
|
{
|
||||||
static Node* makeNode(int /*x*/, int /*y*/) { return new Node();}
|
static Node* makeNode(int /*x*/, int /*y*/) { return new Node();}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -43,7 +44,8 @@ class RegularGrid2D
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum{
|
enum
|
||||||
|
{
|
||||||
CELL_NUMBER = 64,
|
CELL_NUMBER = 64,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -55,11 +57,13 @@ public:
|
|||||||
MemberTable memberTable;
|
MemberTable memberTable;
|
||||||
Node* nodes[CELL_NUMBER][CELL_NUMBER];
|
Node* nodes[CELL_NUMBER][CELL_NUMBER];
|
||||||
|
|
||||||
RegularGrid2D(){
|
RegularGrid2D()
|
||||||
|
{
|
||||||
memset(nodes, 0, sizeof(nodes));
|
memset(nodes, 0, sizeof(nodes));
|
||||||
}
|
}
|
||||||
|
|
||||||
~RegularGrid2D(){
|
~RegularGrid2D()
|
||||||
|
{
|
||||||
for (int x = 0; x < CELL_NUMBER; ++x)
|
for (int x = 0; x < CELL_NUMBER; ++x)
|
||||||
for (int y = 0; y < CELL_NUMBER; ++y)
|
for (int y = 0; y < CELL_NUMBER; ++y)
|
||||||
delete nodes[x][y];
|
delete nodes[x][y];
|
||||||
|
|||||||
@@ -21,13 +21,15 @@ The collision detection is modified to return true, if we are inside an object.
|
|||||||
namespace VMAP
|
namespace VMAP
|
||||||
{
|
{
|
||||||
template<class TValue>
|
template<class TValue>
|
||||||
class IntersectionCallBack {
|
class IntersectionCallBack
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
TValue* closestEntity;
|
TValue* closestEntity;
|
||||||
G3D::Vector3 hitLocation;
|
G3D::Vector3 hitLocation;
|
||||||
G3D::Vector3 hitNormal;
|
G3D::Vector3 hitNormal;
|
||||||
|
|
||||||
void operator()(const G3D::Ray& ray, const TValue* entity, bool StopAtFirstHit, float& distance) {
|
void operator()(const G3D::Ray& ray, const TValue* entity, bool StopAtFirstHit, float& distance)
|
||||||
|
{
|
||||||
entity->intersect(ray, distance, StopAtFirstHit, hitLocation, hitNormal);
|
entity->intersect(ray, distance, StopAtFirstHit, hitLocation, hitNormal);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
char const* localeNames[TOTAL_LOCALES] = {
|
char const* localeNames[TOTAL_LOCALES] =
|
||||||
|
{
|
||||||
"enUS",
|
"enUS",
|
||||||
"koKR",
|
"koKR",
|
||||||
"frFR",
|
"frFR",
|
||||||
|
|||||||
+54
-27
@@ -350,33 +350,60 @@ class Field
|
|||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case MYSQL_TYPE_BIT: return "BIT";
|
case MYSQL_TYPE_BIT:
|
||||||
case MYSQL_TYPE_BLOB: return "BLOB";
|
return "BIT";
|
||||||
case MYSQL_TYPE_DATE: return "DATE";
|
case MYSQL_TYPE_BLOB:
|
||||||
case MYSQL_TYPE_DATETIME: return "DATETIME";
|
return "BLOB";
|
||||||
case MYSQL_TYPE_NEWDECIMAL: return "NEWDECIMAL";
|
case MYSQL_TYPE_DATE:
|
||||||
case MYSQL_TYPE_DECIMAL: return "DECIMAL";
|
return "DATE";
|
||||||
case MYSQL_TYPE_DOUBLE: return "DOUBLE";
|
case MYSQL_TYPE_DATETIME:
|
||||||
case MYSQL_TYPE_ENUM: return "ENUM";
|
return "DATETIME";
|
||||||
case MYSQL_TYPE_FLOAT: return "FLOAT";
|
case MYSQL_TYPE_NEWDECIMAL:
|
||||||
case MYSQL_TYPE_GEOMETRY: return "GEOMETRY";
|
return "NEWDECIMAL";
|
||||||
case MYSQL_TYPE_INT24: return "INT24";
|
case MYSQL_TYPE_DECIMAL:
|
||||||
case MYSQL_TYPE_LONG: return "LONG";
|
return "DECIMAL";
|
||||||
case MYSQL_TYPE_LONGLONG: return "LONGLONG";
|
case MYSQL_TYPE_DOUBLE:
|
||||||
case MYSQL_TYPE_LONG_BLOB: return "LONG_BLOB";
|
return "DOUBLE";
|
||||||
case MYSQL_TYPE_MEDIUM_BLOB: return "MEDIUM_BLOB";
|
case MYSQL_TYPE_ENUM:
|
||||||
case MYSQL_TYPE_NEWDATE: return "NEWDATE";
|
return "ENUM";
|
||||||
case MYSQL_TYPE_NULL: return "NULL";
|
case MYSQL_TYPE_FLOAT:
|
||||||
case MYSQL_TYPE_SET: return "SET";
|
return "FLOAT";
|
||||||
case MYSQL_TYPE_SHORT: return "SHORT";
|
case MYSQL_TYPE_GEOMETRY:
|
||||||
case MYSQL_TYPE_STRING: return "STRING";
|
return "GEOMETRY";
|
||||||
case MYSQL_TYPE_TIME: return "TIME";
|
case MYSQL_TYPE_INT24:
|
||||||
case MYSQL_TYPE_TIMESTAMP: return "TIMESTAMP";
|
return "INT24";
|
||||||
case MYSQL_TYPE_TINY: return "TINY";
|
case MYSQL_TYPE_LONG:
|
||||||
case MYSQL_TYPE_TINY_BLOB: return "TINY_BLOB";
|
return "LONG";
|
||||||
case MYSQL_TYPE_VAR_STRING: return "VAR_STRING";
|
case MYSQL_TYPE_LONGLONG:
|
||||||
case MYSQL_TYPE_YEAR: return "YEAR";
|
return "LONGLONG";
|
||||||
default: return "-Unknown-";
|
case MYSQL_TYPE_LONG_BLOB:
|
||||||
|
return "LONG_BLOB";
|
||||||
|
case MYSQL_TYPE_MEDIUM_BLOB:
|
||||||
|
return "MEDIUM_BLOB";
|
||||||
|
case MYSQL_TYPE_NEWDATE:
|
||||||
|
return "NEWDATE";
|
||||||
|
case MYSQL_TYPE_NULL:
|
||||||
|
return "NULL";
|
||||||
|
case MYSQL_TYPE_SET:
|
||||||
|
return "SET";
|
||||||
|
case MYSQL_TYPE_SHORT:
|
||||||
|
return "SHORT";
|
||||||
|
case MYSQL_TYPE_STRING:
|
||||||
|
return "STRING";
|
||||||
|
case MYSQL_TYPE_TIME:
|
||||||
|
return "TIME";
|
||||||
|
case MYSQL_TYPE_TIMESTAMP:
|
||||||
|
return "TIMESTAMP";
|
||||||
|
case MYSQL_TYPE_TINY:
|
||||||
|
return "TINY";
|
||||||
|
case MYSQL_TYPE_TINY_BLOB:
|
||||||
|
return "TINY_BLOB";
|
||||||
|
case MYSQL_TYPE_VAR_STRING:
|
||||||
|
return "VAR_STRING";
|
||||||
|
case MYSQL_TYPE_YEAR:
|
||||||
|
return "YEAR";
|
||||||
|
default:
|
||||||
|
return "-Unknown-";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -110,7 +110,8 @@ bool MySQLConnection::Open()
|
|||||||
uint32 const ATTEMPTS = 180;
|
uint32 const ATTEMPTS = 180;
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
m_Mysql = mysql_real_connect(
|
m_Mysql = mysql_real_connect(
|
||||||
mysqlInit,
|
mysqlInit,
|
||||||
m_connectionInfo.host.c_str(),
|
m_connectionInfo.host.c_str(),
|
||||||
|
|||||||
@@ -883,7 +883,8 @@ STACKFRAME64 * sf)
|
|||||||
if (pSym->Flags & IMAGEHLP_SYMBOL_INFO_REGRELATIVE)
|
if (pSym->Flags & IMAGEHLP_SYMBOL_INFO_REGRELATIVE)
|
||||||
{
|
{
|
||||||
// if (pSym->Register == 8) // EBP is the value 8 (in DBGHELP 5.1)
|
// if (pSym->Register == 8) // EBP is the value 8 (in DBGHELP 5.1)
|
||||||
{ // This may change!!!
|
{
|
||||||
|
// This may change!!!
|
||||||
#ifdef _M_IX86
|
#ifdef _M_IX86
|
||||||
pVariable = sf->AddrFrame.Offset;
|
pVariable = sf->AddrFrame.Offset;
|
||||||
#elif _M_X64
|
#elif _M_X64
|
||||||
|
|||||||
@@ -42,7 +42,10 @@ class LinkedListElement
|
|||||||
{
|
{
|
||||||
if (isInList())
|
if (isInList())
|
||||||
{
|
{
|
||||||
iNext->iPrev = iPrev; iPrev->iNext = iNext; iNext = NULL; iPrev = NULL;
|
iNext->iPrev = iPrev;
|
||||||
|
iPrev->iNext = iNext;
|
||||||
|
iNext = NULL;
|
||||||
|
iPrev = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,11 +135,13 @@ class LinkedListHead
|
|||||||
typedef _Ty const& const_reference;
|
typedef _Ty const& const_reference;
|
||||||
|
|
||||||
Iterator() : _Ptr(0)
|
Iterator() : _Ptr(0)
|
||||||
{ // construct with null node pointer
|
{
|
||||||
|
// construct with null node pointer
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator(pointer _Pnode) : _Ptr(_Pnode)
|
Iterator(pointer _Pnode) : _Ptr(_Pnode)
|
||||||
{ // construct with node pointer _Pnode
|
{
|
||||||
|
// construct with node pointer _Pnode
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator& operator=(Iterator const& _Right)
|
Iterator& operator=(Iterator const& _Right)
|
||||||
@@ -152,73 +157,86 @@ class LinkedListHead
|
|||||||
}
|
}
|
||||||
|
|
||||||
reference operator*()
|
reference operator*()
|
||||||
{ // return designated value
|
{
|
||||||
|
// return designated value
|
||||||
return *_Ptr;
|
return *_Ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
pointer operator->()
|
pointer operator->()
|
||||||
{ // return pointer to class object
|
{
|
||||||
|
// return pointer to class object
|
||||||
return _Ptr;
|
return _Ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator& operator++()
|
Iterator& operator++()
|
||||||
{ // preincrement
|
{
|
||||||
|
// preincrement
|
||||||
_Ptr = _Ptr->next();
|
_Ptr = _Ptr->next();
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator operator++(int)
|
Iterator operator++(int)
|
||||||
{ // postincrement
|
{
|
||||||
|
// postincrement
|
||||||
iterator _Tmp = *this;
|
iterator _Tmp = *this;
|
||||||
++*this;
|
++*this;
|
||||||
return (_Tmp);
|
return (_Tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator& operator--()
|
Iterator& operator--()
|
||||||
{ // predecrement
|
{
|
||||||
|
// predecrement
|
||||||
_Ptr = _Ptr->prev();
|
_Ptr = _Ptr->prev();
|
||||||
return (*this);
|
return (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator operator--(int)
|
Iterator operator--(int)
|
||||||
{ // postdecrement
|
{
|
||||||
|
// postdecrement
|
||||||
iterator _Tmp = *this;
|
iterator _Tmp = *this;
|
||||||
--*this;
|
--*this;
|
||||||
return (_Tmp);
|
return (_Tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(Iterator const& _Right) const
|
bool operator==(Iterator const& _Right) const
|
||||||
{ // test for iterator equality
|
{
|
||||||
|
// test for iterator equality
|
||||||
return (_Ptr == _Right._Ptr);
|
return (_Ptr == _Right._Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(Iterator const& _Right) const
|
bool operator!=(Iterator const& _Right) const
|
||||||
{ // test for iterator inequality
|
{
|
||||||
|
// test for iterator inequality
|
||||||
return (!(*this == _Right));
|
return (!(*this == _Right));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(pointer const& _Right) const
|
bool operator==(pointer const& _Right) const
|
||||||
{ // test for pointer equality
|
{
|
||||||
|
// test for pointer equality
|
||||||
return (_Ptr != _Right);
|
return (_Ptr != _Right);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(pointer const& _Right) const
|
bool operator!=(pointer const& _Right) const
|
||||||
{ // test for pointer equality
|
{
|
||||||
|
// test for pointer equality
|
||||||
return (!(*this == _Right));
|
return (!(*this == _Right));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const_reference _Right) const
|
bool operator==(const_reference _Right) const
|
||||||
{ // test for reference equality
|
{
|
||||||
|
// test for reference equality
|
||||||
return (_Ptr == &_Right);
|
return (_Ptr == &_Right);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const_reference _Right) const
|
bool operator!=(const_reference _Right) const
|
||||||
{ // test for reference equality
|
{
|
||||||
|
// test for reference equality
|
||||||
return (_Ptr != &_Right);
|
return (_Ptr != &_Right);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointer _Mynode()
|
pointer _Mynode()
|
||||||
{ // return node pointer
|
{
|
||||||
|
// return node pointer
|
||||||
return (_Ptr);
|
return (_Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,13 +88,27 @@ void Thread::setPriority(Priority priority)
|
|||||||
switch (priority)
|
switch (priority)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
case Priority_Realtime: _ok = SetThreadPriority(handle, THREAD_PRIORITY_TIME_CRITICAL); break;
|
case Priority_Realtime:
|
||||||
case Priority_Highest: _ok = SetThreadPriority(handle, THREAD_PRIORITY_HIGHEST); break;
|
_ok = SetThreadPriority(handle, THREAD_PRIORITY_TIME_CRITICAL);
|
||||||
case Priority_High: _ok = SetThreadPriority(handle, THREAD_PRIORITY_ABOVE_NORMAL); break;
|
break;
|
||||||
case Priority_Normal: _ok = SetThreadPriority(handle, THREAD_PRIORITY_NORMAL); break;
|
case Priority_Highest:
|
||||||
case Priority_Low: _ok = SetThreadPriority(handle, THREAD_PRIORITY_BELOW_NORMAL); break;
|
_ok = SetThreadPriority(handle, THREAD_PRIORITY_HIGHEST);
|
||||||
case Priority_Lowest: _ok = SetThreadPriority(handle, THREAD_PRIORITY_LOWEST); break;
|
break;
|
||||||
case Priority_Idle: _ok = SetThreadPriority(handle, THREAD_PRIORITY_IDLE); break;
|
case Priority_High:
|
||||||
|
_ok = SetThreadPriority(handle, THREAD_PRIORITY_ABOVE_NORMAL);
|
||||||
|
break;
|
||||||
|
case Priority_Normal:
|
||||||
|
_ok = SetThreadPriority(handle, THREAD_PRIORITY_NORMAL);
|
||||||
|
break;
|
||||||
|
case Priority_Low:
|
||||||
|
_ok = SetThreadPriority(handle, THREAD_PRIORITY_BELOW_NORMAL);
|
||||||
|
break;
|
||||||
|
case Priority_Lowest:
|
||||||
|
_ok = SetThreadPriority(handle, THREAD_PRIORITY_LOWEST);
|
||||||
|
break;
|
||||||
|
case Priority_Idle:
|
||||||
|
_ok = SetThreadPriority(handle, THREAD_PRIORITY_IDLE);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Returns a pointer to object of requested type stored with given key or nullptr
|
* Returns a pointer to object of requested type stored with given key or nullptr
|
||||||
*/
|
*/
|
||||||
template<class T> T* Get(std::string const & k) const {
|
template<class T> T* Get(std::string const& k) const
|
||||||
|
{
|
||||||
static_assert(std::is_base_of<Base, T>::value, "T must derive from Base");
|
static_assert(std::is_base_of<Base, T>::value, "T must derive from Base");
|
||||||
if (Container.empty())
|
if (Container.empty())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -42,7 +43,8 @@ public:
|
|||||||
* or default constructs one and returns that one
|
* or default constructs one and returns that one
|
||||||
*/
|
*/
|
||||||
template<class T, typename std::enable_if<std::is_default_constructible<T>::value, int>::type = 0>
|
template<class T, typename std::enable_if<std::is_default_constructible<T>::value, int>::type = 0>
|
||||||
T* GetDefault(std::string const & k) {
|
T * GetDefault(std::string const& k)
|
||||||
|
{
|
||||||
static_assert(std::is_base_of<Base, T>::value, "T must derive from Base");
|
static_assert(std::is_base_of<Base, T>::value, "T must derive from Base");
|
||||||
if (T* v = Get<T>(k))
|
if (T* v = Get<T>(k))
|
||||||
return v;
|
return v;
|
||||||
|
|||||||
@@ -248,11 +248,20 @@ uint32 TimeStringToSecs(const std::string& timestring)
|
|||||||
{
|
{
|
||||||
switch (*itr)
|
switch (*itr)
|
||||||
{
|
{
|
||||||
case 'd': multiplier = DAY; break;
|
case 'd':
|
||||||
case 'h': multiplier = HOUR; break;
|
multiplier = DAY;
|
||||||
case 'm': multiplier = MINUTE; break;
|
break;
|
||||||
case 's': multiplier = 1; break;
|
case 'h':
|
||||||
default : return 0; //bad format
|
multiplier = HOUR;
|
||||||
|
break;
|
||||||
|
case 'm':
|
||||||
|
multiplier = MINUTE;
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
multiplier = 1;
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
return 0; //bad format
|
||||||
}
|
}
|
||||||
buffer *= multiplier;
|
buffer *= multiplier;
|
||||||
secs += buffer;
|
secs += buffer;
|
||||||
@@ -518,7 +527,8 @@ std::wstring GetMainPartOfName(std::wstring const& wname, uint32 declension)
|
|||||||
{ &u_End, &yu_End, &o_End, &ie_End, &soft_End, &ya_End, &a_End },
|
{ &u_End, &yu_End, &o_End, &ie_End, &soft_End, &ya_End, &a_End },
|
||||||
{ &oj_End, &io_j_End, &ie_j_End, &o_m_End, &io_m_End, &ie_m_End, &yu_End },
|
{ &oj_End, &io_j_End, &ie_j_End, &o_m_End, &io_m_End, &ie_m_End, &yu_End },
|
||||||
{ &ie_End, &i_End, nullptr, nullptr, nullptr, nullptr, nullptr }
|
{ &ie_End, &i_End, nullptr, nullptr, nullptr, nullptr, nullptr }
|
||||||
}};
|
}
|
||||||
|
};
|
||||||
|
|
||||||
std::size_t const thisLen = wname.length();
|
std::size_t const thisLen = wname.length();
|
||||||
std::array<std::wstring const*, 7> const& endings = dropEnds[declension];
|
std::array<std::wstring const*, 7> const& endings = dropEnds[declension];
|
||||||
|
|||||||
Reference in New Issue
Block a user