Commit 0a368e39 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

git-svn-id:...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@54075 954022d7-b5bf-4e40-9824-e11837661b57
parent e5cae73e
...@@ -72,6 +72,32 @@ public: ...@@ -72,6 +72,32 @@ public:
return TRUE; return TRUE;
} }
BOOL Add()
{
if (m_nSize == m_nAllocSize)
{
int nNewAllocSize = (m_nAllocSize == 0) ? 1 : (m_nSize * 2);
T* newT = new T[nNewAllocSize];
if (NULL == newT)
return FALSE;
m_nAllocSize = nNewAllocSize;
if (m_nSize != 0)
{
for (int i = 0; i < m_nSize; ++i)
newT[i] = m_aT[i];
}
RELEASEARRAYOBJECTS(m_aT);
m_aT = newT;
}
return TRUE;
}
BOOL Add(const T& t) BOOL Add(const T& t)
{ {
if (m_nSize == m_nAllocSize) if (m_nSize == m_nAllocSize)
...@@ -108,6 +134,24 @@ public: ...@@ -108,6 +134,24 @@ public:
m_nSize--; m_nSize--;
return TRUE; return TRUE;
} }
BOOL RemoveAt(int nIndex, int nCount)
{
if (nIndex < 0 || nIndex >= m_nSize || nCount < 1)
return FALSE;
if ((nIndex + nCount) > m_nSize)
nCount = m_nSize - nIndex;
for (int i = 0; i < nCount; ++i)
m_aT[nIndex + i].~T();
if ((nIndex + nCount) != m_nSize)
memmove_s((void*)(m_aT + nIndex), (m_nSize - nIndex - nCount + 1) * sizeof(T), (void*)(m_aT + nIndex + nCount), (m_nSize - (nIndex + nCount)) * sizeof(T));
m_nSize--;
return TRUE;
}
void RemoveAll() void RemoveAll()
{ {
if (m_aT != NULL) if (m_aT != NULL)
......
...@@ -289,7 +289,7 @@ namespace NSFile ...@@ -289,7 +289,7 @@ namespace NSFile
} }
} }
lOutputCount = pCodesCur - pData; lOutputCount = (LONG)(pCodesCur - pData);
} }
static void GetUtf8StringFromUnicode_2bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false) static void GetUtf8StringFromUnicode_2bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false)
...@@ -360,7 +360,7 @@ namespace NSFile ...@@ -360,7 +360,7 @@ namespace NSFile
} }
} }
lOutputCount = pCodesCur - pData; lOutputCount = (LONG)(pCodesCur - pData);
} }
static void GetUtf8StringFromUnicode(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false) static void GetUtf8StringFromUnicode(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false)
......
...@@ -39,6 +39,19 @@ typedef int INT; ...@@ -39,6 +39,19 @@ typedef int INT;
typedef unsigned int UINT, *PUINT; typedef unsigned int UINT, *PUINT;
typedef wchar_t WCHAR; typedef wchar_t WCHAR;
#if (!defined (_MAC) && (!defined(MIDL_PASS) || defined(__midl)) && (!defined(_M_IX86) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64)))
typedef __int64 T_LONG64;
typedef unsigned __int64 T_ULONG64;
#else
#if defined(_MAC) && defined(_MAC_INT_64)
typedef __int64 T_LONG64;
typedef unsigned __int64 T_ULONG64;
#else
typedef double T_LONG64;
typedef double T_ULONG64;
#endif //_MAC and int64
#endif
#ifndef VOID #ifndef VOID
typedef void VOID, *LPVOID; typedef void VOID, *LPVOID;
#endif #endif
......
...@@ -93,6 +93,7 @@ public: ...@@ -93,6 +93,7 @@ public:
typedef PointF_T<REAL> PointF; typedef PointF_T<REAL> PointF;
typedef PointF_T<int> Point; typedef PointF_T<int> Point;
typedef PointF_T<double> PointD;
template <typename T> template <typename T>
class RectF_T class RectF_T
...@@ -106,10 +107,10 @@ public: ...@@ -106,10 +107,10 @@ public:
void GetLocation(PointF_T<T>* point) const { point->X = X; point->Y = Y; } void GetLocation(PointF_T<T>* point) const { point->X = X; point->Y = Y; }
void GetSize(SizeF_T<T>* size) const { size->Width = Width; size->Height = Height; } void GetSize(SizeF_T<T>* size) const { size->Width = Width; size->Height = Height; }
void GetBounds(RectF_T* rect) const { rect->X = X; rect->Y = Y; rect->Width = Width; rect->Height = Height; } void GetBounds(RectF_T* rect) const { rect->X = X; rect->Y = Y; rect->Width = Width; rect->Height = Height; }
T GetLeft() const { return X; } inline T GetLeft() const { return X; }
T GetTop() const { return Y; } inline T GetTop() const { return Y; }
T GetRight() const { return X+Width; } inline T GetRight() const { return X+Width; }
T GetBottom() const { return Y+Height; } inline T GetBottom() const { return Y+Height; }
BOOL IsEmptyArea() const { return (Width <= (T)REAL_EPSILON) || (Height <= (T)REAL_EPSILON); } BOOL IsEmptyArea() const { return (Width <= (T)REAL_EPSILON) || (Height <= (T)REAL_EPSILON); }
BOOL Equals(const RectF_T & rect) const BOOL Equals(const RectF_T & rect) const
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment